コード例 #1
0
ファイル: task.py プロジェクト: NguyenMo2610/it4421
from celery.utils.serialization import raise_with_context

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task_v2
from .utils import appstr

__all__ = ('Context', 'Task')

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    'queue',
    'routing_key',
    'exchange',
    'priority',
    'expires',
    'serializer',
    'delivery_mode',
    'compression',
    'time_limit',
    'soft_time_limit',
    'immediate',
    'mandatory',  # imm+man is deprecated
)

# We take __repr__ very seriously around here ;)
R_BOUND_TASK = '<class {0.__name__} of {app}{flags}>'
R_UNBOUND_TASK = '<unbound {0.__name__}{flags}>'
R_INSTANCE = '<@task: {0.name} of {app}{flags}>'

#: Here for backwards compatibility as tasks no longer use a custom meta-class.
TaskType = type
コード例 #2
0
from celery.result import EagerResult
from celery.utils import gen_task_name, fun_takes_kwargs, uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    'queue',
    'routing_key',
    'exchange',
    'immediate',
    'mandatory',
    'priority',
    'expires',
    'serializer',
    'delivery_mode',
    'compression',
)


class Context(object):
    # Default context
    logfile = None
    loglevel = None
    hostname = None
    id = None
    args = None
    kwargs = None
コード例 #3
0
ファイル: task.py プロジェクト: chillbear/celery
from celery.result import EagerResult
from celery.utils import uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task_v2
from .utils import appstr

__all__ = ['Context', 'Task']

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    'queue', 'routing_key', 'exchange', 'priority', 'expires',
    'serializer', 'delivery_mode', 'compression', 'time_limit',
    'soft_time_limit', 'immediate', 'mandatory',  # imm+man is deprecated
)

# We take __repr__ very seriously around here ;)
R_BOUND_TASK = '<class {0.__name__} of {app}{flags}>'
R_UNBOUND_TASK = '<unbound {0.__name__}{flags}>'
R_SELF_TASK = '<@task {0.name} bound to other {0.__self__}>'
R_INSTANCE = '<@task: {0.name} of {app}{flags}>'

#: Here for backwards compatibility as tasks no longer use a custom metaclass.
TaskType = type


def _strflags(flags, default=''):
    if flags:
コード例 #4
0
ファイル: task.py プロジェクト: public/celery
from celery._state import get_current_worker_task, _task_stack
from celery.datastructures import ExceptionInfo
from celery.exceptions import MaxRetriesExceededError, RetryTaskError
from celery.result import EagerResult
from celery.utils import gen_task_name, fun_takes_kwargs, uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    'queue', 'routing_key', 'exchange',
    'immediate', 'mandatory', 'priority', 'expires',
    'serializer', 'delivery_mode', 'compression',
)


class Context(object):
    # Default context
    logfile = None
    loglevel = None
    hostname = None
    id = None
    args = None
    kwargs = None
    retries = 0
    is_eager = False
    delivery_info = None
コード例 #5
0
ファイル: task.py プロジェクト: AdrianRibao/celery
from celery.datastructures import ExceptionInfo
from celery.exceptions import MaxRetriesExceededError, RetryTaskError
from celery.result import EagerResult
from celery.utils import fun_takes_kwargs, uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.log import get_task_logger
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    "queue", "routing_key", "exchange",
    "immediate", "mandatory", "priority", "expires",
    "serializer", "delivery_mode", "compression",
)

#: Billiard sets this when execv is enabled.
#: We use it to find out the name of the original ``__main__``
#: module, so that we can properly rewrite the name of the
#: task to be that of ``App.main``.
MP_MAIN_FILE = os.environ.get("MP_MAIN_FILE") or None


class Context(object):
    # Default context
    logfile = None
    loglevel = None
    hostname = None
コード例 #6
0
ファイル: task.py プロジェクト: hugo-aa/celery
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task_v2
from .utils import appstr

__all__ = ["Context", "Task"]

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    "queue",
    "routing_key",
    "exchange",
    "priority",
    "expires",
    "serializer",
    "delivery_mode",
    "compression",
    "time_limit",
    "soft_time_limit",
    "immediate",
    "mandatory",  # imm+man is deprecated
)

# We take __repr__ very seriously around here ;)
R_BOUND_TASK = "<class {0.__name__} of {app}{flags}>"
R_UNBOUND_TASK = "<unbound {0.__name__}{flags}>"
R_SELF_TASK = "<@task {0.name} bound to other {0.__self__}>"
R_INSTANCE = "<@task: {0.name} of {app}{flags}>"

#: Here for backwards compatibility as tasks no longer use a custom metaclass.
TaskType = type
コード例 #7
0
from celery.utils.nodenames import gethostname
from celery.utils.serialization import raise_with_context
from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task_v2
from .utils import appstr

__all__ = ("Context", "Task")

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    "queue",
    "routing_key",
    "exchange",
    "priority",
    "expires",
    "serializer",
    "delivery_mode",
    "compression",
    "time_limit",
    "soft_time_limit",
    "immediate",
    "mandatory",  # imm+man is deprecated
)

# We take __repr__ very seriously around here ;)
R_BOUND_TASK = "<class {0.__name__} of {app}{flags}>"
R_UNBOUND_TASK = "<unbound {0.__name__}{flags}>"
R_INSTANCE = "<@task: {0.name} of {app}{flags}>"

#: Here for backwards compatibility as tasks no longer use a custom meta-class.
TaskType = type
コード例 #8
0
from celery.utils import fun_takes_kwargs, uuid, maybe_reraise
from celery.utils.functional import mattrgetter, maybe_list
from celery.utils.imports import instantiate
from celery.utils.log import get_task_logger
from celery.utils.mail import ErrorMail

from .annotations import resolve_all as resolve_all_annotations
from .registry import _unpickle_task

#: extracts attributes related to publishing a message from an object.
extract_exec_options = mattrgetter(
    "queue",
    "routing_key",
    "exchange",
    "immediate",
    "mandatory",
    "priority",
    "expires",
    "serializer",
    "delivery_mode",
    "compression",
)

#: Billiard sets this when execv is enabled.
#: We use it to find out the name of the original ``__main__``
#: module, so that we can properly rewrite the name of the
#: task to be that of ``App.main``.
MP_MAIN_FILE = os.environ.get("MP_MAIN_FILE") or None


class Context(object):
    # Default context