cool-lifeguard-49380
08/20/2024, 8:36 AMmin_success_ratio
) is expected to work? Details in 🧵cool-lifeguard-49380
08/20/2024, 8:38 AMfrom typing import Optional
from flytekit import task, workflow, map_task, dynamic
@task
def foo_task(inp: str) -> float:
# Might or might not fail
return 0.5
@dynamic
def foo_dynamic(inp: str) -> float:
# Multiple tasks need to be called here, dynamic is in fact needed
res = foo_task(inp=inp)
return res
@task
def report(res: list[Optional[float]]):
# Process and report all successful results
print(f"Results: {res}")
@workflow
def wf():
# Run dynamic subworkflow for multiple inputs, we expect that some might fail
res = map_task(foo_dynamic, min_success_ratio=0.25)(inp=["foo", "bar"])
# Process the results of the succesful dyn subworkflows
report(res=res)
if __name__ == "__main__":
wf()
cool-lifeguard-49380
08/20/2024, 8:39 AMTypeError: Failed to convert outputs of task
'wf.map_foo_dynamic_13e5678cbbca248d78d96e312e72de26-arraynode' at position 0.
Failed to convert type <class 'list'> to type typing.List[typing.Optional[float]].
Error Message: Cannot convert from [Flyte Serialized object: Type: <LiteralMap> Value: <literals {
key: "o0" value { scalar { primitive { float_value: 0.5 } } } }>] to typing.Optional[float].
cool-lifeguard-49380
08/20/2024, 8:39 AMpyflyte run
the workflow in the cluster but then get the following error in the dynamic task:
File "/usr/local/lib/python3.10/site-packages/flytekit/tools/translator.py", line 498, in get_serializable_node
task_spec = get_serializable(entity_mapping, settings, entity.flyte_entity, options=options)
File "/usr/local/lib/python3.10/site-packages/flytekit/tools/translator.py", line 789, in get_serializable
cp_entity = get_serializable_task(entity_mapping, settings, entity)
File "/usr/local/lib/python3.10/site-packages/flytekit/tools/translator.py", line 176, in get_serializable_task
settings.project,
Message:
AttributeError: 'NoneType' object has no attribute 'project'
User error.
cool-lifeguard-49380
08/20/2024, 8:40 AMcool-lifeguard-49380
08/20/2024, 8:40 AMthankful-minister-83577
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
cool-lifeguard-49380
08/21/2024, 7:35 AMcool-lifeguard-49380
08/21/2024, 7:31 PMcool-lifeguard-49380
08/21/2024, 7:46 PMcool-lifeguard-49380
08/21/2024, 8:34 PM