diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c5b77e3..68ae902e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +### Version 2.10.1 (2023-12-18) +* Fixed packaging issues with 2.10.0. + +### Version 2.10.0 (2023-12-18) +* Added `rqworker-pool` management command. Thanks @chromium7! +* Compatibility with Django 5.0. Thanks @perry! +* The scheduler now defaults to db 0. Thanks @bennylope! + ### Version 2.9.0 (2023-11-26) * Added an option to delete all failed jobs. Thanks @chromium7! * You can now specify `SERIALIZER` option while declaring queues in `settings.py` Thanks @sophcass! diff --git a/README.rst b/README.rst index 7c33f61a..8bbed258 100644 --- a/README.rst +++ b/README.rst @@ -229,7 +229,11 @@ with the path to your queue class:: To use a custom job class, provide ``--job-class`` flag. -Support for scheduled jobs +Starting from version 2.10, running RQ's worker-pool is also supported:: + + python manage.py rqworker-pool default low medium --num-workers 4 + +Support for Scheduled Jobs -------------------------- With RQ 1.2.0. you can use `built-in scheduler `__ @@ -338,7 +342,7 @@ Additionally, these statistics are also accessible from the command line. Configuring Sentry ------------------- -Django-RQ >= 2.0 uses ``sentry-sdk`` instead of the deprecated ``raven`` library. Sentry +Sentry should be configured within the Django ``settings.py`` as described in the `Sentry docs `__. You can override the default Django Sentry configuration when running the ``rqworker`` command @@ -382,11 +386,6 @@ RQ uses Python's ``logging``, this means you can easily configure ``rqworker``'s "formatter": "rq_console", "exclude": ["%(asctime)s"], }, - # If you use sentry for logging - 'sentry': { - 'level': 'ERROR', - 'class': 'raven.contrib.django.handlers.SentryHandler', - }, }, 'loggers': { "rq.worker": { @@ -396,17 +395,6 @@ RQ uses Python's ``logging``, this means you can easily configure ``rqworker``'s } } -Note: error logging to Sentry is known to be unreliable with RQ when using async -transports (the default transport). Please configure ``Raven`` to use -``sync+https://`` or ``requests+https://`` transport in ``settings.py``: - -.. code-block:: python - - RAVEN_CONFIG = { - 'dsn': 'sync+https://public:secret@example.com/1', - } - -For more info, refer to `Raven's documentation `__. Custom Queue Classes -------------------- diff --git a/django_rq/__init__.py b/django_rq/__init__.py index 38caf13d..f6bcf1bf 100644 --- a/django_rq/__init__.py +++ b/django_rq/__init__.py @@ -1,4 +1,4 @@ -VERSION = (2, 9, 0) +VERSION = (2, 10, 1) from .decorators import job from .queues import enqueue, get_connection, get_queue, get_scheduler diff --git a/django_rq/templates/django_rq/job_detail.html b/django_rq/templates/django_rq/job_detail.html index 21b9cb6a..e10a2ec3 100644 --- a/django_rq/templates/django_rq/job_detail.html +++ b/django_rq/templates/django_rq/job_detail.html @@ -223,7 +223,7 @@

Result {{ result.id }}

- +
{{ result.created_at|to_localtime|date:"Y-m-d, H:i:s" }}
diff --git a/django_rq/tests/test_views.py b/django_rq/tests/test_views.py index e5cf017b..96986380 100644 --- a/django_rq/tests/test_views.py +++ b/django_rq/tests/test_views.py @@ -58,6 +58,18 @@ def test_job_details(self): response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertIn('DeserializationError', response.content.decode()) + + def test_job_details_with_results(self): + """Job with results is displayed properly""" + queue = get_queue('default') + job = queue.enqueue(access_self) + queue_index = get_queue_index('default') + worker = get_worker('default') + worker.work(burst=True) + result = job.results()[0] + url = reverse('rq_job_detail', args=[queue_index, job.id]) + response = self.client.get(url) + self.assertContains(response, result.id) def test_job_details_on_deleted_dependency(self): """Page doesn't crash even if job.dependency has been deleted""" diff --git a/django_rq/tests/utils.py b/django_rq/tests/utils.py index 72d93dae..afe4df2a 100644 --- a/django_rq/tests/utils.py +++ b/django_rq/tests/utils.py @@ -9,7 +9,10 @@ def get_queue_index(name='default'): connection = get_connection(name) connection_kwargs = connection.connection_pool.connection_kwargs for i in range(0, 100): - q = get_queue_by_index(i) + try: + q = get_queue_by_index(i) + except AttributeError: + continue if q.name == name and q.connection.connection_pool.connection_kwargs == connection_kwargs: queue_index = i break diff --git a/setup.py b/setup.py index 6eccefd0..333aa9e6 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='django-rq', - version='2.9.0', + version='2.10.1', author='Selwin Ong', author_email='selwin.ong@gmail.com', packages=['django_rq'],