Hey, is this supposed to work? It works for me on ...
# ask-the-community
r
Hey, is this supposed to work? It works for me on the cluster but not locally (ie. just running it with python), in tk_agg the list items are promises instead of Something instances (so x.n fails)
Copy code
from flytekit import dynamic, task, workflow

class Something:
    n: int

@task
def tk_inner() -> Something:
    s = Something()
    s.n = 3
    return s

@task
def tk_agg(s: list[Something]) -> int:
    return sum(x.n for x in s)

@dynamic
def tk_outer() -> int:
    s = [tk_inner() for _ in range(5)]
    return tk_agg(s=s)

@workflow
def wf_outer() -> int:
    return tk_outer()

assert wf_outer() == sum(range(5))
k
It is supposed to work. This seems like a flytekit local executor bug. Cc @Yee : @Kevin Su can either of you take a look
y
What’s the Something? Is it something that gets pickled?
and what’s the error? can you paste?
r
all the code is there including the class Something, should be able to just run that script. the error was that it tried to call .json() which didn't exist iirc (but could be wrong), but I'm not at my pc atm to check
ah no nvm it was because the list items were still promises
In tk_agg
149 Views