Prefect 2.0
To create a flow, add a @flow
decorator to your function.
from prefect import flow
@flow
def flow_function_name():
pass
Flows are uniquely identified by name. The above flow will be named flow_function_name
. You can provide a custom name to your flow by using the name
argument:
from prefect import flow
@flow(name="Sales report ELT")
def your_flow_function():
pass
Prefect 1.0
Prefect 1.0 uses a context manager to define a Flow object constructing a DAG.
from prefect import Flow
with Flow("flow name") as flow:
# defining the DAG structure here