コード例 #1
0
    from celery.canvas import group, chord, subtask
    from .base import BaseTask, Task, PeriodicTask, task, periodic_task
    from .sets import TaskSet


class module(MagicModule):

    def __call__(self, *args, **kwargs):
        return self.task(*args, **kwargs)


old_module, new_module = recreate_module(  # pragma: no cover
    __name__,
    by_module={
        'celery.task.base': ['BaseTask', 'Task', 'PeriodicTask',
                             'task', 'periodic_task'],
        'celery.canvas': ['group', 'chord', 'subtask'],
        'celery.task.sets': ['TaskSet'],
    },
    base=module,
    __package__='celery.task',
    __file__=__file__,
    __path__=__path__,
    __doc__=__doc__,
    current=current,
    discard_all=Proxy(lambda: current_app.control.purge),
    backend_cleanup=Proxy(
        lambda: current_app.tasks['celery.backend_cleanup']
    ),
)
コード例 #2
0
ファイル: __init__.py プロジェクト: axiak/celery
from celery.app.state import current_app, current_task as current
from celery.__compat__ import MagicModule, recreate_module
from celery.local import Proxy


class module(MagicModule):

    def __call__(self, *args, **kwargs):
        return self.task(*args, **kwargs)


old_module, new_module = recreate_module(__name__,
    by_module={
        "celery.task.base":   ["BaseTask", "Task", "PeriodicTask",
                               "task", "periodic_task"],
        "celery.task.sets":   ["chain", "group", "TaskSet", "subtask"],
        "celery.task.chords": ["chord"],
    },
    base=module,
    __package__="celery.task",
    __file__=__file__,
    __path__=__path__,
    __doc__=__doc__,
    current=current,
    discard_all=Proxy(lambda: current_app.control.discard_all),
    backend_cleanup=Proxy(
        lambda: current_app.tasks["celery.backend_cleanup"]
    ),
)
コード例 #3
0
ファイル: __init__.py プロジェクト: c0ns0le/zenoss-4
"""
from __future__ import absolute_import

from celery.app.state import current_app, current_task as current
from celery.__compat__ import MagicModule, recreate_module
from celery.local import Proxy


class module(MagicModule):
    def __call__(self, *args, **kwargs):
        return self.task(*args, **kwargs)


old_module, new_module = recreate_module(
    __name__,  # pragma: no cover
    by_module={
        "celery.task.base":
        ["BaseTask", "Task", "PeriodicTask", "task", "periodic_task"],
        "celery.canvas": ["chain", "group", "chord", "subtask"],
        "celery.task.sets": ["TaskSet"],
    },
    base=module,
    __package__="celery.task",
    __file__=__file__,
    __path__=__path__,
    __doc__=__doc__,
    current=current,
    discard_all=Proxy(lambda: current_app.control.discard_all),
    backend_cleanup=Proxy(lambda: current_app.tasks["celery.backend_cleanup"]),
)