Exemple #1
0
def TaskSet(*args, **kwargs):
    from celery.task.sets import TaskSet
    return TaskSet(*args, **kwargs)


@deprecated("Importing subtask from celery.task.base",
            alternative="Use celery.task.subtask instead.",
            removal="2.4")
def subtask(*args, **kwargs):
    from celery.task.sets import subtask
    return subtask(*args, **kwargs)


extract_exec_options = mattrgetter("queue", "routing_key",
                                   "exchange", "immediate",
                                   "mandatory", "priority",
                                   "serializer", "delivery_mode",
                                   "compression")


class Context(threading.local):
    # Default context
    logfile = None
    loglevel = None
    id = None
    args = None
    kwargs = None
    retries = 0
    is_eager = False
    delivery_info = None
    taskset = None
Exemple #2
0
from celery import conf
from celery.datastructures import ExceptionInfo
from celery.execute.trace import TaskTrace
from celery.messaging import with_connection
from celery.messaging import TaskPublisher
from celery.registry import tasks
from celery.result import AsyncResult, EagerResult
from celery.routes import Router
from celery.utils import gen_unique_id, fun_takes_kwargs, mattrgetter

extract_exec_options = mattrgetter("queue", "routing_key", "exchange",
                                   "immediate", "mandatory", "priority",
                                   "serializer", "delivery_mode")


@with_connection
def apply_async(task,
                args=None,
                kwargs=None,
                countdown=None,
                eta=None,
                task_id=None,
                publisher=None,
                connection=None,
                connect_timeout=None,
                router=None,
                expires=None,
                **options):
    """Run a task asynchronously by the celery daemon(s).

    :param task: The :class:`~celery.task.base.Task` to run.
Exemple #3
0
from celery import conf
from celery.utils import gen_unique_id, fun_takes_kwargs, mattrgetter
from celery.result import AsyncResult, EagerResult
from celery.execute.trace import TaskTrace
from celery.registry import tasks
from celery.messaging import with_connection
from celery.messaging import TaskPublisher

extract_exec_options = mattrgetter("routing_key", "exchange",
                                   "immediate", "mandatory",
                                   "priority", "serializer")


@with_connection
def apply_async(task, args=None, kwargs=None, countdown=None, eta=None,
        task_id=None, publisher=None, connection=None, connect_timeout=None,
        **options):
    """Run a task asynchronously by the celery daemon(s).

    :param task: The task to run (a callable object, or a :class:`Task`
        instance

    :keyword args: The positional arguments to pass on to the
        task (a ``list``).

    :keyword kwargs: The keyword arguments to pass on to the task (a ``dict``)

    :keyword countdown: Number of seconds into the future that the task should
        execute. Defaults to immediate delivery (Do not confuse that with
        the ``immediate`` setting, they are unrelated).