Simon Gasse
08/13/2021, 12:48 PMSimon Gasse
08/13/2021, 12:50 PMprefect
's reporting on failed tasks. Is this the best way to describe the relation?
from prefect import Flow, task
@task
def task1():
pass
@task
def task2():
pass
@task
def task3():
pass
with Flow("Linear Flow") as flow:
task1().set_downstream(task2().set_downstream(task3()))
flow.run()
Simon Gasse
08/13/2021, 12:51 PMSimon Gasse
08/13/2021, 12:52 PMfrom prefect import Flow, task
@task
def task1():
pass
@task
def task2():
return [0, 1, 2, 3]
@task
def task3(number):
print(number)
@task
def task4():
pass
with Flow("Linear Flow") as flow:
intermediate_output = task2().set_upstream(task1)
task4().set_upstream(task3.map(intermediate_output))
flow.run()
Simon Gasse
08/13/2021, 12:53 PMSam Cook
08/13/2021, 1:42 PMflow.chain
. It will take a list of tasks and set upstream/downstream links between each one (linking sequential tasks in list order)
https://docs.prefect.io/api/latest/core/flow.html#flow-2Sam Cook
08/13/2021, 1:45 PMflow.get_tasks
with a filter condition to get all the tasks added to the flow as a list if you don't want to track them manuallySimon Gasse
08/13/2021, 1:50 PM