Upgrade to django-rq 3.0 #10424

Closed
opened 2025-12-29 21:31:18 +01:00 by adam · 2 comments
Owner

Originally created by @jeremystretch on GitHub (Oct 30, 2024).

Originally assigned to: @arthanson on GitHub.

Proposed Changes

The django-rq package is currently pinned to v2.10.2 due to a failing test when v3.0 is installed. This should be addressed so that we can upgrade to django-rq v3.0 or later.

Justification

Unblocks upgrading to the most recent releases of rq and django-rq.

Originally created by @jeremystretch on GitHub (Oct 30, 2024). Originally assigned to: @arthanson on GitHub. ### Proposed Changes The `django-rq` package is currently pinned to v2.10.2 due to a failing test when v3.0 is installed. This should be addressed so that we can upgrade to `django-rq` v3.0 or later. ### Justification Unblocks upgrading to the most recent releases of `rq` and `django-rq`.
adam added the status: acceptedtype: housekeepingnetbox labels 2025-12-29 21:31:18 +01:00
adam closed this issue 2025-12-29 21:31:18 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 30, 2024):

The failing test is:

FAIL: test_background_task_stop (core.tests.test_views.BackgroundTaskTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jstretch/projects/netbox/netbox/core/tests/test_views.py", line 316, in test_background_task_stop
    self.assertEqual(len(started_job_registry), 1)
AssertionError: 0 != 1

It's not clear why the enqueued job no longer shows up in the StartedJobRegistry.

@jeremystretch commented on GitHub (Oct 30, 2024): The failing test is: ``` FAIL: test_background_task_stop (core.tests.test_views.BackgroundTaskTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jstretch/projects/netbox/netbox/core/tests/test_views.py", line 316, in test_background_task_stop self.assertEqual(len(started_job_registry), 1) AssertionError: 0 != 1 ``` It's not clear why the enqueued job no longer shows up in the StartedJobRegistry.
Author
Owner

@lcarneirofreitas commented on GitHub (Oct 31, 2024):

I am currently installing netbox-docker version 3.7.0. The rqworker container only started functioning after upgrading django-rq to version 3.0.0.

before (django-rq 2.10.1)

/opt/netbox/netbox# /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqworker
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/okta.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 275, in fetch_command
klass = load_command_class(app_name, subcommand)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 48, in load_command_class
module = import_module("%s.management.commands.%s" % (app_name, name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/netbox/netbox/core/management/commands/rqworker.py", line 3, in
from django_rq.management.commands.rqworker import Command as _Command
File "/opt/netbox/venv/lib/python3.11/site-packages/django_rq/management/commands/rqworker.py", line 5, in
from rq import Connection
ImportError: cannot import name 'Connection' from 'rq' (/opt/netbox/venv/lib/python3.11/site-packages/rq/init.py)

after (django-rq 3.0.0)

/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqworker
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/okta.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
No queues have been specified. This process will service the following queues by default: high, default, low
17:13:20 Worker rq:worker:ccb458300dad4624897b1e9e24fc8a4c started with PID 266, version 2.0.0
17:13:20 Subscribing to channel rq:pubsub:ccb458300dad4624897b1e9e24fc8a4c
17:13:20 *** Listening on high, default, low...
17:13:20 Cleaning registries for queue: high
17:13:20 Scheduler for high, low, default started with PID 268
17:13:20 Cleaning registries for queue: default
17:13:20 Cleaning registries for queue: low
17:26:50 Cleaning registries for queue: high
17:26:50 Cleaning registries for queue: default
17:26:50 Cleaning registries for queue: low
17:40:20 Cleaning registries for queue: high
17:40:20 Cleaning registries for queue: default
17:40:20 Cleaning registries for queue: low

Hope this helps!

@lcarneirofreitas commented on GitHub (Oct 31, 2024): I am currently installing netbox-docker version 3.7.0. The rqworker container only started functioning after upgrading django-rq to version 3.0.0. **before (django-rq 2.10.1)** /opt/netbox/netbox# /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqworker 🧬 loaded config '/etc/netbox/config/configuration.py' 🧬 loaded config '/etc/netbox/config/extra.py' 🧬 loaded config '/etc/netbox/config/logging.py' 🧬 loaded config '/etc/netbox/config/okta.py' 🧬 loaded config '/etc/netbox/config/plugins.py' Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 275, in fetch_command klass = load_command_class(app_name, subcommand) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 48, in load_command_class module = import_module("%s.management.commands.%s" % (app_name, name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/opt/netbox/netbox/core/management/commands/rqworker.py", line 3, in <module> from django_rq.management.commands.rqworker import Command as _Command File "/opt/netbox/venv/lib/python3.11/site-packages/django_rq/management/commands/rqworker.py", line 5, in <module> from rq import Connection ImportError: cannot import name 'Connection' from 'rq' (/opt/netbox/venv/lib/python3.11/site-packages/rq/__init__.py) **after (django-rq 3.0.0)** /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqworker 🧬 loaded config '/etc/netbox/config/configuration.py' 🧬 loaded config '/etc/netbox/config/extra.py' 🧬 loaded config '/etc/netbox/config/logging.py' 🧬 loaded config '/etc/netbox/config/okta.py' 🧬 loaded config '/etc/netbox/config/plugins.py' No queues have been specified. This process will service the following queues by default: high, default, low 17:13:20 Worker rq:worker:ccb458300dad4624897b1e9e24fc8a4c started with PID 266, version 2.0.0 17:13:20 Subscribing to channel rq:pubsub:ccb458300dad4624897b1e9e24fc8a4c 17:13:20 *** Listening on high, default, low... 17:13:20 Cleaning registries for queue: high 17:13:20 Scheduler for high, low, default started with PID 268 17:13:20 Cleaning registries for queue: default 17:13:20 Cleaning registries for queue: low 17:26:50 Cleaning registries for queue: high 17:26:50 Cleaning registries for queue: default 17:26:50 Cleaning registries for queue: low 17:40:20 Cleaning registries for queue: high 17:40:20 Cleaning registries for queue: default 17:40:20 Cleaning registries for queue: low Hope this helps!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10424