Recovery¶
- class chancy.plugins.recovery.Recovery(*, poll_interval: int = 60)[source]¶
Bases:
Plugin
Recovers jobs that appear to be abandoned by a worker.
Typically, this happens when a worker is unexpectedly terminated, or has otherwise been lost which we recognize by checking the last seen timestamp of the worker heartbeat.
This will transition any matching jobs back to the “pending” state, and increment the max_attempts counter by 1 to allow it to be retried.
- Parameters:
poll_interval – The number of seconds between recovery poll intervals.
- static get_dependencies() list[str] [source]¶
Get the identifiers of all plugins this plugin depends on, if any.
Plugins that depend on the presence of other plugins will refuse to start if those dependencies are not met.
- static get_identifier() str [source]¶
Returns a unique identifier for this plugin.
This identifier should be unique across all active plugins. If a custom plugin provides compatible functionality to a built-in plugin, it may use the same identifier as the built-in plugin.
- async classmethod recover(worker: Worker, chancy: Chancy, cursor: AsyncCursor[Dict[str, Any]]) int [source]¶
Recover jobs that were running when the worker was unexpectedly terminated, or has otherwise been lost.
- Parameters:
worker – The worker that is running the recovery.
chancy – The Chancy application.
cursor – The cursor to use for database operations.
- Returns:
The number of rows recovered from the database