acoustic-carpenter-78188
06/12/2024, 12:52 AMmap_task
with partial
locally this function does not recognise which inputs are fixed and which input is to be mapped.
Expected behavior
map_task
with partial
runs correctly when executed remotely (as long as the fixed inputs are not list[...]
and the mapped input is not a list[list[...]]
- I will follow up on this with another issue). There should be a clearer error message which indicates that the first argument of the task being mapped should be the mapped argument.
Additional context to reproduce
[This is code taken from your v1.5.0 milestone release]
@task
def t1(x: int, y: float) -> float:
return x + y
@workflow
def wf(y: List[float]) -> List[float]:
partial_t1 = partial(t1, x=5)
return map_task(partial_t1)(y=y)
The workflow above will raise a TypeError
when run locally with the following inputs wf(y=[0.1, 0.3, 0.5, 0.7])
for example.
Error message:
TypeError: Encountered error while executing workflow 'wf':
Error encountered while executing 'wf':
object of type 'int' has no len()
This function will consider the first input x
, a fixed input, instead of the mapped input. The TypeError
comes from x
not being a List.
The workflow will successfully run when executed remotely.
The current fix is to ensure the mapped input is the first input of the task (switch x
and y
in t1
), however this was not easy to find since the error message it not clear.
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/12/2024, 12:52 AM