Alex Ilyin
01/24/2025, 6:39 PM.fn
and without in Prefect 2.xMarvin
01/24/2025, 6:39 PM.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.