diff --git a/fractalis/celeryapp.py b/fractalis/celeryapp.py index 51152315bbd39ca29c766fb1a06625507dfabeb1..40fbbbf2d27f9d99e52dd4a12a459a58beb5379b 100644 --- a/fractalis/celeryapp.py +++ b/fractalis/celeryapp.py @@ -15,14 +15,16 @@ logger = logging.getLogger(__name__) # https://stackoverflow.com/questions/9824172/find-out-whether-celery-task-exists @after_task_publish.connect -def update_submitted_state(sender=None, **kwargs): +def update_submitted_state(sender, headers, **kwargs): """Add 'SUBMITTED' state to celery task.""" # the task may not exist if sent using `send_task` which # sends tasks by name, so fall back to the default result backend # if that is the case. task = current_app.tasks.get(sender) backend = task.backend if task else current_app.backend - backend.store_result(kwargs['headers']['id'], None, "SUBMITTED") + backend.store_result(task_id=headers['id'], + result=None, + state='SUBMITTED') def make_celery(app: Flask) -> Celery: diff --git a/setup.py b/setup.py index 9a688975db6e144c0445bf407380519096a25c0b..5c0c29938b7056d64d142e6de5a1e6e1a1676c18 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ setup( 'PyYAML', 'pycryptodomex', 'rpy2', - 'tzlocal', 'flake8', 'pytest', 'pytest-runner',