@Marvin What is the difference between running a task with
.fn
and without in Prefect 2.x
m
Marvin
01/24/2025, 6:39 PM
In Prefect 2.x, using
.fn
with a task refers to directly calling the underlying function of a task, bypassing Prefect's orchestration features. This means that when you use
.fn
, the task runs immediately like a regular Python function without any of Prefect's metadata handling, state management, or logging.
Conversely, calling a task without
.fn
involves Prefect's orchestration, meaning the task runs with Prefect's infrastructure, including metadata about upstream dependencies, automatic logging, and state management.
For more details on tasks in Prefect 2.x, you can refer to the Prefect 2.x documentation on tasks.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.