Stephen Herron
08/03/2022, 6:53 PMKhuyen Tran
08/03/2022, 7:53 PMfrom prefect import Flow, task
@task
def add_ten(x):
return x + 10
with Flow('simple map') as flow:
mapped_result = add_ten.map([1, 2, 3])
You can simply write this:
from prefect import flow, task
@task
def add_ten(x):
return x + 10
@flow
def my_flow():
result = [add_ten(num) for num in [1, 2, 3])
Khuyen Tran
08/03/2022, 7:54 PMStephen Herron
08/03/2022, 8:44 PMresult = add_ten.submit(num) for num in [1, 2, 3]
Khuyen Tran
08/03/2022, 9:11 PMZanie
map
operator still, which will run your tasks concurrently. It doesn’t support DFE yet though.