Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/issue-305/a…
Browse files Browse the repository at this point in the history
…bstract_models
  • Loading branch information
diegocastrum committed Aug 26, 2023
2 parents 350d27b + 4325e45 commit a0ff0ea
Show file tree
Hide file tree
Showing 45 changed files with 279 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.4.0
current_version = 2.5.1
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<releaselevel>[a-z]+)?
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# http://editorconfig.org
# https://editorconfig.org/

root = true

Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@ name: Test

on:
pull_request:
branches: [ "master" ]
branches: [ "main" ]

push:
branches: ["master"]
branches: [ "main" ]

jobs:
matrix:
name: Unittest Matrix
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8, 3.9, "3.10" ]
django: [ 32, 40 ]
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "pypy3.9" ]
django: [ 32, 40, 41, 42]
exclude:
- python-version: 3.7
django: 40
- python-version: 3.7
django: 41
- python-version: "3.11"
django: 32
- python-version: "3.11"
django: 40
- python-version: 3.7
django: 42

services:
postgres:
Expand All @@ -33,8 +44,8 @@ jobs:
POSTGRES_PASSWORD: "postgres"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2.2.2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox
Expand Down Expand Up @@ -62,10 +73,10 @@ jobs:
POSTGRES_PASSWORD: "postgres"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2.2.2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- run: pip install tox
- run: tox -v -- -v
env:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/tidelift.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*$py.class
*~
.*.sw[pon]
*.mo
dist/
*.egg-info
*.egg
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
rev: v3.9.0
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.5.0
hooks:
- id: yesqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: mixed-line-ending

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Andrew Watts <andrewwatts@gmail.com>
Andrii Kostenko <andrey@kostenko.name>
Anton Novosyolov <anton.novosyolov@gmail.com>
Ask Solem <ask@celeryproject.org>
Asif Saif Uddin <auvipy@gmail.com>
Augusto Becciu <augusto@becciu.org>
Ben Firshman <ben@firshman.co.uk>
Brad Jasper <bjasper@gmail.com>
Expand Down
23 changes: 23 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
Change history
================

.. _version-2.5.1:

2.5.1
=====
:release-date: 2023-05-08 8:15 P.M. UTC+6:00
:release-by: Asif Saif Uddin

- Revert "feat: raw delete expired instead of Queryset.delete (#235)" partially.


.. _version-2.5.0:

2.5.0
=====
:release-date: 2023-03-13 5:45 P.M. UTC+6:00
:release-by: Asif Saif Uddin

- try possible fix to avoid a oracle regression (#325).
- Added periodic_task_name to admin fieldset for parity with list view.
- Only update the ChordCounter.count field when saving.
- Meta injection (#366).


.. _version-2.4.0:

2.4.0
Expand Down
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Copyright (c) 2017-2032 Asif Saif Uddin. All Rights Reserved.
Copyright (c) 2015-2016 Ask Solem. All Rights Reserved.
Copyright (c) 2012-2014 GoPivotal, Inc. All Rights Reserved.
Copyright (c) 2009-2012 Ask Solem. All Rights Reserved.
Expand All @@ -7,7 +8,7 @@ the new BSD license). The license is an OSI approved Open Source
license and is GPL-compatible(1).

The license text can also be found here:
http://www.opensource.org/licenses/BSD-3-Clause
https://opensource.org/license/bsd-3-clause/

License
=======
Expand Down Expand Up @@ -42,7 +43,7 @@ The documentation portion of django-celery-results (the rendered contents of the
"docs" directory of a software distribution or checkout) is supplied
under the "Creative Commons Attribution-ShareAlike 4.0
International" (CC BY-SA 4.0) License as described by
http://creativecommons.org/licenses/by-sa/4.0/
https://creativecommons.org/licenses/by-sa/4.0/

Footnotes
=========
Expand Down
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

|build-status| |coverage| |license| |wheel| |pyversion| |pyimp|

:Version: 2.4.0
:Web: http://django-celery-results.readthedocs.io/
:Download: http://pypi.python.org/pypi/django-celery-results
:Source: http://github.com/celery/django-celery-results
:Version: 2.5.1
:Web: https://django-celery-results.readthedocs.io/
:Download: https://pypi.python.org/pypi/django-celery-results
:Source: https://github.com/celery/django-celery-results
:Keywords: django, celery, database, results

About
Expand All @@ -26,7 +26,7 @@ The installation instructions for this extension is available
from the `Celery documentation`_

.. _`Celery documentation`:
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#django-celery-results-using-the-django-orm-cache-as-a-result-backend
https://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#django-celery-results-using-the-django-orm-cache-as-a-result-backend

.. _installation:

Expand All @@ -46,7 +46,7 @@ Downloading and installing from source
--------------------------------------

Download the latest version of django-celery-results from
http://pypi.python.org/pypi/django-celery-results
https://pypi.python.org/pypi/django-celery-results

You can install it by doing the following,::

Expand Down Expand Up @@ -103,16 +103,16 @@ max_length of **191** seems to work for MySQL.

.. |wheel| image:: https://img.shields.io/pypi/wheel/django-celery-results.svg
:alt: django-celery-results can be installed via wheel
:target: http://pypi.python.org/pypi/django-celery-results/
:target: https://pypi.python.org/pypi/django-celery-results/

.. |pyversion| image:: https://img.shields.io/pypi/pyversions/django-celery-results.svg
:alt: Supported Python versions.
:target: http://pypi.python.org/pypi/django-celery-results/
:target: https://pypi.python.org/pypi/django-celery-results/

.. |pyimp| image:: https://img.shields.io/pypi/implementation/django-celery-results.svg
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/django-celery-results/
:target: https://pypi.python.org/pypi/django-celery-results/

django-celery-results for enterprise
------------------------------------

Expand Down
9 changes: 5 additions & 4 deletions django_celery_results/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Celery result backends for Django."""
# :copyright: (c) 2016, Ask Solem.
# :copyright: (c) 2017-2033, Asif Saif Uddin.
# All rights reserved.
# :license: BSD (3 Clause), see LICENSE for more details.

Expand All @@ -8,9 +9,9 @@

import django

__version__ = '2.4.0'
__version__ = '2.5.1'
__author__ = 'Asif Saif Uddin, Ask Solem'
__contact__ = 'auvipy@gmai.com, ask@celeryproject.org'
__contact__ = 'auvipy@gmail.com'
__homepage__ = 'https://github.com/celery/django-celery-results'
__docformat__ = 'restructuredtext'

Expand All @@ -26,8 +27,8 @@
r'(\d+)\.(\d+).(\d+)(.+)?', __version__).groups()
VERSION = version_info = version_info_t(
int(_temp[0]), int(_temp[1]), int(_temp[2]), _temp[3] or '', '')
del (_temp)
del (re)
del _temp
del re

__all__ = []

Expand Down
1 change: 1 addition & 0 deletions django_celery_results/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TaskResultAdmin(admin.ModelAdmin):
'fields': (
'task_id',
'task_name',
'periodic_task_name',
'status',
'worker',
'content_type',
Expand Down
25 changes: 20 additions & 5 deletions django_celery_results/backends/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json

from celery import maybe_signature
from celery.backends.base import BaseDictBackend
from celery.backends.base import BaseDictBackend, get_current_task
from celery.exceptions import ChordError
from celery.result import GroupResult, allow_join_result, result_from_tuple
from celery.utils.log import get_logger
Expand Down Expand Up @@ -99,6 +99,16 @@ def _get_extended_properties(self, request, traceback):

return extended_props

def _get_meta_from_request(self, request=None):
"""
Use the request or get_current_task to evaluate the `meta` attribute.
With this, is possible to assign arbitrary data in request.meta to be
retrieve and stored on the TaskResult.
"""
request = request or getattr(get_current_task(), "request", None)
return getattr(request, "meta", {})

def _store_result(
self,
task_id,
Expand All @@ -110,14 +120,19 @@ def _store_result(
):
"""Store return value and status of an executed task."""
content_type, content_encoding, result = self.encode_content(result)
_, _, meta = self.encode_content(
{'children': self.current_task_children(request)}

meta = {
**self._get_meta_from_request(request),
"children": self.current_task_children(request),
}
_, _, encoded_meta = self.encode_content(
meta,
)

task_props = {
'content_encoding': content_encoding,
'content_type': content_type,
'meta': meta,
'meta': encoded_meta,
'result': result,
'status': status,
'task_id': task_id,
Expand Down Expand Up @@ -245,7 +260,7 @@ def on_chord_part_return(self, request, state, result, **kwargs):
return
chord_counter.count -= 1
if chord_counter.count != 0:
chord_counter.save()
chord_counter.save(update_fields=["count"])
else:
# Last task in the chord header has finished
call_callback = True
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a0ff0ea

Please sign in to comment.