Recovery¶
- class chancy.plugins.recovery.Recovery(*, poll_interval=60)[source]¶
Bases:
PluginRecovers jobs that appear to be abandoned by a worker.
Note
This plugin is enabled by default, you only need to provide it in the list of plugins to customize its arguments or if
no_default_pluginsis set toTrue.from chancy.plugins.recovery import Recovery async with Chancy(..., plugins=[ Recovery() ]) as chancy: ...
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.
Recovery invalidates the old execution’s claim and requests best-effort cancellation of that execution. It does not wait for acknowledgement: the old worker may be unreachable, and cancellation may be unsupported. Late updates from the old claim are discarded even if it keeps running.
- Parameters:
poll_interval (int) – The number of seconds between recovery poll intervals.
- static get_dependencies()[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()[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.
- Return type: