11 Commits

Author SHA1 Message Date
GDay
7add68f770 Release v1.6.2 2024-03-05 16:46:08 +01:00
Stan Triepels
782b1de60d Allow different broker on chain (#156) 2024-03-02 22:45:40 +01:00
Josh Thomas
88430c9014 Fix formatting issues in README.rst (#159) 2024-02-20 18:04:46 +01:00
Stan Triepels
6265a54008 Update docs to add cluster option to the async_task (#157) 2024-02-18 04:00:07 +01:00
Stan Triepels
1b638e5802 Update release/test dependencies (#147)
* Update release dependencies

* Update test.yml
2023-12-14 16:06:34 +01:00
Tobias Menzel
13a382cca2 Fix for Negative Repeat Count in Scheduler (#101) (#146)
* Comment out decrement of s.repeats in scheduler to fix negative repeat count issue

* Fix repeat count handling in scheduler

- Reset `repeats` to -1 for values less than -1
- Decrement `repeats` by 1 if it's greater than 0
2023-12-14 14:44:07 +01:00
Stan Triepels
098aa66a2d Update django.po (#138) 2023-11-04 19:52:43 +01:00
Stan Triepels
b3f494571f Use importerror for b62_decode and avoid deprecation notification (#134) 2023-10-26 14:29:13 +02:00
Patrycja
503127233f Specify build system in pyproject.toml (#131)
Otherwise, trying to build the project with a tool like gpep517 or build
results in using the setuptools legacy backend instead
2023-10-19 22:05:16 +02:00
GDay
e3be22ac63 Release v1.6.1 2023-10-13 14:15:58 +02:00
Stan Triepels
0aaeb8d35d Fix strict versions for python/django - poetry install error (#130) 2023-10-13 14:13:22 +02:00
14 changed files with 67 additions and 58 deletions

View File

@@ -11,15 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
sudo apt-get update

View File

@@ -85,7 +85,7 @@ jobs:
finish:
needs: test
runs-on: ubuntu-latest
container: python:3-slim
container: python:3.11-bookworm
steps:
- name: Upload to coveralls
run: |

View File

@@ -1,5 +1,24 @@
# Changelog
## [v1.6.2](https://github.com/django-q2/django-q2/tree/v1.6.2) (2024-03-05)
**Merged pull requests:**
- Allow different broker on chain https://github.com/django-q2/django-q2/pull/156
- Fix formatting issues in README.rst https://github.com/django-q2/django-q2/pull/159
- Update docs to add cluster option to the async_task https://github.com/django-q2/django-q2/pull/157
- Update release/test dependencies https://github.com/django-q2/django-q2/pull/147
- Fix for Negative Repeat Count in Scheduler https://github.com/django-q2/django-q2/pull/146
- Update django.po https://github.com/django-q2/django-q2/pull/138
- Use importerror for b62_decode and avoid deprecation notification https://github.com/django-q2/django-q2/pull/134
- Specify build system in pyproject.toml https://github.com/django-q2/django-q2/pull/131
## [v1.6.1](https://github.com/django-q2/django-q2/tree/v1.6.1) (2023-10-13)
**Merged pull requests:**
- Fix strict versions for python/django https://github.com/django-q2/django-q2/pull/130
## [v1.6.0](https://github.com/django-q2/django-q2/tree/v1.6.0) (2023-10-12)
**Merged pull requests:**

View File

@@ -3,9 +3,7 @@ A multiprocessing distributed task queue for Django
|image0| |image1| |docs| |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
Features
~~~~~~~~
@@ -73,7 +71,6 @@ Installation
Read the full documentation at `https://django-q2.readthedocs.org <https://django-q2.readthedocs.org>`__
Configuration
~~~~~~~~~~~~~
@@ -104,10 +101,7 @@ For full configuration options, see the `configuration documentation <https://dj
Management Commands
~~~~~~~~~~~~~~~~~~~
::
For the management commands to work, you will need to install Blessed: <https://github.com/jquast/blessed>
For the management commands to work, you will need to install Blessed: <https://github.com/jquast/blessed>
Start a cluster with::
@@ -159,7 +153,6 @@ Use `async_task` from your code to quickly offload tasks:
For more info see `Tasks <https://django-q2.readthedocs.org/en/latest/tasks.html>`__
Schedule
~~~~~~~~
@@ -204,7 +197,6 @@ Admin page or directly from your code:
For more info check the `Schedules <https://django-q2.readthedocs.org/en/latest/schedules.html>`__ documentation.
Testing
~~~~~~~

View File

@@ -1,6 +1,6 @@
import django
VERSION = (1, 6, 0)
VERSION = (1, 6, 2)
if django.VERSION < (3, 2):
default_app_config = "django_q.apps.DjangoQConfig"

View File

@@ -8,11 +8,12 @@ from django.core.signing import Signer as Sgnr
from django.core.signing import TimestampSigner as TsS
from django.core.signing import b64_decode, dumps
if django.VERSION < (5, 0):
try:
from django.core.signing import b62_decode
except ImportError:
# fallback for django 3.x
from django.utils.baseconv import base62
b62_decode = base62.decode
else:
from django.core.signing import b62_decode
from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_bytes, force_str

View File

@@ -303,7 +303,7 @@ msgstr "Bimestriel"
#: models.py:194
msgid "Quarterly"
msgstr "Tous les quart-dheure"
msgstr "Trimestriel"
#: models.py:195
msgid "Yearly"

View File

@@ -82,7 +82,15 @@ def scheduler(broker: Broker = None):
break
s.next_run = next_run
s.repeats += -1
# Little Fix for already broken numbers
if s.repeats < -1:
s.repeats = -1
# Check if the value is not zero
if s.repeats > 0:
s.repeats -= 1
# send it to the cluster; any cluster name is allowed in multi-queue scenarios
# because `broker_name` is confusing, using `cluster` name is recommended and takes precedence
q_options["cluster"] = s.cluster or q_options.get(

View File

@@ -569,10 +569,10 @@ class Chain:
A sequential chain of tasks
"""
def __init__(self, chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC):
def __init__(self, chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None):
self.chain = chain or []
self.group = group or ""
self.broker = get_broker()
self.broker = broker or get_broker()
self.cached = cached
self.sync = sync
self.started = False

View File

@@ -49,8 +49,9 @@ Reference
:param str group: an optional group name.
:param bool cached: run this against the cache backend
:param bool sync: execute this inline instead of asynchronous
:param broker: an optional broker instance
.. py:class:: Chain(chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC)
.. py:class:: Chain(chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None)
A sequential chain of tasks. Acts as a convenient wrapper for :func:`async_chain`
You can pass the task chain at construction or you can append individual tasks before running them.
@@ -59,6 +60,8 @@ Reference
:param str group: an optional group name.
:param bool cached: run this against the cache backend
:param bool sync: execute this inline instead of asynchronous
:param bool sync: execute this inline instead of asynchronous
:param broker: an optional broker instance
.. py:method:: append(func, *args, **kwargs)

View File

@@ -75,7 +75,7 @@ author = "Ilan Steemers, Stan Triepels"
# The short X.Y version.
version = "1.6"
# The full version, including alpha/beta/rc tags.
release = "1.6.0"
release = "1.6.2"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@@ -75,6 +75,10 @@ broker
""""""
A broker instance, in case you want to control your own connections.
cluster
""""""
The name of the cluster. Only useful if you are using [alternative queues](https://django-q2.readthedocs.io/en/master/cluster.html#multiple-queues).
task_name
"""""""""
@@ -241,7 +245,7 @@ Reference
---------
.. py:function:: async_task(func, *args, hook=None, group=None, timeout=None,\
save=None, sync=False, cached=False, broker=None, q_options=None, **kwargs)
save=None, sync=False, cached=False, broker=None, cluster=None, q_options=None, **kwargs)
Puts a task in the cluster queue
@@ -255,6 +259,7 @@ Reference
:param bool sync: If set to True, async_task will simulate a task execution
:param cached: Output the result to the cache backend. Bool or timeout in seconds
:param broker: Optional broker connection from :func:`brokers.get_broker`
:param cluster: Optional cluster name if using alternative queues
:param dict q_options: Options dict, overrides option keywords
:param dict kwargs: Keyword arguments for the task function
:returns: The uuid of the task

35
poetry.lock generated
View File

@@ -98,14 +98,14 @@ wcwidth = ">=0.1.4"
[[package]]
name = "boto3"
version = "1.28.62"
version = "1.28.63"
description = "The AWS SDK for Python"
category = "main"
optional = true
python-versions = ">= 3.7"
[package.dependencies]
botocore = ">=1.31.62,<1.32.0"
botocore = ">=1.31.63,<1.32.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.7.0,<0.8.0"
@@ -114,7 +114,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
version = "1.31.62"
version = "1.31.63"
description = "Low-level, data-driven core of boto 3."
category = "main"
optional = true
@@ -210,23 +210,6 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""}
argon2 = ["argon2-cffi (>=19.1.0)"]
bcrypt = ["bcrypt"]
[[package]]
name = "django"
version = "5.0a1"
description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."
category = "main"
optional = false
python-versions = ">=3.10"
[package.dependencies]
asgiref = ">=3.7.0"
sqlparse = ">=0.3.1"
tzdata = {version = "*", markers = "sys_platform == \"win32\""}
[package.extras]
argon2 = ["argon2-cffi (>=19.1.0)"]
bcrypt = ["bcrypt"]
[[package]]
name = "django-picklefield"
version = "3.1"
@@ -975,7 +958,7 @@ testing = ["django-redis", "croniter", "hiredis", "psutil", "iron-mq", "boto3",
[metadata]
lock-version = "1.1"
python-versions = ">=3.8,<4"
content-hash = "cb8c0092f0c96abed136b848bc7fda4edbdefccec88de0d67b759943695e3644"
content-hash = "caca1dae949cf7c34953b539d34d45cf66a2ca55eb5766942e5755ae9b31299e"
[metadata.files]
alabaster = [
@@ -1035,12 +1018,12 @@ blessed = [
{file = "blessed-1.20.0.tar.gz", hash = "sha256:2cdd67f8746e048f00df47a2880f4d6acbcdb399031b604e34ba8f71d5787680"},
]
boto3 = [
{file = "boto3-1.28.62-py3-none-any.whl", hash = "sha256:0dfa2fc96ccafce4feb23044d6cba8b25075ad428a0c450d369d099c6a1059d2"},
{file = "boto3-1.28.62.tar.gz", hash = "sha256:148eeba0f1867b3db5b3e5ae2997d75a94d03fad46171374a0819168c36f7ed0"},
{file = "boto3-1.28.63-py3-none-any.whl", hash = "sha256:65d052ec13197460586ee385aa2d6bba0e7378d2d2c7f3e93c044c43ae1ca782"},
{file = "boto3-1.28.63.tar.gz", hash = "sha256:94218aba2feb5b404b665b8d76c172dc654f79b4c5fa0e9e92459c098da87bf4"},
]
botocore = [
{file = "botocore-1.31.62-py3-none-any.whl", hash = "sha256:be792d806afc064694a2d0b9b25779f3ca0c1584b29a35ac32e67f0064ddb8b7"},
{file = "botocore-1.31.62.tar.gz", hash = "sha256:272b78ac65256b6294cb9cdb0ac484d447ad3a85642e33cb6a3b1b8afee15a4c"},
{file = "botocore-1.31.63-py3-none-any.whl", hash = "sha256:cb9db5db5af865b1fc2e1405b967db5d78dd0f4d84e5dc1974e082733c1034b7"},
{file = "botocore-1.31.63.tar.gz", hash = "sha256:6e582c811ea74f25bdb490ac372b2645de4a60286b42ddd8c69f3b6df82b6b12"},
]
certifi = [
{file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"},
@@ -1207,8 +1190,6 @@ croniter = [
django = [
{file = "Django-4.2.6-py3-none-any.whl", hash = "sha256:a64d2487cdb00ad7461434320ccc38e60af9c404773a2f95ab0093b4453a3215"},
{file = "Django-4.2.6.tar.gz", hash = "sha256:08f41f468b63335aea0d904c5729e0250300f6a1907bf293a65499496cdbc68f"},
{file = "Django-5.0a1-py3-none-any.whl", hash = "sha256:4b7ee536e8b2bf1e68f6c9bda192300ec94844e32e730076c2e520bc63dac64e"},
{file = "Django-5.0a1.tar.gz", hash = "sha256:3a52052fbc5e01f2202c020a8241aa40dc030b16c8fb49dc480cc46ab8735158"},
]
django-picklefield = [
{file = "django-picklefield-3.1.tar.gz", hash = "sha256:c786cbeda78d6def2b43bff4840d19787809c8909f7ad683961703060398d356"},

View File

@@ -1,6 +1,10 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "django-q2"
version = "1.6.0"
version = "1.6.2"
packages = [
{ include = "django_q" },
]
@@ -46,10 +50,7 @@ include = ['CHANGELOG.md']
[tool.poetry.dependencies]
python = ">=3.8,<4"
django = [
{ version = ">=3.2, <5", python = ">= 3.8" },
{ version = "^5.0a1", python = ">= 3.10", allow-prereleases = true }
]
django = { version = ">=3.2, <6", allow-prereleases = true}
django-picklefield = "^3.1"
blessed = { version = "^1.19.1", optional = true }