rough-rose-81585
08/23/2022, 2:50 PM@dataclass_json
class Foo
. It said i needed types.FooSchema
not Foo
.
I assume there is some way to transform Foo
into FooSchema
using either dataclass_json api or flyte api, but I’m not sure how to do it. Could you direct me?
Exception and sample code in thread
Thanks!rough-rose-81585
08/23/2022, 3:04 PMTraceback (most recent call last):
File "orchestration/msat/utility/flyte_remote.py", line 26, in <module>
print(remote.execute(entity=level2_single_retrieval_lp, inputs={"proxy_params": proxy_params}))
File "/Users/nlofaso/.virtualenvs/msat/lib/python3.8/site-packages/flytekit/remote/remote.py", line 842, in execute
return self.execute_remote_task_lp(
File "/Users/nlofaso/.virtualenvs/msat/lib/python3.8/site-packages/flytekit/remote/remote.py", line 919, in execute_remote_task_lp
return self._execute(
File "/Users/nlofaso/.virtualenvs/msat/lib/python3.8/site-packages/flytekit/remote/remote.py", line 715, in _execute
lit = TypeEngine.to_literal(ctx, v, hint, variable.type)
File "/Users/nlofaso/.virtualenvs/msat/lib/python3.8/site-packages/flytekit/core/type_engine.py", line 692, in to_literal
transformer.assert_type(python_type, python_val)
File "/Users/nlofaso/.virtualenvs/msat/lib/python3.8/site-packages/flytekit/core/type_engine.py", line 97, in assert_type
raise TypeTransformerFailedError(f"Type of Val '{v}' is not an instance of {t}")
flytekit.core.type_engine.TypeTransformerFailedError: Type of Val 'Level2ProxyParameters(id='FlyteRemoteTest', job_i_step=1, job_j_step=300, control_template={'CO2': 'CO2_GGG2020_1x1_MAIR.control', 'H2O': 'H2O_GGG2020_1x1_MAIR.control', 'O2': 'O2_GGG2020_1x1_MAIR.control'}, aggregation=<Aggregation.GROUP_1x1: '1x1'>)' is not an instance of <class 'types.Level2proxyparametersSchema'>
rough-rose-81585
08/23/2022, 3:04 PMrough-rose-81585
08/23/2022, 3:04 PMproxy_params.schema()
but received
flytekit.core.type_engine.TypeTransformerFailedError: Type of Val '<Level2proxyparametersSchema(many=False)>' is not an instance of <class 'types.Level2proxyparametersSchema'>
broad-monitor-993
08/23/2022, 3:07 PMtype_hints
argument to the remote.execute
call?
remote.execute(..., type_hints={"proxy_params": types.Level2proxyparametersSchema})
I’ve come across this issue before, if I recall correctly in my case it happened because the dataclass was defined programmatically and wasn’t accessible in the module-level scope.
Let me know what you getrough-rose-81585
08/23/2022, 3:28 PMremote.execute(..., type_hints={"proxy_params": Level2ProxyParameters})
broad-monitor-993
08/23/2022, 3:31 PMLevel2ProxyParameters
being defined programmatically (say, within a function), or is it defined in the top-level scope of your module?rough-rose-81585
08/23/2022, 3:31 PMbroad-monitor-993
08/23/2022, 4:10 PMflytekit.core.type_engine.TypeTransformerFailedError: Type of Val '<Level2proxyparametersSchema(many=False)>' is not an instance of <class 'types.Level2proxyparametersSchema'>
• if appropriate, update the error message here to direct the user to use the type_hints
argument
• document this behavior better @billowy-sundown-31926 @tall-lock-23197shy-holiday-15500
09/02/2022, 7:47 PMshy-holiday-15500
09/02/2022, 7:54 PMtall-lock-23197