From 62fe578f380e78235a4993425e0cdb132974492f Mon Sep 17 00:00:00 2001 From: j Date: Tue, 16 Jul 2019 12:05:40 +0100 Subject: [PATCH] update celery to a version that works in python3.7 --- pandora/archive/views.py | 9 ++++++--- pandora/settings.py | 4 +--- pandora/taskqueue/models.py | 1 - requirements.txt | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 3112d193f..91f700a2d 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -10,7 +10,7 @@ from django.db.models import Count, Q from six import string_types from celery.utils import get_full_cls_name -from celery.backends import default_backend +from celery._state import current_app import ox from oxdjango.decorators import login_required_json from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response @@ -390,8 +390,11 @@ def getTaskStatus(request, data): else: task_id = data['task_id'] response = json_response(status=200, text='ok') - status = default_backend.get_status(task_id) - res = default_backend.get_result(task_id) + + backend = current_app.backend + status = backend.get_status(task_id) + res = backend.get_result(task_id) + response['data'] = { 'id': task_id, 'status': status diff --git a/pandora/settings.py b/pandora/settings.py index b57d0d318..d654f948a 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -6,8 +6,6 @@ from __future__ import absolute_import import os from os.path import join, normpath, dirname -import djcelery -djcelery.setup_loader() BASE_DIR = PROJECT_ROOT = normpath(dirname(__file__)) BIN_DIR = normpath(join(PROJECT_ROOT, '..', 'bin')) @@ -122,7 +120,7 @@ INSTALLED_APPS = ( 'django.contrib.humanize', 'django_extensions', - 'djcelery', + 'django_celery_results', 'app', 'log', 'annotation', diff --git a/pandora/taskqueue/models.py b/pandora/taskqueue/models.py index 839aff396..6a36e3bfd 100644 --- a/pandora/taskqueue/models.py +++ b/pandora/taskqueue/models.py @@ -4,7 +4,6 @@ from __future__ import division, print_function, absolute_import from datetime import datetime, timedelta from time import time -from celery.backends import default_backend from celery.utils import get_full_cls_name from django.contrib.auth import get_user_model from django.conf import settings diff --git a/requirements.txt b/requirements.txt index 1881524a2..d26e9bd9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ Django==1.11.22 simplejson chardet -celery==3.1.26.post2 -django-celery==3.2.2 +celery>4 +django-celery-results django-extensions==2.0.7 gunicorn==19.8.1 html5lib