# HG changeset patch # User Mads Kiilerich # Date 2021-01-06 22:43:43 # Node ID 233ba81987818c23a59c9e01bac351c1d4feb405 # Parent c76638100ca011fb4300ac60f41dee8439a30648 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. diff --git a/kallithea/lib/celerylib/__init__.py b/kallithea/lib/celerylib/__init__.py --- a/kallithea/lib/celerylib/__init__.py +++ b/kallithea/lib/celerylib/__init__.py @@ -67,8 +67,7 @@ def task(f_org): 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)