Gavrie Philipson
02/03/2025, 11:32 AMMarvin
02/03/2025, 11:32 AMhandle_retry
method, which schedules the task for retry based on configured retry delays.
2. Handling Exceptions: If a task fails and cannot be retried, the task's state is set to Failed
. You can use the handle_exception
method to record the exception and transition the task to a terminal state.
3. Awaiting Completion: Tasks can be awaited until they reach a terminal state (e.g., Completed
, Failed
). Prefect's task engine handles state transitions and can listen for events or poll for state changes.
For more detailed information, you can refer to the task engine code.
Additionally, the top-level API of Prefect includes modules like flow
, task
, and State
that are central to handling tasks and their states. For more on the API, you can explore Prefect's top-level API documentation.
If you are using Prefect 3.x, remember that it supports handling exceptions through state management, allowing you to programmatically respond to task failures.