Compare commits

...
8 Commits
Author SHA1 Message Date
Stan 505eb8d537 Release v1.7.3 2024-10-15 04:17:28 +02:00
blockisecandStan Triepels dcfe5b6650 Fix missing ack_id when finishing task (#224)
* Update monitor.py

* format

---------

Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
2024-10-11 15:03:18 +02:00
Paulo CoutinhoandStan Triepels c3b49cca25 Only trigger prometheus if configured (#231)
* fix prometheus integration

* fix prometheus integration

* Add also lowercase option

As they seem to support that too: https://github.com/prometheus/client_python/blob/d7c9cd88c7f50097cd86869974301df7615bc9c0/prometheus_client/multiprocess.py#L166-L167

* format

---------

Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com>
2024-10-11 04:09:17 +02:00
Knuth c1e00b09cb Fix type check for args in scheduler.py E721 (#233) 2024-10-10 16:10:43 +02:00
Knuth 8e403d0136 Refactor timeout handling to handle AttributeError and ValueError for Windows users (#234) 2024-10-10 16:09:57 +02:00
Stan Triepels 337a5782d9 Catch missing SEGALRM with AttributeError instead of ValueError (#223) 2024-09-22 04:12:38 +02:00
Stan 2c456cd0aa Release v1.7.2 2024-09-10 00:16:18 +02:00
Stan Triepels 8f54e5d5ae Add twine check and fix readme (#216)
* Add twine check

* add poetry to install

* move up remove black/flake formatting

* fix path

* fix?

* fix rst?

* add rstcheck

* test all files?

* all

* remove complaining image

* only check readme

* remove not needed dependencies
2024-09-10 00:10:14 +02:00
10 changed files with 47 additions and 21 deletions
+7 -5
View File
@@ -15,6 +15,12 @@ jobs:
run: | run: |
pipx install ruff==0.4.10 pipx install ruff==0.4.10
ruff format . --check && ruff check . ruff format . --check && ruff check .
- name: Check twine
run: |
python -m pip install twine poetry rstcheck
poetry build
rstcheck README.rst
twine check dist/*
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -93,11 +99,7 @@ jobs:
- name: Upload to coveralls - name: Upload to coveralls
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install coveralls flake8 black python -m pip install coveralls
coveralls --service=github --finish coveralls --service=github --finish
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check flake8/black
run: |
flake8 .
black --check .
+13
View File
@@ -1,5 +1,18 @@
# Changelog # Changelog
## [v1.7.3](https://github.com/django-q2/django-q2/tree/v1.7.3) (2024-10-15)
- Catch missing SEGALRM with AttributeError instead of ValueError https://github.com/django-q2/django-q2/pull/223
- Refactor timeout handling to handle AttributeError and ValueError for Windows users https://github.com/django-q2/django-q2/pull/234
- Fix type check for args in scheduler.py E721 https://github.com/django-q2/django-q2/pull/233
- Only trigger prometheus if configured https://github.com/django-q2/django-q2/pull/231
- Fix missing ack_id when finishing task https://github.com/django-q2/django-q2/pull/224
## [v1.7.2](https://github.com/django-q2/django-q2/tree/v1.7.2) (2024-09-09)
- Fix twine check
## [v1.7.1](https://github.com/django-q2/django-q2/tree/v1.7.1) (2024-09-08) ## [v1.7.1](https://github.com/django-q2/django-q2/tree/v1.7.1) (2024-09-08)
- Fixed date of v1.7.0 - Fixed date of v1.7.0
+1 -6
View File
@@ -1,7 +1,7 @@
A multiprocessing distributed task queue for Django A multiprocessing distributed task queue for Django
--------------------------------------------------- ---------------------------------------------------
|image0| |image1| |docs| |downloads| |image0| |image1| |downloads|
Django Q2 is a fork of Django Q. Big thanks to Ilan Steemers for starting this project. Unfortunately, development has stalled since June 2021. Django Q2 is the new updated version of Django Q, with dependencies updates, docs updates and several bug fixes. Original repository: https://github.com/Koed00/django-q Django Q2 is a fork of Django Q. Big thanks to Ilan Steemers for starting this project. Unfortunately, development has stalled since June 2021. Django Q2 is the new updated version of Django Q, with dependencies updates, docs updates and several bug fixes. Original repository: https://github.com/Koed00/django-q
@@ -214,7 +214,6 @@ Create a superuser with:
make createsuperuser make createsuperuser
Testing Testing
~~~~~~~ ~~~~~~~
@@ -246,9 +245,5 @@ Acknowledgements
:target: https://github.com/GDay/django-q2/actions?query=workflow%3Atests :target: https://github.com/GDay/django-q2/actions?query=workflow%3Atests
.. |image1| image:: https://coveralls.io/repos/github/GDay/django-q2/badge.svg?branch=master .. |image1| image:: https://coveralls.io/repos/github/GDay/django-q2/badge.svg?branch=master
:target: https://coveralls.io/github/GDay/django-q2?branch=master :target: https://coveralls.io/github/GDay/django-q2?branch=master
.. |docs| image:: https://readthedocs.org/projects/docs/badge/?version=latest
:alt: Documentation Status
:scale: 100
:target: https://django-q2.readthedocs.org/
.. |downloads| image:: https://img.shields.io/pypi/dm/django-q2 .. |downloads| image:: https://img.shields.io/pypi/dm/django-q2
:target: https://img.shields.io/pypi/dm/django-q2 :target: https://img.shields.io/pypi/dm/django-q2
+1 -1
View File
@@ -1,6 +1,6 @@
import django import django
VERSION = (1, 7, 1) VERSION = (1, 7, 3)
if django.VERSION < (3, 2): if django.VERSION < (3, 2):
default_app_config = "django_q.apps.DjangoQConfig" default_app_config = "django_q.apps.DjangoQConfig"
+8 -1
View File
@@ -1,4 +1,5 @@
# Standard # Standard
import os
import signal import signal
import socket import socket
import uuid import uuid
@@ -230,8 +231,14 @@ class Sentinel:
% {"name": process.name} % {"name": process.name}
) )
else: else:
if prometheus_multiprocess: # check if prometheus is proper configurated
prometheus_path = os.getenv(
"PROMETHEUS_MULTIPROC_DIR", os.getenv("prometheus_multiproc_dir")
)
if prometheus_multiprocess and prometheus_path:
prometheus_multiprocess.mark_process_dead(process.pid) prometheus_multiprocess.mark_process_dead(process.pid)
self.pool.remove(process) self.pool.remove(process)
self.spawn_worker() self.spawn_worker()
if process.timer.value == 0: if process.timer.value == 0:
+5 -1
View File
@@ -145,7 +145,11 @@ def save_task(task, broker: Broker):
attempt_count=1, attempt_count=1,
) )
if Conf.MAX_ATTEMPTS > 0 and task_obj.attempt_count >= Conf.MAX_ATTEMPTS: if (
Conf.MAX_ATTEMPTS > 0
and task_obj.attempt_count >= Conf.MAX_ATTEMPTS
and task.get("ack_id")
):
broker.acknowledge(task["ack_id"]) broker.acknowledge(task["ack_id"])
except Exception: except Exception:
+1 -1
View File
@@ -65,7 +65,7 @@ def scheduler(broker: Broker = None):
if s.args: if s.args:
args = ast.literal_eval(s.args) args = ast.literal_eval(s.args)
# single value won't eval to tuple, so: # single value won't eval to tuple, so:
if type(args) != tuple: if type(args) is not tuple:
args = (args,) args = (args,)
q_options = kwargs.get("q_options", {}) q_options = kwargs.get("q_options", {})
if s.intended_date_kwarg: if s.intended_date_kwarg:
+9 -4
View File
@@ -22,11 +22,13 @@ class TimeoutHandler:
return return
try: try:
signal.signal(signal.SIGALRM, self.raise_timeout_exception) signal.signal(signal.SIGALRM, self.raise_timeout_exception)
except ValueError: # ValueError is raised for Windows users signal.alarm(self._timeout)
except (
ValueError,
AttributeError,
): # AttributeError or ValueError might be raised for Windows users
logger.debug(_("SIGALARM is not available on your platform")) logger.debug(_("SIGALARM is not available on your platform"))
signal.alarm(self._timeout)
def __exit__(self, exc_type, exc_value, traceback): def __exit__(self, exc_type, exc_value, traceback):
if self._timeout == -1: if self._timeout == -1:
return return
@@ -34,5 +36,8 @@ class TimeoutHandler:
try: try:
signal.alarm(0) signal.alarm(0)
signal.signal(signal.SIGALRM, signal.SIG_DFL) signal.signal(signal.SIGALRM, signal.SIG_DFL)
except ValueError: # ValueError is raised for Windows users except (
ValueError,
AttributeError,
): # AttributeError or ValueError might be raised for Windows users
logger.debug(_("SIGALARM is not available on your platform")) logger.debug(_("SIGALARM is not available on your platform"))
+1 -1
View File
@@ -75,7 +75,7 @@ author = "Ilan Steemers, Stan Triepels"
# The short X.Y version. # The short X.Y version.
version = "1.7" version = "1.7"
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = "1.7.1" release = "1.7.3"
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "django-q2" name = "django-q2"
version = "1.7.1" version = "1.7.3"
packages = [ packages = [
{ include = "django_q" }, { include = "django_q" },
] ]