Reputation: 23
I'm currently working with the Python framework - Prefect (prefect.io) I wrote the code below
from prefect import Flow, task
@task
def say_hello():
print('Hello')
@task
def say_how_a_u():
print('How are you?')
@task
def say_bye():
print('Bye Bye')
with Flow('Test') as flow:
say_hello()
say_how_a_u()
say_bye()
flow.run()
The fact is that all functions are called in parallel. How to make one function call after another and waited for the previous function? hello -> how_a_u -> bye
I work with triggers, but it fail
Upvotes: 1
Views: 1513
Reputation: 687
You can just specify the upstream dependencies during the Flow block. There is another syntax you can find here
from prefect import Flow, task
@task
def say_hello():
print('Hello')
@task
def say_how_a_u():
print('How are you?')
@task
def say_bye():
print('Bye Bye')
with Flow('Test') as flow:
a = say_hello()
b = say_how_a_u(upstream_tasks=[a])
c = say_bye(upstream_tasks=[b])
flow.run()
Upvotes: 2