From a9a136734b9553d1df94492eb5730618ef5484c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Nov 2021 23:00:26 +0000 Subject: [PATCH 1/3] Bump kombu from 5.1.0 to 5.2.1 Bumps [kombu](https://kombu.readthedocs.io) from 5.1.0 to 5.2.1. --- updated-dependencies: - dependency-name: kombu dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f878898..5d9c255 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ elasticsearch==7.15.1 elasticsearch-dsl==7.4.0 gunicorn==20.1.0 honcho==1.1.0 -kombu==5.1.0 +kombu==5.2.1 psycopg2-binary==2.9.1 pytz redis==3.5.3 From c0db04e513635c904c109be85a48e26effd4e9e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 10:20:55 +0100 Subject: [PATCH 2/3] Bump celery from 5.1.2 to 5.2.0 (#89) Bumps [celery](https://github.com/celery/celery) from 5.1.2 to 5.2.0. - [Release notes](https://github.com/celery/celery/releases) - [Changelog](https://github.com/celery/celery/blob/master/Changelog.rst) - [Commits](https://github.com/celery/celery/compare/v5.1.2...v5.2.0) --- updated-dependencies: - dependency-name: celery dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5d9c255..963cabb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ Django==3.2.9 amqp==5.0.6 billiard==3.6.4.0 -celery==5.1.2 +celery==5.2.0 future==0.18.2 certifi dj-database-url==0.5.0 From a1633ebf395b77bbbde565e1b09415d2f7bf3a3f Mon Sep 17 00:00:00 2001 From: Benjamin Wohlwend Date: Tue, 9 Nov 2021 10:44:08 +0100 Subject: [PATCH 3/3] use app.task decorator instead of removed celery.decorators.task --- opbeans/tasks.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/opbeans/tasks.py b/opbeans/tasks.py index 8c0bf6a..90fb906 100644 --- a/opbeans/tasks.py +++ b/opbeans/tasks.py @@ -3,24 +3,26 @@ from django.core.cache import cache from django.db import models as m -from celery.decorators import task +import elasticapm from elasticsearch import TransportError from elasticsearch.helpers import bulk from elasticsearch_dsl import Search from elasticsearch_dsl.connections import connections from opbeans import utils, models, documents +from opbeans.celery import app - -@task() +@app.task() def update_stats(): if random.random() > 0.8: dict_for_truncation = {k: k for k in range(500)} assert False, "Bad luck!" + elasticapm.label(a="x", b="y") + elasticapm.set_custom_context({"a": "x", "b": "y"}) cache.set(utils.stats.cache_key, utils.stats(), 60) -@task() +@app.task() def sync_customers(): customer_docs = [] for customer in models.Customer.objects.annotate(total_orders=m.Count('orders')).order_by('pk')[50:]: @@ -28,7 +30,7 @@ def sync_customers(): bulk(connections.get_connection(), customer_docs) -@task() +@app.task() def sync_orders(): highest_id = None try: