Compare commits

...
5 Commits
Author SHA1 Message Date
Stan 144536cbe4 Release v1.7.6 2025-01-12 02:25:29 +01:00
Stan Triepels 7e72b68c7f Make poetry version fixed in CI (#260) 2025-01-12 02:22:14 +01:00
Stan 404932117e Release v1.7.5 2025-01-12 01:57:13 +01:00
Anthony Hivert ddc1aa2de1 perf: avoid checking success tasks when save limit is disabled (#255)
- avoid extra queries when checking the count of success in db
2025-01-04 02:31:30 +01:00
mhaehnel 351bf66d71 Fix install path for CHANGELOG.md (#258)
The file should not be installed directly in site-packages. Use the
correct include syntax to include them into the source distribution
package only.
2025-01-02 01:52:07 +01:00
8 changed files with 34 additions and 18 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ jobs:
- name: Install dependencies with Django ${{ matrix.django }} - name: Install dependencies with Django ${{ matrix.django }}
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install poetry pip install poetry==1.8.5
poetry add "django==${{ matrix.django }}" --python=${{ matrix.python-version }} poetry add "django==${{ matrix.django }}" --python=${{ matrix.python-version }}
poetry install -E testing poetry install -E testing
- name: Run Tests - name: Run Tests
+9
View File
@@ -1,5 +1,14 @@
# Changelog # Changelog
## [v1.7.6](https://github.com/django-q2/django-q2/tree/v1.7.6) (2025-01-12)
- Make poetry version fixed in CI https://github.com/django-q2/django-q2/pull/260
## [v1.7.5](https://github.com/django-q2/django-q2/tree/v1.7.5) (2025-01-12)
- perf: avoid checking success tasks when save limit is disabled https://github.com/django-q2/django-q2/pull/255
- Fix install path for CHANGELOG.md https://github.com/django-q2/django-q2/pull/258
## [v1.7.4](https://github.com/django-q2/django-q2/tree/v1.7.4) (2024-11-03) ## [v1.7.4](https://github.com/django-q2/django-q2/tree/v1.7.4) (2024-11-03)
- Decrease the MAX_RSS set in test_cluster::test_max_rss https://github.com/django-q2/django-q2/pull/240 - Decrease the MAX_RSS set in test_cluster::test_max_rss https://github.com/django-q2/django-q2/pull/240
+4 -4
View File
@@ -2,16 +2,16 @@ dev:
docker compose -f web-docker-compose.yaml up docker compose -f web-docker-compose.yaml up
test: test:
docker-compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run pytest docker compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run pytest
shell: shell:
docker-compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py shell docker compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py shell
makemigrations: makemigrations:
docker-compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py makemigrations docker compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py makemigrations
migrate: migrate:
docker-compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py migrate docker compose -f test-services-docker-compose.yaml run --rm django-q2 poetry run python manage.py migrate
createsuperuser: createsuperuser:
docker compose -f web-docker-compose.yaml run --rm web python manage.py createsuperuser docker compose -f web-docker-compose.yaml run --rm web python manage.py createsuperuser
+1 -1
View File
@@ -1,6 +1,6 @@
import django import django
VERSION = (1, 7, 4) VERSION = (1, 7, 6)
if django.VERSION < (3, 2): if django.VERSION < (3, 2):
default_app_config = "django_q.apps.DjangoQConfig" default_app_config = "django_q.apps.DjangoQConfig"
+10 -7
View File
@@ -107,13 +107,16 @@ def save_task(task, broker: Broker):
value = get_func_repr(value) value = get_func_repr(value)
filters[Conf.SAVE_LIMIT_PER] = value filters[Conf.SAVE_LIMIT_PER] = value
with db.transaction.atomic(using=db.router.db_for_write(Success)): # check if we should clean the success tasks
list(Success.objects.filter(**filters).select_for_update()) if Conf.SAVE_LIMIT > 0:
if ( with db.transaction.atomic(using=db.router.db_for_write(Success)):
task["success"] success_tasks_qs = Success.objects.filter(**filters)
and 0 < Conf.SAVE_LIMIT <= Success.objects.filter(**filters).count() success_tasks_pks = [
): success_task.pk
Success.objects.filter(**filters).last().delete() for success_task in success_tasks_qs.select_for_update()
]
if task["success"] and len(success_tasks_pks) >= Conf.SAVE_LIMIT:
success_tasks_qs.last().delete()
# check if this task has previous results # check if this task has previous results
try: try:
+3 -2
View File
@@ -399,7 +399,7 @@ def test_timeout_task_finishes(broker, cluster_config_timeout, async_task_kwargs
@pytest.mark.django_db @pytest.mark.django_db
def test_recycle(broker, monkeypatch): def test_recycle(broker, monkeypatch, django_assert_num_queries):
# set up the Sentinel # set up the Sentinel
broker.list_key = "test_recycle_test:q" broker.list_key = "test_recycle_test:q"
async_task("django_q.tests.tasks.multiply", 2, 2, broker=broker) async_task("django_q.tests.tasks.multiply", 2, 2, broker=broker)
@@ -432,7 +432,8 @@ def test_recycle(broker, monkeypatch):
monkeypatch.setattr(Conf, "SAVE_LIMIT", 1) monkeypatch.setattr(Conf, "SAVE_LIMIT", 1)
result_queue.put("STOP") result_queue.put("STOP")
# run monitor # run monitor
monitor(result_queue) with django_assert_num_queries(12):
monitor(result_queue)
assert Success.objects.count() == Conf.SAVE_LIMIT assert Success.objects.count() == Conf.SAVE_LIMIT
broker.delete_queue() broker.delete_queue()
+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.4" release = "1.7.6"
# 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.
+5 -2
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.4" version = "1.7.6"
packages = [ packages = [
{ include = "django_q" }, { include = "django_q" },
] ]
@@ -39,7 +39,10 @@ classifiers = [
'Topic :: System :: Distributed Computing', 'Topic :: System :: Distributed Computing',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Libraries :: Python Modules',
] ]
include = ['CHANGELOG.md']
include = [
{ path = "CHANGELOG.md", format = "sdist" },
]
[tool.poetry.plugins] # Optional super table [tool.poetry.plugins] # Optional super table