Chris Vrooman
05/07/2020, 6:09 AM@task
def my_function(x, y):
print(x+y)
with Flow(name="my_flow") as flow:
# Run 1st
my_function(1, 2)
# Run 2nd
my_function(3, 4)
# Run 3rd
my_function(5, 6)
David Ojeda
05/07/2020, 6:42 AM@prefect.task
def hello(x):
print('hello', x)
with prefect.Flow('my flow') as flow:
one = hello(1)
two = hello(2, upstream_tasks=[one])
three = hello(3, upstream_tasks=[two])
flow.run()
The other option is to call two.set_dependencies(…)
which is what the upstream_task
argument is used for…Jeremiah
05/07/2020, 1:14 PMset_upstream()
or set_downstream()
to enforce ordering without passing data.Chris Vrooman
05/07/2020, 5:56 PM