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
Correct. I thought that this would be obvious (and will be the default soon enough) but if this wasn’t clear to you, I’ll add a headline to each of those topics saying that it’s for 2.0 to make the distinction clearer