Hi, What would the expected behavior of the follo...
# ask-the-community
k
Hi, What would the expected behavior of the following workflow be:
Copy code
@task
def demo_task(strings: List[str], num: int) -> str:
    return f"{num}".join(strings)

@workflow
def demo_wf(strings: List[str], nums: List[int]) -> None:
    map_task(functools.partial(demo_task, strings=strings))(num=nums)
According to the docs, lists are not allowed as input of a partial, therefore I would expect this to crash at compilation or during runtime. Weirdly, this does compile fine and even works, if the length of both lists is equal. If the input of the above example is a,b,c and 1,2,3, the output looks like the following: ["a1b1c","a2b2c","a3b3c"] which is what I would expect. If the length of the two arrays is different, however, the task fails with input arrays have different lengths: expecting 'x' found 'x' I cannot really see, why the lenght of these lists wouls have to be equal. Tested with both array node map_task and k8s array map_task.
d
@Klemens Kasseroller the answer here would get into the deep details of how maptasks are implemented 😅. Basically, if a maptask has multiple input values they obviously need to be lists of the same length so that each subtask can operate over a specific index in the input values. Currently, the partial integration does not expose to the backend (ie. propeller) which fields are passed statically as part of the partial. Therefore, it has no idea how to exclude the partial field from this list check. It's something that should be fixed (ie. allow backend to know which fields are partials) or error as you suggested.
cc @Ketan (kumare3) @Eduardo Apolinario (eapolinario)
k
I see, thanks for the explanation! Is there a plan already to implement this?
Is there any update on this?
k
Let’s make this av issue
k