Changeset - 233ba8198781
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 5 years ago 2021-01-06 22:43:43
mads@kiilerich.com
Grafted from: 7eaf04d1d3f5
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.
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/celerylib/__init__.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)