Reprioritization¶
- class chancy.plugins.reprioritize.Reprioritize(rule, *, check_interval: int = 300, priority_increase: int = 1, batch_size: int = 1000)[source]¶
Bases:
Plugin
A plugin that increases the priority of jobs based on how long they’ve been in the queue. This helps prevent job starvation by gradually increasing the priority of older jobs.
Example usage:
plugin = Reprioritize( rule=( (Reprioritize.Rules.Age() > 600) & (Reprioritize.Rules.Queue() == "high-priority") ), check_interval=300, priority_increase=1 )
This means that any job that has been in the queue for more than 10 minutes will have its priority increased by 1 every 5 minutes, but only for jobs in the high-priority queue.
- classmethod get_scope() PluginScope [source]¶
Get the scope of this plugin. Scopes control when and where the plugin will be run.
By default, plugins are scoped to the worker.