-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
15692: Introduce background jobs #16699
15692: Introduce background jobs #16699
Conversation
A new abstract class can be used to implement job function classes. It handles the necessary logic for starting and stopping jobs, including exception handling and rescheduling of recurring jobs. This commit also includes the migration of data source jobs to the new framework.
Using the 'import_string()' utility from Django allows the job script class to be simplified, as module imports no longer need to avoid loops. This should make it easier to queue and maintain jobs.
Instead of maintaining two separate job execution logics, the same job is now used for both background and interactive execution.
The independent implementations of interactive and background script execution have been merged into a single BackgroundJob implementation.
A new abstract class can be used to implement job function classes that specialize in scheduling. These use the same logic as regular BackgroundJobs, but ensure that they are only scheduled once at any given time.
A new abstract class can be used to implement job function classes that specialize in system background tasks (e.g. synchronization or housekeeping). In addition to the features of the BackgroundJob and ScheduledJob classes, these implement additional logic to not need to be bound to an existing NetBox object and to setup job schedules on plugin load instead of an interactive request.
@alehaa sorry, we haven't forgotten about this, just backlogged on the v4.1 work currently. Hoping to review this this week. |
@alehaa actually would it be possible for you to rename your branch? It conflicts with our |
@jeremystretch unfortunately GitHub did close this PR because of renaming the branch. I've filed #16927 instead and also removed some merge conflicts to the |
Fixes: #15692
This PR includes three new background job class to be used in NetBox and by NetBox plugins. They handle the necessary logic for starting and stopping jobs, including exception handling and rescheduling of recurring jobs.
This PR also implements the use of this framework for existing data source and script jobs, eliminating duplicate code and ensuring consistency.