Walee
05/19/2021, 5:42 PMKevin Kho
import prefect
from prefect import task, Flow
import logging
@task
def a():
return [1,2,3,4,5,6,7,8,9,10]
@task
def b(x):
return x + 1
@task
def c(list_x):
return [list_x[i:i+2] for i in range(0, len(list_x), 2)]
@task
def d(list_x):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(sum(list_x))
return sum(list_x)
with Flow(" ") as flow:
x = a()
y = b.map(x)
y_batch = c(y)
z = d.map(y_batch)
flow.run()
Kevin Kho
Walee
05/19/2021, 6:19 PM