Hi team.. I’m running into this error in some of m...
# ask-the-community
r
Hi team.. I’m running into this error in some of my workflows.
Copy code
RestrictedTypeError: Transformer for type <class 'tuple'> is restricted currently
I have a task say
get_data
that returns a NamedTuple
Copy code
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…
More stack trace
Copy code
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
For now I switched my code to using dataclasses… but I’m pretty sure this worked before…
j
yeah it works on our setup too,
get_data
task returns
MyData
namedtuple right?
r
Yes