changeset 8817:233ba8198781

celery: use explicit task names - avoid automatic naming with "kallithea.lib.celerylib." prefix We wrap async functions in a local f_async wrapper, defined in kallithea/lib/celerylib/__init__.py . For a function Foo.X, even though we changed the wrapper's __name__ to X, the tasks would be named kallithea.lib.celerylib.X , without using the actual module name of X for namespacing. Drop modifying __name__, and just specify the name explicitly, without trying to namespace it.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 06 Jan 2021 22:43:43 +0100
parents c76638100ca0
children 1c43fd986a8e
files kallithea/lib/celerylib/__init__.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/celerylib/__init__.py	Tue Dec 29 22:30:48 2020 +0100
+++ b/kallithea/lib/celerylib/__init__.py	Wed Jan 06 22:43:43 2021 +0100
@@ -67,8 +67,7 @@
                 f_org(*args, **kwargs)
             finally:
                 log.info('executed %s task', f_org.__name__)
-        f_async.__name__ = f_org.__name__
-        runner = kallithea.CELERY_APP.task(ignore_result=True)(f_async)
+        runner = kallithea.CELERY_APP.task(name=f_org.__name__, ignore_result=True)(f_async)
 
         def f_wrapped(*args, **kwargs):
             t = runner.apply_async(args=args, kwargs=kwargs)