sebastian.clanzett
09/16/2020, 12:40 PMwith Flow("Flow1") as flow:
config = get_config('local')
value1, value2 = task1()
If i try this i get : TypeError: 'FunctionTask' object is not iterableMark Koob
09/16/2020, 12:57 PMiterable = task1()
value1 = iterable[1] # or maybe it has to be FunctionTask(lambda x: x[1])?
sebastian.clanzett
09/16/2020, 1:06 PMjosh
09/16/2020, 1:13 PMtask1
is due to the fact that prefect doesn’t know the result of that task until runtime so Python can’t do the unpacking. (prefect uses a deferred computation model for flow building) Python will let you index the result from that task if that suites your needs:
@task
def a():
return 1, 2
@task
def b(x, y):
print(x + y)
with Flow('unpack') as flow:
res = a()
b(res[0], res[1])
sebastian.clanzett
09/16/2020, 1:15 PM