acoustic-carpenter-78188
06/07/2024, 10:01 PM_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
result = handle(
../../test_util/remote_util.py:30: in handle
return self._execute_and_assert(remote_entity, **kwargs)
../../test_util/remote_util.py:47: in _execute_and_assert
return RemoteHandler._outputs(execution)
../../test_util/remote_util.py:55: in _outputs
values = [value for value in execution.outputs.values()]
../../test_util/remote_util.py:55: in <listcomp>
values = [value for value in execution.outputs.values()]
../../../../../../.pyenv/versions/3.10.13/lib/python3.10/_collections_abc.py:930: in __iter__
yield self._mapping[key]
../../../.venv/lib/python3.10/site-packages/flytekit/core/type_engine.py:2196: in __getitem__
return self.get(key)
../../../.venv/lib/python3.10/site-packages/flytekit/core/type_engine.py:2225: in get
val = TypeEngine.to_python_value(
../../../.venv/lib/python3.10/site-packages/flytekit/core/type_engine.py:1187: in to_python_value
return transformer.to_python_value(ctx, lv, expected_python_type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Python Dictionary Transforms (<class 'dict'>) to Flyte native
ctx = FlyteContext(file_access=<flytekit.core.data_persistence.FileAccessProvider object at 0x1042ffe20>, level=2, flyte_cli...0x1036bd6c0>), serialization_settings=None, in_a_condition=False, origin_stackframe=None, output_metadata_tracker=None)
lv = <FlyteLiteral(Literal) scalar { generic { fields { key: "error" value { null_value: NULL_VALUE } } } }>
expected_python_type = <class 'dict'>
def to_python_value(self, ctx: FlyteContext, lv: Literal, expected_python_type: Type[dict]) -> dict:
if lv and lv.map and lv.map.literals is not None:
tp = self.dict_types(expected_python_type)
if tp is None or tp[0] is None:
raise TypeError(
"TypeMismatch: Cannot convert to python dictionary from Flyte Literal Dictionary as the given "
"dictionary does not have sub-type hints or they do not match with the originating dictionary "
"source. Flytekit does not currently support implicit conversions"
)
if tp[0] != str:
raise TypeError("TypeMismatch. Destination dictionary does not accept 'str' key")
py_map = {}
for k, v in lv.map.literals.items():
py_map[k] = TypeEngine.to_python_value(ctx, v, cast(Type, tp[1]))
return py_map
# for empty generic we have to explicitly test for lv.scalar.generic is not None as empty dict
# evaluates to false
if lv and lv.scalar and lv.scalar.generic is not None:
> if lv.metadata["format"] == "json":
E TypeError: 'NoneType' object is not subscriptable
../../../.venv/lib/python3.10/site-packages/flytekit/core/type_engine.py:1809: TypeError
Process finished with exit code 1
Expected behavior
Outputs should be properly returned.
Additional context to reproduce
Trigger a remote launchplan that returns <FlyteLiteral(Literal) scalar { generic { fields { key: "error" value { null_value: NULL_VALUE } } } }>
this won't have the metadata
field set and in turn fail to process.
We believe this bug was introduced with the following PR
Screenshots
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyteacoustic-carpenter-78188
06/07/2024, 10:01 PMacoustic-carpenter-78188
06/12/2024, 4:06 PMacoustic-carpenter-78188
06/12/2024, 4:57 PM