aws-rfdk
aws-rfdk copied to clipboard
ThinkboxDockerImages type is not compatible with RenderQueueProps
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...
- The images property is expecting to implement the RenderQueueImages interface.
- 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
A probable (untested) workaround would be to change
images=images,
in the example (here) to
images=images.for_render_queue(),
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/[email protected]/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/[email protected]/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: Bug Report
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
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.
Just tried this with the latest JSII and it has the same issue.
Even with the work around listed in this issue, it looks like Python bridge of JSII does not generate a compatible interface.
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.