def task(fn=None, **kwargs): # TODO override this if 'celerybeat' in sys.argv ? from . import settings # register task if fn is None: name = kwargs.get('name', None) if settings.TASKS_BACKEND in ('thread', 'process'): def decorator(fn): return apply_async(celery_shared_task(**kwargs)(fn), name=name) return decorator else: return celery_shared_task(**kwargs) fn = celery_shared_task(fn) if settings.TASKS_BACKEND in ('thread', 'process'): fn = apply_async(fn) return fn
def decorator(fn): return apply_async(celery_shared_task(**kwargs)(fn), name=name)