Rupsha Chaudhuri
09/11/2023, 8:37 PMRestrictedTypeError: Transformer for type <class 'tuple'> is restricted currently
I have a task say get_data
that returns a NamedTuple
class MyData(NamedTuple):
aa: str
bb: str
cc: str
In my workflow
def my_workflow():
my_data = get_data()
my_result = process_my_data_aa(aa=my_data.aa)
The 2nd line in the workflow throws the error. I have used NamedTuples in the past so not sure what’s the issue here…File "/opt/venv/lib/python3.8/site-packages/flytekit/core/python_function_task.py", line 121, in __init__
super().__init__(
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/python_auto_container.py", line 74, in __init__
super().__init__(
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/base_task.py", line 386, in __init__
interface=transform_interface_to_typed_interface(interface),
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/interface.py", line 219, in transform_interface_to_typed_interface
inputs_map = transform_variable_map(interface.inputs, input_descriptions)
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/interface.py", line 328, in transform_variable_map
res[k] = transform_type(v, descriptions.get(k, k))
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/interface.py", line 346, in transform_type
return _interface_models.Variable(type=TypeEngine.to_literal_type(x), description=description)
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/type_engine.py", line 710, in to_literal_type
res = transformer.get_literal_type(python_type)
File "/opt/venv/lib/python3.8/site-packages/flytekit/core/type_engine.py", line 210, in get_literal_type
raise RestrictedTypeError(f"Transformer for type {self.python_type} is restricted currently")
flytekit.core.type_engine.RestrictedTypeError: Transformer for type <class 'tuple'> is restricted currently
Jay Ganbat
09/11/2023, 9:51 PMget_data
task returns MyData
namedtuple right?Rupsha Chaudhuri
09/12/2023, 5:20 AM