Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThinkboxDockerImages type is not compatible with RenderQueueProps #818

Closed
ddneilson opened this issue Sep 14, 2022 · 5 comments · Fixed by #880
Closed

ThinkboxDockerImages type is not compatible with RenderQueueProps #818

ddneilson opened this issue Sep 14, 2022 · 5 comments · Fixed by #880
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@ddneilson
Copy link
Contributor

ddneilson commented Sep 14, 2022

Customers are reportedly seeing a stack trace when trying to use the Python version of the All-In-AWS-Infrastructure-Basic example. Stack trace below.

My guess is that the type checking of jsii (the package that translates Python to Javascript for the constructs) improved their type checking, and that somehow didn't get caught when we tested; very odd...

  1. The images property is expecting to implement the RenderQueueImages interface.
  2. ThinkboxDockerImages implicitly implements that interface, but doesn't explicitly do so.

So, a strict type checker would think that the types are not compatible. A less strict type checker that just does duck-typing, like jsii previously did, would be fine with it.

Workaround

See comment below

Environment

  • CDK CLI Version : N/A
  • CDK Framework Version: N/A
  • RFDK Version: v1.0
  • Deadline Version: N/A
  • Language (Version): Python

Other

Stack trace:

Traceback (most recent call last):

  File "/opt/homebrew/Cellar/python@3.9/3.9.14/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,

  File "/opt/homebrew/Cellar/python@3.9/3.9.14/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)

  File "/Users/username/Dev/aws-rfdk/examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/app.py", line 140, in <module>
    main()

  File "/Users/username/Dev/aws-rfdk/examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/app.py", line 120, in main
    service = service_tier.ServiceTier(app, 'ServiceTier', props=service_props, env=env)

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)

  File "/Users/username/Dev/aws-rfdk/examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/lib/service_tier.py", line 175, in __init__
    self.render_queue = RenderQueue(

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/aws_rfdk/deadline/__init__.py", line 3214, in __init__
    props = RenderQueueProps(

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/aws_rfdk/deadline/__init__.py", line 3878, in __init__
    check_type(argname="argument images", value=images, expected_type=type_hints["images"])

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/typeguard/__init__.py", line 757, in check_type
    checker_func(argname, value, expected_type, memo)

  File "/Users/username/.local/share/virtualenvs/python-_pFP3kJg/lib/python3.9/site-packages/typeguard/__init__.py", line 558, in check_union
    raise TypeError('type of {} must be one of ({}); got {} instead'.

TypeError: type of argument images must be one of (aws_rfdk.deadline.RenderQueueImages, Dict[str, Any]); got aws_rfdk.deadline.ThinkboxDockerImages instead

This is 🐛 Bug Report

@ddneilson ddneilson added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 14, 2022
@ddneilson
Copy link
Contributor Author

Note: If this turns out to be something that we need to fix in the example, rather than by changing the jsii version, then we'll also need to update the example in the docs: https://docs.aws.amazon.com/rfdk/latest/guide/first-rfdk-app.html#_define_a_deadline_render_farm

@ddneilson
Copy link
Contributor Author

Same problem appears to exist for UBL. Need to use https://docs.aws.amazon.com/rfdk/api/latest/python/aws_rfdk.deadline/ThinkboxDockerImages.html#aws_rfdk.deadline.ThinkboxDockerImages.for_usage_based_licensing instead of just passing the ThinkboxDockerImages.

@leongdl
Copy link
Contributor

leongdl commented Oct 28, 2022

Just tried this with the latest JSII and it has the same issue.

@leongdl
Copy link
Contributor

leongdl commented Oct 28, 2022

Even with the work around listed in this issue, it looks like Python bridge of JSII does not generate a compatible interface.

@ddneilson
Copy link
Contributor Author

For anyone finding this ticket before v1.1 of the RFDK is released with the fix, the problem was indeed with marshalling of types between JS and Python.

The actual workaround will look like:

 images=RenderQueueImages(remote_connection_server=images.remote_connection_server)

i.e. Explicitly create a RenderQueueImages from the remote_connection_server property of ThinkboxDockerImages

A similar change, using UsageBasedLicensingImages would fix the similar problem with the UsageBasedLicensing's argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants