Skip to content

Allow plugin to create their own django-rq queues #6651

@maximumG

Description

@maximumG

NetBox version

v2.11.7

Feature type

New functionality

Proposed functionality

I'd like to propose the ability for netbox plugin to define some dedicated django-rq queue(s). This new feature has already been discussed in #4908 but was missing a owner back in time.

The idea would be to store queue names in a new attribute inside the PluginConfig class. This attributes would be a list in order to defined several queue to create by django-rq.

In order to avoid queue name collision, the actual queue names will be prepended by the plugin name.

As an exemple the following config will lead to 3 queues being created using django-rq:

  • my_super_plugin.high
  • my_super_plugin.medium
  • my_super_plugin.low
MyPluginConfig(PluginConfig):
    name = "my_super_plugin"
    queues = [
        "low"
        "medium"
        "high"
    ]

The creation of the queues will need to override django settings (RQ_QUEUES) and can be done in the ready method of the PluginConfig class.

We can also override django RQ_QUEUES settings directly in the settings.py, during init of all plugins.

If you are interested in such feature I can take care of a PR.

Use case

All netbox plugins have the possibility to use the default queue to do some background/housekeeping tasks. If these tasks are long-running tasks they will block all other netbox-native background jobs, including netbox-reports & netbox-script.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions