Skip to content

Update django-q with django-q2 - #739

Closed
GDay wants to merge 164 commits into
Koed00:masterfrom
django-q2:master
Closed

GDay wants to merge 164 commits into
Koed00:masterfrom
django-q2:master

Conversation

@GDay

@GDay GDay commented Mar 5, 2024

Copy link
Copy Markdown
Collaborator

Still a work in progress. What needs to be done:

  • Update docs to use django-q (instead of django-q2) everywhere. PR: Docs updates django-q2/django-q2#163
  • Update workflow on django-q2 to push both packages to PyPI. (disable push when on the django-q repo)

After merge:

  • Go through all issues and PRs and close the ones that are not relevant anymore (have already been fixed)

truenorth-lj and others added 30 commits September 1, 2022 12:08
* refactor: show function name as it runs

* feat: log func name when processed

Co-authored-by: Noortheen Raja <jnoortheen@gmail.com>
Migrate codecov to coveralls
* Fix readthedocs file

* remove trigger from test workflow
* Update django docs links to 4.0
* Update Django Q to Django Q2
* Use different theme to make difference more clear between the original and this forked one
* Added info notice about this fork
* Some small layout/typo fixes
Co-authored-by: ethemguner
Co-authored-by: Marc Sabatier <marc@sabatier.online>
Co-authored-by: Marc Sabatier <marc@sabatier.online>
* Add the group column to OrmQ admin page

* Add group field to tasks list and search_field

* Add search by name to Schedule admin page

* Limit succesful task history per schedule with SAVE_LIMIT_GROUP config

* Improve ScheduleAdmin list view performance

Co-authored-by: Marc Sabatier <marc@sabatier.online>
* feat: option to save tasks per group/func/name

* test: update tests for save limit

* fix: convert func when save-limit checking

when passed as function it needs to be converted to work

* Add warning if option is not valid

Co-authored-by: Noortheen Raja <jnoortheen@gmail.com>
Instead of checking if the django-q logger has any handlers directly,
use the hasHandlers [1] method, which will check if any parent loggers
have handlers as well.

This fixes a bug where django-q configures it's own logging even though
the root logger has a handler set

 1. https://docs.python.org/3/library/logging.html#logging.Logger.hasHandlers

Co-authored-by: Wesley Ellis <wellis@benchsci.com>
Co-authored-by: Rajeev KL <rajeev@labmoneta.io>
* fix django q2 install command and remove space

* remove warnings for very old versions
having build-system config helps installing  this without setup.py built
adamchainz and others added 16 commits March 12, 2025 23:28
…t. Drop python 3.8 support (#271)

* Update tested versions

* Remove f string

* Fix second `format_html`

---------

Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
…ization (#274)

* move timeout function to class to allow customization

* format

* fix format
* Remove upper bound on Django version.

This allows it to be installed alongside Django 6 and later.

See https://iscinumpy.dev/post/bound-version-constraints/

* Run tests on Django 6.0 / Python 3.12
* fix: Fix incorrect signal import

* lint

---------

Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
* async_iter: fix BadSignature after the default Django cache expires

* lint
Prune stale entries from the master list on new cluster registration
and only write the list when membership changes (with timeout=None).

Before this fix, set_stat was append-only — dead cluster keys accumulated
forever because the only cleanup path (get_stats) runs only from the
monitor UIs. On DatabaseCache backends this rewrote the growing pickled
list to Postgres on every heartbeat, producing measurable egress.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coveralls

coveralls commented Apr 13, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 92.378% — django-q2:master into Koed00:master. No base build found for Koed00:master.

7576457 and others added 12 commits April 18, 2026 16:48
* Add ru locale

* fix

* fix: remove duplicate

* Add field labels and continue ru locale

* fix: Add ru gettext for queue columns, short result column, and OrmQ field labels

* fix: locale paths in translation files

* chore: format code with ruff

* chore: format code with ruff

* fix: correct time_taken usage in admin

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update django_q/locale/de/LC_MESSAGES/django.po

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update django_q/locale/tr/LC_MESSAGES/django.po

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: clear fuzzy markers

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
#305)

* AttributeError when start_event is None, and guard process faster stop

This commit has two related fixes that come into play when frequently
shutting down and restarting the cluster.

If a SIGINT or SIGTERM signal is received while the main process is
waiting for the sentinel process to set start_event, the signal
handler sets start_event to None, and the loop that polls start_event
will raise an unhandled AttributeError attempting to check
start_event.is_set().

The second issue is that the guard process sleeps for the guard cycle
interval in each iteration before checking the stop event, preventing
the guard cycle from terminating until the sleep completes. The
cluster can be made more responsive to a shutdown request by using
the event's wait(cycle) method rather than time.sleep(cycle) so the
process wakes immediately when the event is set.

The commit also fixes the case where the guard process sleeps for an
extra cycle when the cycle counter happens to have been reset to zero
on the loop iterations when the scheduler is called.

This fix helps in our environment where we are frequently stopping
and starting the cluster and where we have increased the guard
cycle setting to several seconds.

* Add sentinel premature death check while waiting for sentinel to start.

Suggested by github copilot [here](https://github.com/django-q2/django-q2/pull/305/changes#r3143964420)

* Add test case test_cluster_early_stop

Add a test case to validate stopping the cluster before the
sentinel has set the cluster's start_event.

The test deterministically triggers the AttributeError when
start_event is None (without the PR's fix in cluster.py).

As requested by copilot: #305 (comment)

* Add test test_cluster_stop_responsive

Ensure that stopping the cluster is responsive and does not wait for a full
GUARD_CYCLE to stop the cluster.

As requested by copilot: https://github.com/django-q2/django-q2/pull/305/changes#r3143964414

* Address copilot review comments.

1. Do not raise RuntimeError if sentinel early exit was caused by
   SIGINT/SIGTERM stopping the cluster while waiting for the
   sentinel to start.
   Addresses #305 (comment)

2. Ensure that the monkeypatched broker instance remains pickleable
   so the test_cluster_early_stop test will also work on platforms
   that use the spawn Process start method.
   Addresses #305 (comment)

3. Do not allow the test_cluster_early_stop test to hang if the
   sentinel process or main test process terminates unexpectedly
   without setting the sentinel_event or test_event.
   Addresses #305 (comment)
Allows django-q2[croniter] to be specified in a dependant's pyproject.toml.
Required because dependant may not explicitly use croniter in code
and so it can be flagged as unused.
* update matrix

* add support for 3.14
* Suppress ImproperlyConfigured within Conf, allowing the exception to be raised specifically during the 'qcluster' command instead.

This ensures build scripts and workflows can freely execute other Django commands (e.g., 'python manage.py collectstatic') without failing due to a missing/empty secret key.

* Closes #279

Co-authored-by: Tug of Peas <19413623+tugofpeas@users.noreply.github.com>
@GDay GDay closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.