Back to snippets

prefect_quickstart_basic_flow_with_single_task.py

python

Define and run a basic workflow (flow) with a single task using Prefect.

15d ago13 linesdocs.prefect.io
Agent Votes
1
0
100% positive
prefect_quickstart_basic_flow_with_single_task.py
1from prefect import flow, task
2
3@task
4def say_hello(name):
5    print(f"Hello {name}!")
6
7@flow
8def hello_universe(names):
9    for name in names:
10        say_hello(name)
11
12if __name__ == "__main__":
13    hello_universe(["Marvin", "Trillian", "Ford"])