Learn how to upgrade from Prefect 2.x to Prefect 3.0.
async
tasks from synchronous flows, a pattern that is not normally supported in Python. Prefect 3.0.0 removes this behavior to reduce complexity and potential issues and edge cases. If you relied on asynchronous tasks in synchronous flows, you must either make your flow asynchronous or use a task runner that supports asynchronous execution.
return
value of the flow function (same as in Prefect 2.0):
State
that is returned will be considered the final state of the flow run. If an iterable of State
objects is returned, all must be Completed
for the flow run to be considered Completed
. If any are Failed
, the flow run will be marked as Failed
.raise
:
Failed
state.raise_on_failure=False
will not affect the flow run state.raise_on_failure=False
.return_state=True
and explicitly check task states to conditionally raise
the underlying exception or return a failed state.cache_policy=None
to your task.
AttributeError: 'coroutine' object has no attribute <some attribute>
await
an asynchronous function or method, this error will be raised when you try to use the object.
To fix it, await
the asynchronous function or method or use _sync=True
.
For example, Block
’s load
method is asynchronous in an async context:
await
the coroutine to fix it or use _sync=True
.
TypeError: object <some Type> can't be used in 'await' expression
await
keyword before an object that is not a coroutine.
To fix it, remove the await
.
For example, my_task.submit(...)
is always synchronous in Prefect 3.x:
TypeError: Flow.deploy() got an unexpected keyword argument 'schedule'
schedule
argument has been removed in favor of the schedules
argument.
This applies to both the Flow.serve
and Flow.deploy
methods.