sopel.plugins.jobs#
Sopel’s plugin jobs management.
New in version 7.1.
Important
This is all fresh and new. Its usage and documentation is for Sopel core development and advanced developers. It is subject to rapid changes between versions without much (or any) warning.
Do not build your plugin based on what is here, you do not need to.
- class sopel.plugins.jobs.Scheduler(manager)#
Bases:
Scheduler
Plugin job scheduler.
- Parameters:
manager (
sopel.bot.Sopel
) – bot instance passed to jobs as argument
Scheduler that stores plugin jobs and behaves like its
parent class
.New in version 7.1.
Note
This class is a specific implementation of the scheduler, made to store jobs by their plugins and be used by the bot (its
manager
). It follows a similar interface as theplugin rules manager
.Important
This is an internal tool used by Sopel to manage its jobs. To register a job, plugin authors should use
sopel.plugin.interval()
.- clear_jobs()#
Clear current Job queue and start fresh.
This method is thread safe. However, it won’t cancel or stop any currently running jobs.
- register(job)#
Register a Job to the current job queue.
- Parameters:
job (
sopel.tools.jobs.Job
) – job to register
This method is thread safe.
- remove_callable_job(callable)#
Remove
callable
from the job queue.- Parameters:
callable (function) – the callable to remove
This method is thread safe. However, it won’t cancel or stop any currently running jobs.
- unregister_plugin(plugin_name)#
Unregister all the jobs from a plugin.
- Parameters:
plugin_name (str) – the name of the plugin to remove
- Returns:
the number of jobs unregistered for this plugin
- Return type:
All jobs of that plugin will be removed from the scheduler.
This method is thread safe. However, it won’t cancel or stop any currently running jobs.