acoustic-carpenter-78188
10/20/2023, 4:23 PMremote.fetch_task(...)(...), flytekit fails to find subtype of a list.
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/core/promise.py:814 in │
│ create_and_link_node_from_remote │
│ │
│ ❱ 814 │ │ │ b, n = binding_from_python_std( │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/core/promise.py:606 in binding_from_python_std │
│ │
│ ❱ 606 │ binding_data = binding_data_from_python_std(ctx, expected_literal │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/core/promise.py:552 in binding_data_from_python_std │
│ │
│ ❱ 552 │ │ sub_type: type = ListTransformer.get_sub_type(t_value_type) │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/core/type_engine.py:1062 in get_sub_type │
│ │
│ ❱ 1062 │ │ raise ValueError("Only generic univariate typing.List[T] type │
╰──────────────────────────────────────────────────────────────────────────────╯
ValueError: Only generic univariate typing.List[T] type is supported.
The above exception was the direct cause of the following exception:
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/exceptions/scopes.py:199 in user_entry_point │
│ │
│ ❱ 199 │ │ │ │ return wrapped(*args, **kwargs) │
│ │
│ ... │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/remote/remote_callable.py:54 in __call__ │
│ │
│ ❱ 54 │ │ │ return self.compile(ctx, *args, **kwargs) │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/remote/remote_callable.py:34 in compile │
│ │
│ ❱ 34 │ │ return create_and_link_node_from_remote(ctx, entity=self, **kwa │
│ │
│ /Users/honnix/.pyenv/versions/3.8.16/envs/flyte-python-examples/lib/python3. │
│ 8/site-packages/flytekit/core/promise.py:825 in │
│ create_and_link_node_from_remote │
│ │
│ ❱ 825 │ │ │ raise AssertionError(f"Failed to Bind variable {k} for fu │
╰──────────────────────────────────────────────────────────────────────────────╯
AssertionError: Failed to Bind variable clustering for function ...
In function create_and_link_node_from_remote there is t_value_type=type(v), # since we don't have the python type available, which means for a list we will only be able to get <class 'list'> without typing info, and that would later fail ListTransformer.get_sub_type.
Expected behavior
Compilation should work when using remote API to fetch remote task.
I tried changing https://github.com/flyteorg/flytekit/blob/d8cd99bba8b7db612676696feb9e4bcee72f07e2/flytekit/core/type_engine.py#L1062 to return None similarly as what happens in DictTransformer, and that worked, because we basically do TypeEngine.to_literal(ctx, t_value, t_value_type or type(t_value), expected_literal_type).scalar to get the subtype when creating the literal.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyte