celery API Reference
Full documentation for celery (5.6.3)
celery.Celery
Python Library Documentation: class Celery in module celery.app.base
class Celery(builtins.object)
| Celery(main=None, loader=None, backend=None, amqp=None, events=None, log=None, control=None, set_as_current=True, tasks=None, broker=None, include=None, changes=None, config_source=None, fixups=None, task_cls=None, autofinalize=True, namespace=None, strict_typing=True, **kwargs)
|
| Celery application.
|
| Arguments:
| main (str): Name of the main module if running as `__main__`.
| This is used as the prefix for auto-generated task names.
|
| Keyword Arguments:
| broker (str): URL of the default broker used.
| backend (Union[str, Type[celery.backends.base.Backend]]):
| The result store backend class, or the name of the backend
| class to use.
|
| Default is the value of the :setting:`result_backend` setting.
| autofinalize (bool): If set to False a :exc:`RuntimeError`
| will be raised if the task registry or tasks are used before
| the app is finalized.
| set_as_current (bool): Make this the global current app.
| include (List[str]): List of modules every worker should import.
|
| amqp (Union[str, Type[AMQP]]): AMQP object or class name.
| events (Union[str, Type[celery.app.events.Events]]): Events object or
| class name.
| log (Union[str, Type[Logging]]): Log object or class name.
| control (Union[str, Type[celery.app.control.Control]]): Control object
| or class name.
| tasks (Union[str, Type[TaskRegistry]]): A task registry, or the name of
| a registry class.
| fixups (List[str]): List of fix-up plug-ins (e.g., see
| :mod:`celery.fixups.django`).
| config_source (Union[str, class]): Take configuration from a class,
| or object. Attributes may include any settings described in
| the documentation.
| task_cls (Union[str, Type[celery.app.task.Task]]): base task class to
| use. See :ref:`this section <custom-task-cls-app-wide>` for usage.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *exc_info)
|
| __init__(self, main=None, loader=None, backend=None, amqp=None, events=None, log=None, control=None, set_as_current=True, tasks=None, broker=None, include=None, changes=None, config_source=None, fixups=None, task_cls=None, autofinalize=True, namespace=None, strict_typing=True, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(self)
| Helper for pickle.
|
| __reduce_args__(self)
| Deprecated method, please use :meth:`__reduce_keys__` instead.
|
| __reduce_keys__(self)
| Keyword arguments used to reconstruct the object when unpickling.
|
| __reduce_v1__(self)
|
| __repr__(self)
| Return repr(self).
|
| add_defaults(self, fun)
| Add default configuration from dict ``d``.
|
| If the argument is a callable function then it will be regarded
| as a promise, and it won't be loaded until the configuration is
| actually needed.
|
| This method can be compared to:
|
| .. code-block:: pycon
|
| >>> celery.conf.update(d)
|
| with a difference that 1) no copy will be made and 2) the dict will
| not be transferred when the worker spawns child processes, so
| it's important that the same configuration happens at import time
| when pickle restores the object on the other side.
|
| add_periodic_task(self, schedule, sig, args=(), kwargs=(), name=None, **opts)
| Add a periodic task to beat schedule.
|
| Celery beat store tasks based on `sig` or `name` if provided. Adding the
| same signature twice make the second task override the first one. To
| avoid the override, use distinct `name` for them.
|
| autodiscover_tasks(self, packages=None, related_name='tasks', force=False)
| Auto-discover task modules.
|
| Searches a list of packages for a "tasks.py" module (or use
| related_name argument).
|
| If the name is empty, this will be delegated to fix-ups (e.g., Django).
|
| For example if you have a directory layout like this:
|
| .. code-block:: text
|
| foo/__init__.py
| tasks.py
| models.py
|
| bar/__init__.py
| tasks.py
| models.py
|
| baz/__init__.py
| models.py
|
| Then calling ``app.autodiscover_tasks(['foo', 'bar', 'baz'])`` will
| result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
|
| Arguments:
| packages (List[str]): List of packages to search.
| This argument may also be a callable, in which case the
| value returned is used (for lazy evaluation).
| related_name (Optional[str]): The name of the module to find. Defaults
| to "tasks": meaning "look for 'module.tasks' for every
| module in ``packages``.". If ``None`` will only try to import
| the package, i.e. "look for 'module'".
| force (bool): By default this call is lazy so that the actual
| auto-discovery won't happen until an application imports
| the default modules. Forcing will cause the auto-discovery
| to happen immediately.
|
| broker_connection = connection(self, hostname=None, userid=None, password=None, virtual_host=None, port=None, ssl=None, connect_timeout=None, transport=None, transport_options=None, heartbeat=None, login_method=None, failover_strategy=None, **kwargs)
|
| bugreport(self)
| Return information useful in bug reports.
|
| close(self)
| Clean up after the application.
|
| Only necessary for dynamically created apps, and you should
| probably use the :keyword:`with` statement instead.
|
| Example:
| >>> with Celery(set_as_current=False) as app:
| ... with app.connection_for_write() as conn:
| ... pass
|
| config_from_cmdline(self, argv, namespace='celery')
|
| config_from_envvar(self, variable_name, silent=False, force=False)
| Read configuration from environment variable.
|
| The value of the environment variable must be the name
| of a module to import.
|
| Example:
| >>> os.environ['CELERY_CONFIG_MODULE'] = 'myapp.celeryconfig'
| >>> celery.config_from_envvar('CELERY_CONFIG_MODULE')
|
| config_from_object(self, obj, silent=False, force=False, namespace=None)
| Read configuration from object.
|
| Object is either an actual object or the name of a module to import.
|
| Example:
| >>> celery.config_from_object('myapp.celeryconfig')
|
| >>> from myapp import celeryconfig
| >>> celery.config_from_object(celeryconfig)
|
| Arguments:
| silent (bool): If true then import errors will be ignored.
| force (bool): Force reading configuration immediately.
| By default the configuration will be read only when required.
|
| connection(self, hostname=None, userid=None, password=None, virtual_host=None, port=None, ssl=None, connect_timeout=None, transport=None, transport_options=None, heartbeat=None, login_method=None, failover_strategy=None, **kwargs)
| Establish a connection to the message broker.
|
| Please use :meth:`connection_for_read` and
| :meth:`connection_for_write` instead, to convey the intent
| of use for this connection.
|
| Arguments:
| url: Either the URL or the hostname of the broker to use.
| hostname (str): URL, Hostname/IP-address of the broker.
| If a URL is used, then the other argument below will
| be taken from the URL instead.
| userid (str): Username to authenticate as.
| password (str): Password to authenticate with
| virtual_host (str): Virtual host to use (domain).
| port (int): Port to connect to.
| ssl (bool, Dict): Defaults to the :setting:`broker_use_ssl`
| setting.
| transport (str): defaults to the :setting:`broker_transport`
| setting.
| transport_options (Dict): Dictionary of transport specific options.
| heartbeat (int): AMQP Heartbeat in seconds (``pyamqp`` only).
| login_method (str): Custom login method to use (AMQP only).
| failover_strategy (str, Callable): Custom failover strategy.
| **kwargs: Additional arguments to :class:`kombu.Connection`.
|
| Returns:
| kombu.Connection: the lazy connection instance.
|
| connection_for_read(self, url=None, **kwargs)
| Establish connection used for consuming.
|
| See Also:
| :meth:`connection` for supported arguments.
|
| connection_for_write(self, url=None, **kwargs)
| Establish connection used for producing.
|
| See Also:
| :meth:`connection` for supported arguments.
|
| connection_or_acquire(self, connection=None, pool=True, *_, **__)
| Context used to acquire a connection from the pool.
|
| For use within a :keyword:`with` statement to get a connection
| from the pool if one is not already provided.
|
| Arguments:
| connection (kombu.Connection): If not provided, a connection
| will be acquired from the connection pool.
|
| create_task_cls(self)
| Create a base task class bound to this app.
|
| default_connection = connection_or_acquire(self, connection=None, pool=True, *_, **__)
|
| default_producer = producer_or_acquire(self, producer=None)
|
| either(self, default_key, *defaults)
| Get key from configuration or use default values.
|
| Fallback to the value of a configuration key if none of the
| `*values` are true.
|
| finalize(self, auto=False)
| Finalize the app.
|
| This loads built-in tasks, evaluates pending task decorators,
| reads configuration, etc.
|
| gen_task_name(self, name, module)
|
| now(self)
| Return the current time and date as a datetime.
|
| on_init(self)
| Optional callback called at init.
|
| prepare_config(self, c)
| Prepare configuration before it is merged with the defaults.
|
| producer_or_acquire(self, producer=None)
| Context used to acquire a producer from the pool.
|
| For use within a :keyword:`with` statement to get a producer
| from the pool if one is not already provided
|
| Arguments:
| producer (kombu.Producer): If not provided, a producer
| will be acquired from the producer pool.
|
| register_task(self, task, **options)
| Utility for registering a task-based class.
|
| Note:
| This is here for compatibility with old Celery 1.0
| style task classes, you should not need to use this for
| new projects.
|
| select_queues(self, queues=None)
| Select subset of queues.
|
| Arguments:
| queues (Sequence[str]): a list of queue names to keep.
|
| send_task(self, name, args=None, kwargs=None, countdown=None, eta=None, task_id=None, producer=None, connection=None, router=None, result_cls=None, expires=None, publisher=None, link=None, link_error=None, add_to_parent=True, group_id=None, group_index=None, retries=0, chord=None, reply_to=None, time_limit=None, soft_time_limit=None, root_id=None, parent_id=None, route_name=None, shadow=None, chain=None, task_type=None, replaced_task_nesting=0, **options)
| Send task by name.
|
| Supports the same arguments as :meth:`@-Task.apply_async`.
|
| Arguments:
| name (str): Name of task to call (e.g., `"tasks.add"`).
| result_cls (AsyncResult): Specify custom result class.
|
| set_current(self)
| Make this the current app for this thread.
|
| set_default(self)
| Make this the default app for all threads.
|
| setup_security(self, allowed_serializers=None, key=None, key_password=None, cert=None, store=None, digest='sha256', serializer='json')
| Setup the message-signing serializer.
|
| This will affect all application instances (a global operation).
|
| Disables untrusted serializers and if configured to use the ``auth``
| serializer will register the ``auth`` serializer with the provided
| settings into the Kombu serializer registry.
|
| Arguments:
| allowed_serializers (Set[str]): List of serializer names, or
| content_types that should be exempt from being disabled.
| key (str): Name of private key file to use.
| Defaults to the :setting:`security_key` setting.
| key_password (bytes): Password to decrypt the private key.
| Defaults to the :setting:`security_key_password` setting.
| cert (str): Name of certificate file to use.
| Defaults to the :setting:`security_certificate` setting.
| store (str): Directory containing certificates.
| Defaults to the :setting:`security_cert_store` setting.
| digest (str): Digest algorithm used when signing messages.
| Default is ``sha256``.
| serializer (str): Serializer used to encode messages after
| they've been signed. See :setting:`task_serializer` for
| the serializers supported. Default is ``json``.
|
| signature(self, *args, **kwargs)
| Return a new :class:`~celery.Signature` bound to this app.
|
| start(self, argv=None)
| Run :program:`celery` using `argv`.
|
| Uses :data:`sys.argv` if `argv` is not specified.
|
| subclass_with_self(self, Class, name=None, attribute='app', reverse=None, keep_reduce=False, **kw)
| Subclass an app-compatible class.
|
| App-compatible means that the class has a class attribute that
| provides the default app it should use, for example:
| ``class Foo: app = None``.
|
| Arguments:
| Class (type): The app-compatible class to subclass.
| name (str): Custom name for the target class.
| attribute (str): Name of the attribute holding the app,
| Default is 'app'.
| reverse (str): Reverse path to this object used for pickling
| purposes. For example, to get ``app.AsyncResult``,
| use ``"AsyncResult"``.
| keep_reduce (bool): If enabled a custom ``__reduce__``
| implementation won't be provided.
|
| task(self, *args, **opts)
| Decorator to create a task class out of any callable.
|
| See :ref:`Task options<task-options>` for a list of the
| arguments that can be passed to this decorator.
|
| Examples:
| .. code-block:: python
|
| @app.task
| def refresh_feed(url):
| store_feed(feedparser.parse(url))
|
| with setting extra options:
|
| .. code-block:: python
|
| @app.task(exchange='feeds')
| def refresh_feed(url):
| return store_feed(feedparser.parse(url))
|
| Note:
| App Binding: For custom apps the task decorator will return
| a proxy object, so that the act of creating the task is not
| performed until the task is used or the task registry is accessed.
|
| If you're depending on binding to be deferred, then you must
| not access any attributes on the returned object until the
| application is fully set up (finalized).
|
| type_checker(self, fun, bound=False)
|
| uses_utc_timezone(self)
| Check if the application uses the UTC timezone.
|
| worker_main(self, argv=None)
| Run :program:`celery worker` using `argv`.
|
| Uses :data:`sys.argv` if `argv` is not specified.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| backend
| Current backend instance.
|
| current_task
| Instance of task being executed, or :const:`None`.
|
| current_worker_task
| The task currently being executed by a worker or :const:`None`.
|
| Differs from :data:`current_task` in that it's not affected
| by tasks calling other tasks directly, or eagerly.
|
| pool
| Broker connection pool: :class:`~@pool`.
|
| Note:
| This attribute is not related to the workers concurrency pool.
|
| producer_pool
|
| thread_oid
| Per-thread unique identifier for this app.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| AsyncResult
| Create new result instance.
|
| See Also:
| :class:`celery.result.AsyncResult`.
|
| Beat
| :program:`celery beat` scheduler application.
|
| See Also:
| :class:`~@Beat`.
|
| GroupResult
| Create new group result instance.
|
| See Also:
| :class:`celery.result.GroupResult`.
|
| ResultSet
|
| Task
| Base task class for this app.
|
| WorkController
| Embeddable worker.
|
| See Also:
| :class:`~@WorkController`.
|
| Worker
| Worker application.
|
| See Also:
| :class:`~@Worker`.
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| amqp
| AMQP related functionality: :class:`~@amqp`.
|
| annotations
|
| conf
| Current configuration.
|
| control
| Remote control: :class:`~@control`.
|
| events
| Consuming and sending events: :class:`~@events`.
|
| loader
| Current loader instance.
|
| log
| Logging: :class:`~@log`.
|
| oid
| Universally unique identifier for this app.
|
| tasks
| Task registry.
|
| Warning:
| Accessing this attribute will also auto-finalize the app.
|
| timezone
| Current timezone for this app.
|
| This is a cached property taking the time zone from the
| :setting:`timezone` setting.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| IS_WINDOWS = True
|
| IS_macOS = False
|
| Pickler = <class 'celery.app.utils.AppPickler'>
| Old application pickler/unpickler (< 3.1).
|
|
| SYSTEM = 'Windows'
|
| amqp_cls = 'celery.app.amqp:AMQP'
|
| backend_cls = None
|
| builtin_fixups = {'celery.fixups.django:fixup'}
|
| control_cls = 'celery.app.control:Control'
|
| events_cls = 'celery.app.events:Events'
|
| loader_cls = None
|
| log_cls = 'celery.app.log:Logging'
|
| main = None
|
| on_after_configure = None
|
| on_after_finalize = None
|
| on_after_fork = None
|
| on_configure = None
|
| registry_cls = 'celery.app.registry:TaskRegistry'
|
| steps = None
|
| task_cls = 'celery.app.task:Task'
|
| user_options = None
celery.SERIES
Error rendering doc: No Python documentation found for 'recovery'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
celery.Signature
Python Library Documentation: class Signature in module celery.canvas
class Signature(builtins.dict)
| Signature(task=None, args=None, kwargs=None, options=None, type=None, subtask_type=None, immutable=False, app=None, **ex)
|
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
| Method resolution order:
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __call__(self, *partial_args, **partial_kwargs)
| Call the task directly (in the current process).
|
| __deepcopy__(self, memo)
|
| __init__(self, task=None, args=None, kwargs=None, options=None, type=None, subtask_type=None, immutable=False, app=None, **ex)
| Initialize self. See help(type(self)) for accurate signature.
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| apply_async(self, args=None, kwargs=None, route_name=None, **options)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| link(self, callback)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, errback)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| set_immutable(self, immutable)
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_dict(d, app=None)
| Create a new signature from a dict.
| Subclasses can override this method to customize how are
| they created from a dict.
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| app
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| id = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| immutable = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| kwargs = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| options = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| parent_id = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| root_id = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| subtask_type = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| task = <class 'celery.canvas.Signature'>
| Task Signature.
|
| Class that wraps the arguments and execution options
| for a single task invocation.
|
| Used as the parts in a :class:`group` and other constructs,
| or to pass tasks around as callbacks while being compatible
| with serializers with a strict type subset.
|
| Signatures can also be created from tasks:
|
| - Using the ``.signature()`` method that has the same signature
| as ``Task.apply_async``:
|
| .. code-block:: pycon
|
| >>> add.signature(args=(1,), kwargs={'kw': 2}, options={})
|
| - or the ``.s()`` shortcut that works for star arguments:
|
| .. code-block:: pycon
|
| >>> add.s(1, kw=2)
|
| - the ``.s()`` shortcut does not allow you to specify execution options
| but there's a chaining `.set` method that returns the signature:
|
| .. code-block:: pycon
|
| >>> add.s(2, 2).set(countdown=10).set(expires=30).delay()
|
| Note:
| You should use :func:`~celery.signature` to create new signatures.
| The ``Signature`` class is the type returned by that function and
| should be used for ``isinstance`` checks for signatures.
|
| See Also:
| :ref:`guide-canvas` for the complete guide.
|
| Arguments:
| task (Union[Type[celery.app.task.Task], str]): Either a task
| class/instance, or the name of a task.
| args (Tuple): Positional arguments to apply.
| kwargs (Dict): Keyword arguments to apply.
| options (Dict): Additional options to :meth:`Task.apply_async`.
|
| Note:
| If the first argument is a :class:`dict`, the other
| arguments will be ignored and the values in the dict will be used
| instead::
|
| >>> s = signature('tasks.add', args=(2, 2))
| >>> signature(s)
| {'task': 'tasks.add', args=(2, 2), kwargs={}, options={}}
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.Task
Python Library Documentation: class Task in module celery.app.task
class Task(builtins.object)
| Task base class.
|
| Note:
| When called tasks apply the :meth:`run` method. This method must
| be defined by all tasks (that is unless the :meth:`__call__` method
| is overridden).
|
| Methods defined here:
|
| AsyncResult(self, task_id, **kwargs)
| Get AsyncResult instance for the specified task.
|
| Arguments:
| task_id (str): Task id to get result for.
|
| __call__(self, *args, **kwargs)
| Call self as a function.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| ``repr(task)``.
|
| add_to_chord(self, sig, lazy=False)
| Add signature to the chord the current task is a member of.
|
| .. versionadded:: 4.0
|
| Currently only supported by the Redis result backend.
|
| Arguments:
| sig (Signature): Signature to extend chord with.
| lazy (bool): If enabled the new task won't actually be called,
| and ``sig.delay()`` must be called manually.
|
| add_trail(self, result)
|
| after_return(self, status, retval, task_id, args, kwargs, einfo)
| Handler called after the task returns.
|
| Arguments:
| status (str): Current task state.
| retval (Any): Task return value/exception.
| task_id (str): Unique id of the task.
| args (Tuple): Original arguments for the task.
| kwargs (Dict): Original keyword arguments for the task.
| einfo (~billiard.einfo.ExceptionInfo): Exception information.
|
| Returns:
| None: The return value of this handler is ignored.
|
| apply(self, args=None, kwargs=None, link=None, link_error=None, task_id=None, retries=None, throw=None, logfile=None, loglevel=None, headers=None, **options)
| Execute this task locally, by blocking until the task returns.
|
| Arguments:
| args (Tuple): positional arguments passed on to the task.
| kwargs (Dict): keyword arguments passed on to the task.
| throw (bool): Re-raise task exceptions.
| Defaults to the :setting:`task_eager_propagates` setting.
|
| Returns:
| celery.result.EagerResult: pre-evaluated result.
|
| apply_async(self, args=None, kwargs=None, task_id=None, producer=None, link=None, link_error=None, shadow=None, **options)
| Apply tasks asynchronously by sending a message.
|
| Arguments:
| args (Tuple): The positional arguments to pass on to the task.
|
| kwargs (Dict): The keyword arguments to pass on to the task.
|
| countdown (float): Number of seconds into the future that the
| task should execute. Defaults to immediate execution.
|
| eta (~datetime.datetime): Absolute time and date of when the task
| should be executed. May not be specified if `countdown`
| is also supplied.
|
| expires (float, ~datetime.datetime): Datetime or
| seconds in the future for the task should expire.
| The task won't be executed after the expiration time.
|
| shadow (str): Override task name used in logs/monitoring.
| Default is retrieved from :meth:`shadow_name`.
|
| connection (kombu.Connection): Reuse existing broker connection
| instead of acquiring one from the connection pool.
|
| retry (bool): If enabled sending of the task message will be
| retried in the event of connection loss or failure.
| Default is taken from the :setting:`task_publish_retry`
| setting. Note that you need to handle the
| producer/connection manually for this to work.
|
| retry_policy (Mapping): Override the retry policy used.
| See the :setting:`task_publish_retry_policy` setting.
|
| time_limit (int): If set, overrides the default time limit.
|
| soft_time_limit (int): If set, overrides the default soft
| time limit.
|
| queue (str, kombu.Queue): The queue to route the task to.
| This must be a key present in :setting:`task_queues`, or
| :setting:`task_create_missing_queues` must be
| enabled. See :ref:`guide-routing` for more
| information.
|
| exchange (str, kombu.Exchange): Named custom exchange to send the
| task to. Usually not used in combination with the ``queue``
| argument.
|
| routing_key (str): Custom routing key used to route the task to a
| worker server. If in combination with a ``queue`` argument
| only used to specify custom routing keys to topic exchanges.
|
| priority (int): The task priority, a number between 0 and 9.
| Defaults to the :attr:`priority` attribute.
|
| serializer (str): Serialization method to use.
| Can be `pickle`, `json`, `yaml`, `msgpack` or any custom
| serialization method that's been registered
| with :mod:`kombu.serialization.registry`.
| Defaults to the :attr:`serializer` attribute.
|
| compression (str): Optional compression method
| to use. Can be one of ``zlib``, ``bzip2``,
| or any custom compression methods registered with
| :func:`kombu.compression.register`.
| Defaults to the :setting:`task_compression` setting.
|
| link (Signature): A single, or a list of tasks signatures
| to apply if the task returns successfully.
|
| link_error (Signature): A single, or a list of task signatures
| to apply if an error occurs while executing the task.
|
| producer (kombu.Producer): custom producer to use when publishing
| the task.
|
| add_to_parent (bool): If set to True (default) and the task
| is applied while executing another task, then the result
| will be appended to the parent tasks ``request.children``
| attribute. Trailing can also be disabled by default using the
| :attr:`trail` attribute
|
| ignore_result (bool): If set to `False` (default) the result
| of a task will be stored in the backend. If set to `True`
| the result will not be stored. This can also be set
| using the :attr:`ignore_result` in the `app.task` decorator.
|
| publisher (kombu.Producer): Deprecated alias to ``producer``.
|
| headers (Dict): Message headers to be included in the message.
| The headers can be used as an overlay for custom labeling
| using the :ref:`canvas-stamping` feature.
|
| task_id (str): Optional argument to override the default task id.
| By default, Celery generates a unique id (UUID4) for every task
| submission. You can instead provide your own string identifier.
| If supplied, this value will be used as the task’s id instead
| of generating one automatically. Be careful to avoid collisions
| when overriding task ids.
|
| Returns:
| celery.result.AsyncResult: Promise of future evaluation.
|
| Raises:
| TypeError: If not enough arguments are passed, or too many
| arguments are passed. Note that signature checks may
| be disabled by specifying ``@task(typing=False)``.
| ValueError: If soft_time_limit and time_limit both are set
| but soft_time_limit is greater than time_limit
| kombu.exceptions.OperationalError: If a connection to the
| transport cannot be made, or if the connection is lost.
|
| Note:
| Also supports all keyword arguments supported by
| :meth:`kombu.Producer.publish`.
|
| before_start(self, task_id, args, kwargs)
| Handler called before the task starts.
|
| .. versionadded:: 5.2
|
| Arguments:
| task_id (str): Unique id of the task to execute.
| args (Tuple): Original arguments for the task to execute.
| kwargs (Dict): Original keyword arguments for the task to execute.
|
| Returns:
| None: The return value of this handler is ignored.
|
| chunks(self, it, n)
| Create a :class:`~celery.canvas.chunks` task for this task.
|
| delay(self, *args, **kwargs)
| Star argument version of :meth:`apply_async`.
|
| Does not support the extra options enabled by :meth:`apply_async`.
|
| Arguments:
| *args (Any): Positional arguments passed on to the task.
| **kwargs (Any): Keyword arguments passed on to the task.
| Returns:
| celery.result.AsyncResult: Future promise.
|
| map(self, it)
| Create a :class:`~celery.canvas.xmap` task from ``it``.
|
| on_failure(self, exc, task_id, args, kwargs, einfo)
| Error handler.
|
| This is run by the worker when the task fails.
|
| Arguments:
| exc (Exception): The exception raised by the task.
| task_id (str): Unique id of the failed task.
| args (Tuple): Original arguments for the task that failed.
| kwargs (Dict): Original keyword arguments for the task that failed.
| einfo (~billiard.einfo.ExceptionInfo): Exception information.
|
| Returns:
| None: The return value of this handler is ignored.
|
| on_replace(self, sig)
| Handler called when the task is replaced.
|
| Must return super().on_replace(sig) when overriding to ensure the task replacement
| is properly handled.
|
| .. versionadded:: 5.3
|
| Arguments:
| sig (Signature): signature to replace with.
|
| on_retry(self, exc, task_id, args, kwargs, einfo)
| Retry handler.
|
| This is run by the worker when the task is to be retried.
|
| Arguments:
| exc (Exception): The exception sent to :meth:`retry`.
| task_id (str): Unique id of the retried task.
| args (Tuple): Original arguments for the retried task.
| kwargs (Dict): Original keyword arguments for the retried task.
| einfo (~billiard.einfo.ExceptionInfo): Exception information.
|
| Returns:
| None: The return value of this handler is ignored.
|
| on_success(self, retval, task_id, args, kwargs)
| Success handler.
|
| Run by the worker if the task executes successfully.
|
| Arguments:
| retval (Any): The return value of the task.
| task_id (str): Unique id of the executed task.
| args (Tuple): Original arguments for the executed task.
| kwargs (Dict): Original keyword arguments for the executed task.
|
| Returns:
| None: The return value of this handler is ignored.
|
| pop_request(self)
|
| push_request(self, *args, **kwargs)
|
| replace(self, sig)
| Replace this task, with a new task inheriting the task id.
|
| Execution of the host task ends immediately and no subsequent statements
| will be run.
|
| .. versionadded:: 4.0
|
| Arguments:
| sig (Signature): signature to replace with.
| visitor (StampingVisitor): Visitor API object.
|
| Raises:
| ~@Ignore: This is always raised when called in asynchronous context.
| It is best to always use ``return self.replace(...)`` to convey
| to the reader that the task won't continue after being replaced.
|
| retry(self, args=None, kwargs=None, exc=None, throw=True, eta=None, countdown=None, max_retries=None, **options)
| Retry the task, adding it to the back of the queue.
|
| Example:
| >>> from imaginary_twitter_lib import Twitter
| >>> from proj.celery import app
|
| >>> @app.task(bind=True)
| ... def tweet(self, auth, message):
| ... twitter = Twitter(oauth=auth)
| ... try:
| ... twitter.post_status_update(message)
| ... except twitter.FailWhale as exc:
| ... # Retry in 5 minutes.
| ... raise self.retry(countdown=60 * 5, exc=exc)
|
| Note:
| Although the task will never return above as `retry` raises an
| exception to notify the worker, we use `raise` in front of the
| retry to convey that the rest of the block won't be executed.
|
| Arguments:
| args (Tuple): Positional arguments to retry with.
| kwargs (Dict): Keyword arguments to retry with.
| exc (Exception): Custom exception to report when the max retry
| limit has been exceeded (default:
| :exc:`~@MaxRetriesExceededError`).
|
| If this argument is set and retry is called while
| an exception was raised (``sys.exc_info()`` is set)
| it will attempt to re-raise the current exception.
|
| If no exception was raised it will raise the ``exc``
| argument provided.
| countdown (float): Time in seconds to delay the retry for.
| eta (~datetime.datetime): Explicit time and date to run the
| retry at.
| max_retries (int): If set, overrides the default retry limit for
| this execution. Changes to this parameter don't propagate to
| subsequent task retry attempts. A value of :const:`None`,
| means "use the default", so if you want infinite retries you'd
| have to set the :attr:`max_retries` attribute of the task to
| :const:`None` first.
| time_limit (int): If set, overrides the default time limit.
| soft_time_limit (int): If set, overrides the default soft
| time limit.
| throw (bool): If this is :const:`False`, don't raise the
| :exc:`~@Retry` exception, that tells the worker to mark
| the task as being retried. Note that this means the task
| will be marked as failed if the task raises an exception,
| or successful if it returns after the retry call.
| **options (Any): Extra options to pass on to :meth:`apply_async`.
|
| Raises:
|
| celery.exceptions.Retry:
| To tell the worker that the task has been re-sent for retry.
| This always happens, unless the `throw` keyword argument
| has been explicitly set to :const:`False`, and is considered
| normal operation.
|
| run(self, *args, **kwargs)
| The body of the task executed by workers.
|
| s(self, *args, **kwargs)
| Create signature.
|
| Shortcut for ``.s(*a, **k) -> .signature(a, k)``.
|
| send_event(self, type_, retry=True, retry_policy=None, **fields)
| Send monitoring event message.
|
| This can be used to add custom event types in :pypi:`Flower`
| and other monitors.
|
| Arguments:
| type_ (str): Type of event, e.g. ``"task-failed"``.
|
| Keyword Arguments:
| retry (bool): Retry sending the message
| if the connection is lost. Default is taken from the
| :setting:`task_publish_retry` setting.
| retry_policy (Mapping): Retry settings. Default is taken
| from the :setting:`task_publish_retry_policy` setting.
| **fields (Any): Map containing information about the event.
| Must be JSON serializable.
|
| shadow_name(self, args, kwargs, options)
| Override for custom task name in worker logs/monitoring.
|
| Example:
| .. code-block:: python
|
| from celery.utils.imports import qualname
|
| def shadow_name(task, args, kwargs, options):
| return qualname(args[0])
|
| @app.task(shadow_name=shadow_name, serializer='pickle')
| def apply_function_async(fun, *args, **kwargs):
| return fun(*args, **kwargs)
|
| Arguments:
| args (Tuple): Task positional arguments.
| kwargs (Dict): Task keyword arguments.
| options (Dict): Task execution options.
|
| si(self, *args, **kwargs)
| Create immutable signature.
|
| Shortcut for ``.si(*a, **k) -> .signature(a, k, immutable=True)``.
|
| signature(self, args=None, *starargs, **starkwargs)
| Create signature.
|
| Returns:
| :class:`~celery.signature`: object for
| this task, wrapping arguments and execution options
| for a single task invocation.
|
| signature_from_request(self, request=None, args=None, kwargs=None, queue=None, **extra_options)
|
| starmap(self, it)
| Create a :class:`~celery.canvas.xstarmap` task from ``it``.
|
| start_strategy(self, app, consumer, **kwargs)
|
| subtask = signature(self, args=None, *starargs, **starkwargs)
|
| subtask_from_request = signature_from_request(self, request=None, args=None, kwargs=None, queue=None, **extra_options)
|
| update_state(self, task_id=None, state=None, meta=None, **kwargs)
| Update task state.
|
| Arguments:
| task_id (str): Id of the task to update.
| Defaults to the id of the current task.
| state (str): New state.
| meta (Dict): State meta-data.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| add_around(attr, around)
|
| annotate()
|
| bind(app)
|
| on_bound(app)
| Called when the task is bound to an app.
|
| Note:
| This class method can be defined to do additional actions when
| the task class is bound to an app.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| request
| Get current request object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| backend
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MaxRetriesExceededError = <class 'celery.exceptions.MaxRetriesExceeded...
| The tasks max restart limit has been exceeded.
|
|
| OperationalError = <class 'kombu.exceptions.OperationalError'>
| Recoverable message transport connection error.
|
|
| Request = 'celery.worker.request:Request'
|
| Strategy = 'celery.worker.strategy:default'
|
| __bound__ = True
|
| __trace__ = None
|
| __v2_compat__ = False
|
| abstract = True
|
| acks_late = False
|
| acks_on_failure_or_timeout = True
|
| app = <Celery default>
| Celery application.
|
| Arguments:
| main (str): Name of the main module if running as `__main__`.
| This is used as the prefix for auto-generated task names.
|
| Keyword Arguments:
| broker (str): URL of the default broker used.
| backend (Union[str, Type[celery.backends.base.Backend]]):
| The result store backend class, or the name of the backend
| class to use.
|
| Default is the value of the :setting:`result_backend` setting.
| autofinalize (bool): If set to False a :exc:`RuntimeError`
| will be raised if the task registry or tasks are used before
| the app is finalized.
| set_as_current (bool): Make this the global current app.
| include (List[str]): List of modules every worker should import.
|
| amqp (Union[str, Type[AMQP]]): AMQP object or class name.
| events (Union[str, Type[celery.app.events.Events]]): Events object or
| class name.
| log (Union[str, Type[Logging]]): Log object or class name.
| control (Union[str, Type[celery.app.control.Control]]): Control object
| or class name.
| tasks (Union[str, Type[TaskRegistry]]): A task registry, or the name of
| a registry class.
| fixups (List[str]): List of fix-up plug-ins (e.g., see
| :mod:`celery.fixups.django`).
| config_source (Union[str, class]): Take configuration from a class,
| or object. Attributes may include any settings described in
| the documentation.
| task_cls (Union[str, Type[celery.app.task.Task]]): base task class to
| use. See :ref:`this section <custom-task-cls-app-wide>` for usage.
|
|
| default_retry_delay = 180
|
| expires = None
|
| from_config = (('serializer', 'task_serializer'), ('rate_limit', 'task...
|
| ignore_result = False
|
| max_retries = 3
|
| name = None
|
| priority = None
|
| rate_limit = None
|
| reject_on_worker_lost = None
|
| request_stack = <celery.utils.threads._LocalStack object>
|
| resultrepr_maxsize = 1024
|
| send_events = True
|
| serializer = 'json'
|
| soft_time_limit = None
|
| store_errors_even_if_ignored = False
|
| throws = ()
|
| time_limit = None
|
| track_started = False
|
| trail = True
|
| typing = True
celery.VERSION
Python Library Documentation: version_info_t in module celery object
class version_info_t(builtins.tuple)
| version_info_t(major, minor, micro, releaselevel, serial)
|
| version_info_t(major, minor, micro, releaselevel, serial)
|
| Method resolution order:
| version_info_t
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.version_info_t
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.version_info_t
| Return a nicely formatted representation string
|
| _asdict(self) from collections.version_info_t
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.version_info_t
| Return a new version_info_t object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.version_info_t
| Make a new version_info_t object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, major, minor, micro, releaselevel, serial) from namedtuple_version_info_t.version_info_t
| Create new instance of version_info_t(major, minor, micro, releaselevel, serial)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| major
| Alias for field number 0
|
| minor
| Alias for field number 1
|
| micro
| Alias for field number 2
|
| releaselevel
| Alias for field number 3
|
| serial
| Alias for field number 4
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| _field_defaults = {}
|
| _fields = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
celery.VERSION_BANNER
Error rendering doc: No Python documentation found for '5.6.3 (recovery)'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
celery.bugreport
Python Library Documentation: function bugreport in module celery.app
bugreport(app=None)
Return information useful in bug reports.
celery.chain
Python Library Documentation: class chain in module celery.canvas
class chain(_chain)
| chain(*tasks, **kwargs)
|
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
| Method resolution order:
| chain
| _chain
| Signature
| builtins.dict
| builtins.object
|
| Static methods defined here:
|
| __new__(cls, *tasks, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from _chain:
|
| __call__(self, *args, **kwargs)
| Call the task directly (in the current process).
|
| __init__(self, *tasks, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __repr__(self)
| Return repr(self).
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| apply_async(self, args=None, kwargs=None, **options)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| clone(self, *args, **kwargs)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| prepare_steps(self, args, kwargs, tasks, root_id=None, parent_id=None, link_error=None, app=None, last_task_id=None, group_id=None, chord_body=None, clone=True, from_dict=<bound method Signature.from_dict of <class 'celery.canvas.Signature'>>, group_index=None)
| Prepare the chain for execution.
|
| To execute a chain, we first need to unpack it correctly.
| During the unpacking, we might encounter other chains, groups, or chords
| which we need to unpack as well.
|
| For example:
| chain(signature1, chain(signature2, signature3)) --> Upgrades to chain(signature1, signature2, signature3)
| chain(group(signature1, signature2), signature3) --> Upgrades to chord([signature1, signature2], signature3)
|
| The responsibility of this method is to ensure that the chain is
| correctly unpacked, and then the correct callbacks are set up along the way.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| tasks (List[Signature]): The tasks of the chain.
| root_id (str): The id of the root task.
| parent_id (str): The id of the parent task.
| link_error (Union[List[Signature], Signature]): The error callback.
| will be set for all tasks in the chain.
| app (Celery): The Celery app instance.
| last_task_id (str): The id of the last task in the chain.
| group_id (str): The id of the group that the chain is a part of.
| chord_body (Signature): The body of the chord, used to synchronize with the chain's
| last task and the chord's body when used together.
| clone (bool): Whether to clone the chain's tasks before modifying them.
| from_dict (Callable): A function that takes a dict and returns a Signature.
|
| Returns:
| Tuple[List[Signature], List[AsyncResult]]: The frozen tasks of the chain, and the async results
|
| run(self, args=None, kwargs=None, group_id=None, chord=None, task_id=None, link=None, link_error=None, publisher=None, producer=None, root_id=None, parent_id=None, app=None, group_index=None, **options)
| Executes the chain.
|
| Responsible for executing the chain in the correct order.
| In a case of a chain of a single task, the task is executed directly
| and the result is returned for that task specifically.
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| unchain_tasks(self)
| Return a list of tasks in the chain.
|
| The tasks list would be cloned from the chain's tasks.
| All of the chain callbacks would be added to the last task in the (cloned) chain.
| All of the tasks would be linked to the same error callback
| as the chain itself, to ensure that the correct error callback is called
| if any of the (cloned) tasks of the chain fail.
|
| ----------------------------------------------------------------------
| Class methods inherited from _chain:
|
| from_dict(d, app=None)
| Create a new signature from a dict.
| Subclasses can override this method to customize how are
| they created from a dict.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _chain:
|
| app
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _chain:
|
| tasks = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __reduce__(self)
| Helper for pickle.
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| link(self, callback)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, errback)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| set_immutable(self, immutable)
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| id = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| immutable = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| kwargs = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| options = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| parent_id = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| root_id = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| subtask_type = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| task = <class 'celery.canvas.chain'>
| Chain tasks together.
|
| Each tasks follows one another,
| by being applied as a callback of the previous task.
|
| Note:
| If called with only one argument, then that argument must
| be an iterable of tasks to chain: this allows us
| to use generator expressions.
|
| Example:
| This is effectively :math:`((2 + 2) + 4)`:
|
| .. code-block:: pycon
|
| >>> res = chain(add.s(2, 2), add.s(4))()
| >>> res.get()
| 8
|
| Calling a chain will return the result of the last task in the chain.
| You can get to the other tasks by following the ``result.parent``'s:
|
| .. code-block:: pycon
|
| >>> res.parent.get()
| 4
|
| Using a generator expression:
|
| .. code-block:: pycon
|
| >>> lazy_chain = chain(add.s(i) for i in range(10))
| >>> res = lazy_chain(3)
|
| Arguments:
| *tasks (Signature): List of task signatures to chain.
| If only one argument is passed and that argument is
| an iterable, then that'll be used as the list of signatures
| to chain instead. This means that you can use a generator
| expression.
|
| Returns:
| ~celery.chain: A lazy signature that can be called to apply the first
| task in the chain. When that task succeeds the next task in the
| chain is applied, and so on.
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.chord
Python Library Documentation: class _chord in module celery.canvas
class _chord(Signature)
| _chord(header, body=None, task='celery.chord', args=None, kwargs=None, app=None, **options)
|
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
| Method resolution order:
| _chord
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __call__(self, body=None, **options)
| Call the task directly (in the current process).
|
| __init__(self, header, body=None, task='celery.chord', args=None, kwargs=None, app=None, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| __length_hint__(self)
| Return the number of tasks in this chord's header (recursively).
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __repr__(self)
| Return repr(self).
|
| apply(self, args=None, kwargs=None, propagate=True, body=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| apply_async(self, args=None, kwargs=None, task_id=None, producer=None, publisher=None, connection=None, router=None, result_cls=None, **options)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| clone(self, *args, **kwargs)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| link(self, callback)
| Links a callback to the chord body only.
|
| link_error(self, errback)
| Links an error callback to the chord body, and potentially the header as well.
|
| Note:
| The ``task_allow_error_cb_on_chord_header`` setting controls whether
| error callbacks are allowed on the header. If this setting is
| ``False`` (the current default), then the error callback will only be
| applied to the body.
|
| run(self, header, body, partial_args, app=None, interval=None, countdown=1, max_retries=None, eager=False, task_id=None, kwargs=None, **options)
| Execute the chord.
|
| Executing the chord means executing the header and sending the
| result to the body. In case of an empty header, the body is
| executed immediately.
|
| Arguments:
| header (group): The header to execute.
| body (Signature): The body to execute.
| partial_args (tuple): Arguments to pass to the header.
| app (Celery): The Celery app instance.
| interval (float): The interval between retries.
| countdown (int): The countdown between retries.
| max_retries (int): The maximum number of retries.
| task_id (str): The task id to use for the body.
| kwargs (dict): Keyword arguments to pass to the header.
| options (dict): Options to pass to the header.
|
| Returns:
| AsyncResult: The result of the body (with the result of the header in the parent of the body).
|
| set_immutable(self, immutable)
| Sets the immutable flag on the chord header only.
|
| Note:
| Does not affect the chord body.
|
| Arguments:
| immutable (bool): The new mutability value for chord header.
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_dict(d, app=None)
| Create a chord signature from a dictionary that represents a chord.
|
| Example:
| >>> chord_dict = {
| "task": "celery.chord",
| "args": [],
| "kwargs": {
| "kwargs": {},
| "header": [
| {
| "task": "add",
| "args": [
| 1,
| 2
| ],
| "kwargs": {},
| "options": {},
| "subtask_type": None,
| "immutable": False
| },
| {
| "task": "add",
| "args": [
| 3,
| 4
| ],
| "kwargs": {},
| "options": {},
| "subtask_type": None,
| "immutable": False
| }
| ],
| "body": {
| "task": "xsum",
| "args": [],
| "kwargs": {},
| "options": {},
| "subtask_type": None,
| "immutable": False
| }
| },
| "options": {},
| "subtask_type": "chord",
| "immutable": False
| }
| >>> chord_sig = chord.from_dict(chord_dict)
|
| Iterates over the given tasks in the dictionary and convert them to signatures.
| Chord header needs to be defined in d['kwargs']['header'] as a sequence
| of tasks.
| Chord body needs to be defined in d['kwargs']['body'] as a single task.
|
| The tasks themselves can be dictionaries or signatures (or both).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| app
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| body = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| tasks = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __reduce__(self)
| Helper for pickle.
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| id = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| immutable = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| kwargs = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| options = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| parent_id = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| root_id = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| subtask_type = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| task = <class 'celery.canvas._chord'>
| Barrier synchronization primitive.
|
| A chord consists of a header and a body.
|
| The header is a group of tasks that must complete before the callback is
| called. A chord is essentially a callback for a group of tasks.
|
| The body is applied with the return values of all the header
| tasks as a list.
|
| Example:
|
| The chord:
|
| .. code-block:: pycon
|
| >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
|
| is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
|
| .. code-block:: pycon
|
| >>> res.get()
| 12
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.chunks
Python Library Documentation: class chunks in module celery.canvas
class chunks(Signature)
| chunks(task, it, n, **options)
|
| Partition of tasks into chunks of size n.
|
| Method resolution order:
| chunks
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __call__(self, **options)
| Call the task directly (in the current process).
|
| __init__(self, task, it, n, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| apply_async(self, args=None, kwargs=None, **opts)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| group(self)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| apply_chunks(task, it, n, app=None)
|
| from_dict(d, app=None)
| Create a new signature from a dict.
| Subclasses can override this method to customize how are
| they created from a dict.
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| link(self, callback)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, errback)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| set_immutable(self, immutable)
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| app
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| id = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| immutable = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| kwargs = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| options = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| parent_id = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| root_id = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| subtask_type = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| task = <class 'celery.canvas.chunks'>
| Partition of tasks into chunks of size n.
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.current_app
Python Library Documentation: Proxy in module celery.app.base
<Celery default>
Celery application.
Arguments:
main (str): Name of the main module if running as `__main__`.
This is used as the prefix for auto-generated task names.
Keyword Arguments:
broker (str): URL of the default broker used.
backend (Union[str, Type[celery.backends.base.Backend]]):
The result store backend class, or the name of the backend
class to use.
Default is the value of the :setting:`result_backend` setting.
autofinalize (bool): If set to False a :exc:`RuntimeError`
will be raised if the task registry or tasks are used before
the app is finalized.
set_as_current (bool): Make this the global current app.
include (List[str]): List of modules every worker should import.
amqp (Union[str, Type[AMQP]]): AMQP object or class name.
events (Union[str, Type[celery.app.events.Events]]): Events object or
class name.
log (Union[str, Type[Logging]]): Log object or class name.
control (Union[str, Type[celery.app.control.Control]]): Control object
or class name.
tasks (Union[str, Type[TaskRegistry]]): A task registry, or the name of
a registry class.
fixups (List[str]): List of fix-up plug-ins (e.g., see
:mod:`celery.fixups.django`).
config_source (Union[str, class]): Take configuration from a class,
or object. Attributes may include any settings described in
the documentation.
task_cls (Union[str, Type[celery.app.task.Task]]): base task class to
use. See :ref:`this section <custom-task-cls-app-wide>` for usage.
celery.current_task
Python Library Documentation: Proxy object class Proxy(builtins.object) | Proxy(local, args=None, kwargs=None, name=None, __doc__=None) | | Proxy to another object. | | Methods defined here: | | __abs__(self) from celery.local.Proxy | | __add__(self, other) from celery.local.Proxy | | __and__(self, other) from celery.local.Proxy | | __bool__(self) from celery.local.Proxy | | __call__(self, *a, **kw) from celery.local.Proxy | Call self as a function. | | __coerce__(self, other) from celery.local.Proxy | | __complex__(self) from celery.local.Proxy | | __contains__(self, i) from celery.local.Proxy | | __delattr__(self, name) from celery.local.Proxy | Implement delattr(self, name). | | __delitem__(self, key) from celery.local.Proxy | | __dir__(self) from celery.local.Proxy | Default dir() implementation. | | __div__(self, other) from celery.local.Proxy | | __divmod__(self, other) from celery.local.Proxy | | __enter__(self) from celery.local.Proxy | | __eq__(self, other) from celery.local.Proxy | Return self==value. | | __exit__(self, *a, **kw) from celery.local.Proxy | | __float__(self) from celery.local.Proxy | | __floordiv__(self, other) from celery.local.Proxy | | __ge__(self, other) from celery.local.Proxy | Return self>=value. | | __getattr__(self, name) from celery.local.Proxy | | __getitem__(self, i) from celery.local.Proxy | | __gt__(self, other) from celery.local.Proxy | Return self>value. | | __hash__(self) from celery.local.Proxy | Return hash(self). | | __hex__(self) from celery.local.Proxy | | __index__(self) from celery.local.Proxy | | __init__(self, local, args=None, kwargs=None, name=None, __doc__=None) from celery.local.Proxy | Initialize self. See help(type(self)) for accurate signature. | | __int__(self) from celery.local.Proxy | | __invert__(self) from celery.local.Proxy | | __iter__(self) from celery.local.Proxy | | __le__(self, other) from celery.local.Proxy | Return self<=value. | | __len__(self) from celery.local.Proxy | | __lshift__(self, other) from celery.local.Proxy | | __lt__(self, other) from celery.local.Proxy | Return self<value. | | __mod__(self, other) from celery.local.Proxy | | __mul__(self, other) from celery.local.Proxy | | __ne__(self, other) from celery.local.Proxy | Return self!=value. | | __neg__(self) from celery.local.Proxy | | __nonzero__ = __bool__(self) | | __oct__(self) from celery.local.Proxy | | __or__(self, other) from celery.local.Proxy | Return self|value. | | __pos__(self) from celery.local.Proxy | | __pow__(self, other) from celery.local.Proxy | | __reduce__(self) from celery.local.Proxy | Helper for pickle. | | __repr__(self) from celery.local.Proxy | Return repr(self). | | __rshift__(self, other) from celery.local.Proxy | | __setattr__(self, name, value) from celery.local.Proxy | Implement setattr(self, name, value). | | __setitem__(self, key, value) from celery.local.Proxy | | __str__(self) from celery.local.Proxy | Return str(self). | | __sub__(self, other) from celery.local.Proxy | | __truediv__(self, other) from celery.local.Proxy | | __xor__(self, other) from celery.local.Proxy | | ---------------------------------------------------------------------- | Readonly properties defined here: | | __class__ | | __dict__
celery.group
Python Library Documentation: class group in module celery.canvas
class group(Signature)
| group(*tasks, **options)
|
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
| Method resolution order:
| group
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __call__(self, *partial_args, **options)
| Call the task directly (in the current process).
|
| __init__(self, *tasks, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| __len__(self)
| Return len(self).
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __repr__(self)
| Return repr(self).
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| apply_async(self, args=None, kwargs=None, add_to_parent=True, producer=None, link=None, link_error=None, **options)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| link(self, sig)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, sig)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| set_immutable(self, immutable)
|
| skew(self, start=1.0, stop=None, step=1.0)
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_dict(d, app=None)
| Create a group signature from a dictionary that represents a group.
|
| Example:
| >>> group_dict = {
| "task": "celery.group",
| "args": [],
| "kwargs": {
| "tasks": [
| {
| "task": "add",
| "args": [
| 1,
| 2
| ],
| "kwargs": {},
| "options": {},
| "subtask_type": None,
| "immutable": False
| },
| {
| "task": "add",
| "args": [
| 3,
| 4
| ],
| "kwargs": {},
| "options": {},
| "subtask_type": None,
| "immutable": False
| }
| ]
| },
| "options": {},
| "subtask_type": "group",
| "immutable": False
| }
| >>> group_sig = group.from_dict(group_dict)
|
| Iterates over the given tasks in the dictionary and convert them to signatures.
| Tasks needs to be defined in d['kwargs']['tasks'] as a sequence
| of tasks.
|
| The tasks themselves can be dictionaries or signatures (or both).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| app
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| tasks = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __reduce__(self)
| Helper for pickle.
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| id = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| immutable = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| kwargs = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| options = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| parent_id = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| root_id = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| subtask_type = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| task = <class 'celery.canvas.group'>
| Creates a group of tasks to be executed in parallel.
|
| A group is lazy so you must call it to take action and evaluate
| the group.
|
| Note:
| If only one argument is passed, and that argument is an iterable
| then that'll be used as the list of tasks instead: this
| allows us to use ``group`` with generator expressions.
|
| Example:
| >>> lazy_group = group([add.s(2, 2), add.s(4, 4)])
| >>> promise = lazy_group() # <-- evaluate: returns lazy result.
| >>> promise.get() # <-- will wait for the task to return
| [4, 8]
|
| Arguments:
| *tasks (List[Signature]): A list of signatures that this group will
| call. If there's only one argument, and that argument is an
| iterable, then that'll define the list of signatures instead.
| **options (Any): Execution options applied to all tasks
| in the group.
|
| Returns:
| ~celery.group: signature that when called will then call all of the
| tasks in the group (and return a :class:`GroupResult` instance
| that can be used to inspect the state of the group).
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.local
Python Library Documentation: module celery.local in celery
NAME
celery.local - Proxy/PromiseProxy implementation.
DESCRIPTION
This module contains critical utilities that needs to be loaded as
soon as possible, and that shall not load any third party modules.
Parts of this module is Copyright by Werkzeug Team.
CLASSES
builtins.object
Proxy
PromiseProxy
class PromiseProxy(Proxy)
| PromiseProxy(local, args=None, kwargs=None, name=None, __doc__=None)
|
| Proxy that evaluates object once.
|
| :class:`Proxy` will evaluate the object each time, while the
| promise will only evaluate it once.
|
| Method resolution order:
| PromiseProxy
| Proxy
| builtins.object
|
| Methods defined here:
|
| __evaluate__(self, _clean=('_Proxy__local', '_Proxy__args', '_Proxy__kwargs'))
|
| __evaluated__(self)
|
| __maybe_evaluate__(self)
|
| __then__(self, fun, *args, **kwargs)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __pending__
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from Proxy:
|
| __abs__(self) from Proxy
|
| __add__(self, other) from Proxy
|
| __and__(self, other) from Proxy
|
| __bool__(self) from Proxy
|
| __call__(self, *a, **kw) from Proxy
| Call self as a function.
|
| __coerce__(self, other) from Proxy
|
| __complex__(self) from Proxy
|
| __contains__(self, i) from Proxy
|
| __delattr__(self, name) from Proxy
| Implement delattr(self, name).
|
| __delitem__(self, key) from Proxy
|
| __dir__(self) from Proxy
| Default dir() implementation.
|
| __div__(self, other) from Proxy
|
| __divmod__(self, other) from Proxy
|
| __enter__(self) from Proxy
|
| __eq__(self, other) from Proxy
| Return self==value.
|
| __exit__(self, *a, **kw) from Proxy
|
| __float__(self) from Proxy
|
| __floordiv__(self, other) from Proxy
|
| __ge__(self, other) from Proxy
| Return self>=value.
|
| __getattr__(self, name) from Proxy
|
| __getitem__(self, i) from Proxy
|
| __gt__(self, other) from Proxy
| Return self>value.
|
| __hash__(self) from Proxy
| Return hash(self).
|
| __hex__(self) from Proxy
|
| __index__(self) from Proxy
|
| __init__(self, local, args=None, kwargs=None, name=None, __doc__=None) from Proxy
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self) from Proxy
|
| __invert__(self) from Proxy
|
| __iter__(self) from Proxy
|
| __le__(self, other) from Proxy
| Return self<=value.
|
| __len__(self) from Proxy
|
| __lshift__(self, other) from Proxy
|
| __lt__(self, other) from Proxy
| Return self<value.
|
| __mod__(self, other) from Proxy
|
| __mul__(self, other) from Proxy
|
| __ne__(self, other) from Proxy
| Return self!=value.
|
| __neg__(self) from Proxy
|
| __nonzero__ = __bool__(self)
|
| __oct__(self) from Proxy
|
| __or__(self, other) from Proxy
| Return self|value.
|
| __pos__(self) from Proxy
|
| __pow__(self, other) from Proxy
|
| __reduce__(self) from Proxy
| Helper for pickle.
|
| __repr__(self) from Proxy
| Return repr(self).
|
| __rshift__(self, other) from Proxy
|
| __setattr__(self, name, value) from Proxy
| Implement setattr(self, name, value).
|
| __setitem__(self, key, value) from Proxy
|
| __str__(self) from Proxy
| Return str(self).
|
| __sub__(self, other) from Proxy
|
| __truediv__(self, other) from Proxy
|
| __xor__(self, other) from Proxy
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Proxy:
|
| __class__
|
| __dict__
class Proxy(builtins.object)
| Proxy(local, args=None, kwargs=None, name=None, __doc__=None)
|
| Proxy to another object.
|
| Methods defined here:
|
| __abs__(self) from Proxy
|
| __add__(self, other) from Proxy
|
| __and__(self, other) from Proxy
|
| __bool__(self) from Proxy
|
| __call__(self, *a, **kw) from Proxy
| Call self as a function.
|
| __coerce__(self, other) from Proxy
|
| __complex__(self) from Proxy
|
| __contains__(self, i) from Proxy
|
| __delattr__(self, name) from Proxy
| Implement delattr(self, name).
|
| __delitem__(self, key) from Proxy
|
| __dir__(self) from Proxy
| Default dir() implementation.
|
| __div__(self, other) from Proxy
|
| __divmod__(self, other) from Proxy
|
| __enter__(self) from Proxy
|
| __eq__(self, other) from Proxy
| Return self==value.
|
| __exit__(self, *a, **kw) from Proxy
|
| __float__(self) from Proxy
|
| __floordiv__(self, other) from Proxy
|
| __ge__(self, other) from Proxy
| Return self>=value.
|
| __getattr__(self, name) from Proxy
|
| __getitem__(self, i) from Proxy
|
| __gt__(self, other) from Proxy
| Return self>value.
|
| __hash__(self) from Proxy
| Return hash(self).
|
| __hex__(self) from Proxy
|
| __index__(self) from Proxy
|
| __init__(self, local, args=None, kwargs=None, name=None, __doc__=None) from Proxy
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self) from Proxy
|
| __invert__(self) from Proxy
|
| __iter__(self) from Proxy
|
| __le__(self, other) from Proxy
| Return self<=value.
|
| __len__(self) from Proxy
|
| __lshift__(self, other) from Proxy
|
| __lt__(self, other) from Proxy
| Return self<value.
|
| __mod__(self, other) from Proxy
|
| __mul__(self, other) from Proxy
|
| __ne__(self, other) from Proxy
| Return self!=value.
|
| __neg__(self) from Proxy
|
| __nonzero__ = __bool__(self)
|
| __oct__(self) from Proxy
|
| __or__(self, other) from Proxy
| Return self|value.
|
| __pos__(self) from Proxy
|
| __pow__(self, other) from Proxy
|
| __reduce__(self) from Proxy
| Helper for pickle.
|
| __repr__(self) from Proxy
| Return repr(self).
|
| __rshift__(self, other) from Proxy
|
| __setattr__(self, name, value) from Proxy
| Implement setattr(self, name, value).
|
| __setitem__(self, key, value) from Proxy
|
| __str__(self) from Proxy
| Return str(self).
|
| __sub__(self, other) from Proxy
|
| __truediv__(self, other) from Proxy
|
| __xor__(self, other) from Proxy
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| __class__
|
| __dict__
FUNCTIONS
maybe_evaluate(obj)
Attempt to evaluate promise, even if obj is not a promise.
try_import(module, default=None)
Try to import and return module.
Returns None if the module does not exist.
DATA
__all__ = ('Proxy', 'PromiseProxy', 'try_import', 'maybe_evaluate')
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\celery\local.py
celery.maybe_patch_concurrency
Python Library Documentation: function maybe_patch_concurrency in module celery
maybe_patch_concurrency(argv=None, short_opts=None, long_opts=None, patches=None)
Apply eventlet/gevent monkeypatches.
With short and long opt alternatives that specify the command line
option to set the pool, this makes sure that anything that needs
to be patched is completed as early as possible.
(e.g., eventlet/gevent monkey patches).
celery.maybe_signature
Python Library Documentation: function maybe_signature in module celery.canvas
maybe_signature(d, app=None, clone=False)
Ensure obj is a signature, or None.
Arguments:
d (Optional[Union[abstract.CallableSignature, Mapping]]):
Signature or dict-serialized signature.
app (celery.Celery):
App to bind signature to.
clone (bool):
If d' is already a signature, the signature
will be cloned when this flag is enabled.
Returns:
Optional[abstract.CallableSignature]
celery.signature
Python Library Documentation: function signature in module celery.canvas
signature(varies, *args, **kwargs)
Create new signature.
- if the first argument is a signature already then it's cloned.
- if the first argument is a dict, then a Signature version is returned.
Returns:
Signature: The resulting signature.
celery.uuid
Python Library Documentation: function uuid in module kombu.utils.uuid
uuid(_uuid: 'Callable[[], UUID]' = <function uuid4 at 0x00000195D9913EC0>) -> 'str'
Generate unique id in UUID4 format.
See Also
--------
For now this is provided by :func:`uuid.uuid4`.
celery.version_info
Python Library Documentation: version_info_t in module celery object
class version_info_t(builtins.tuple)
| version_info_t(major, minor, micro, releaselevel, serial)
|
| version_info_t(major, minor, micro, releaselevel, serial)
|
| Method resolution order:
| version_info_t
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.version_info_t
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.version_info_t
| Return a nicely formatted representation string
|
| _asdict(self) from collections.version_info_t
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.version_info_t
| Return a new version_info_t object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.version_info_t
| Make a new version_info_t object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, major, minor, micro, releaselevel, serial) from namedtuple_version_info_t.version_info_t
| Create new instance of version_info_t(major, minor, micro, releaselevel, serial)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| major
| Alias for field number 0
|
| minor
| Alias for field number 1
|
| micro
| Alias for field number 2
|
| releaselevel
| Alias for field number 3
|
| serial
| Alias for field number 4
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| _field_defaults = {}
|
| _fields = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
celery.version_info_t
Python Library Documentation: class version_info_t in module celery
class version_info_t(builtins.tuple)
| version_info_t(major, minor, micro, releaselevel, serial)
|
| version_info_t(major, minor, micro, releaselevel, serial)
|
| Method resolution order:
| version_info_t
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.version_info_t
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.version_info_t
| Return a nicely formatted representation string
|
| _asdict(self) from collections.version_info_t
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.version_info_t
| Return a new version_info_t object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.version_info_t
| Make a new version_info_t object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, major, minor, micro, releaselevel, serial) from namedtuple_version_info_t.version_info_t
| Create new instance of version_info_t(major, minor, micro, releaselevel, serial)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| major
| Alias for field number 0
|
| minor
| Alias for field number 1
|
| micro
| Alias for field number 2
|
| releaselevel
| Alias for field number 3
|
| serial
| Alias for field number 4
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| _field_defaults = {}
|
| _fields = ('major', 'minor', 'micro', 'releaselevel', 'serial')
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
celery.xmap
Python Library Documentation: class xmap in module celery.canvas
class xmap(_basemap)
| xmap(task, it, **options)
|
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
| Method resolution order:
| xmap
| _basemap
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from _basemap:
|
| __init__(self, task, it, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| apply_async(self, args=None, kwargs=None, **opts)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| ----------------------------------------------------------------------
| Class methods inherited from _basemap:
|
| from_dict(d, app=None)
| Create a new signature from a dict.
| Subclasses can override this method to customize how are
| they created from a dict.
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __call__(self, *partial_args, **partial_kwargs)
| Call the task directly (in the current process).
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __reduce__(self)
| Helper for pickle.
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| link(self, callback)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, errback)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| set_immutable(self, immutable)
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| app
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| id = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| immutable = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| kwargs = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| options = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| parent_id = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| root_id = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| subtask_type = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| task = <class 'celery.canvas.xmap'>
| Map operation for tasks.
|
| Note:
| Tasks executed sequentially in process, this is not a
| parallel operation like :class:`group`.
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
celery.xstarmap
Python Library Documentation: class xstarmap in module celery.canvas
class xstarmap(_basemap)
| xstarmap(task, it, **options)
|
| Map operation for tasks, using star arguments.
|
| Method resolution order:
| xstarmap
| _basemap
| Signature
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from _basemap:
|
| __init__(self, task, it, **options)
| Initialize self. See help(type(self)) for accurate signature.
|
| apply_async(self, args=None, kwargs=None, **opts)
| Apply this task asynchronously.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged
| with existing options.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| See also:
| :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
|
| ----------------------------------------------------------------------
| Class methods inherited from _basemap:
|
| from_dict(d, app=None)
| Create a new signature from a dict.
| Subclasses can override this method to customize how are
| they created from a dict.
|
| ----------------------------------------------------------------------
| Methods inherited from Signature:
|
| __call__(self, *partial_args, **partial_kwargs)
| Call the task directly (in the current process).
|
| __deepcopy__(self, memo)
|
| __invert__(self)
|
| __ior__(self, other)
| Return self|=value.
|
| __json__(self)
|
| __or__(self, other)
| Chaining operator.
|
| Example:
| >>> add.s(2, 2) | add.s(4) | add.s(8)
|
| Returns:
| chain: Constructs a :class:`~celery.canvas.chain` of the given signatures.
|
| __reduce__(self)
| Helper for pickle.
|
| append_to_list_option(self, key, value)
| Appends the given value to the list at the given key in self.options.
|
| apply(self, args=None, kwargs=None, **options)
| Call task locally.
|
| Same as :meth:`apply_async` but executed the task inline instead
| of sending a task message.
|
| clone(self, args=None, kwargs=None, **opts)
| Create a copy of this signature.
|
| Arguments:
| args (Tuple): Partial args to be prepended to the existing args.
| kwargs (Dict): Partial kwargs to be merged with existing kwargs.
| options (Dict): Partial options to be merged with
| existing options.
|
| delay(self, *partial_args, **partial_kwargs)
| Shortcut to :meth:`apply_async` using star arguments.
|
| election(self)
|
| extend_list_option(self, key, value)
| Extends the list at the given key in self.options with the given value.
|
| If the value is not a list, it will be converted to one.
|
| flatten_links(self)
| Return a recursive list of dependencies.
|
| "unchain" if you will, but with links intact.
|
| freeze(self, _id=None, group_id=None, chord=None, root_id=None, parent_id=None, group_index=None)
| Finalize the signature by adding a concrete task id.
|
| The task won't be called and you shouldn't call the signature
| twice after freezing it as that'll result in two task messages
| using the same task id.
|
| The arguments are used to override the signature's headers during
| freezing.
|
| Arguments:
| _id (str): Task id to use if it didn't already have one.
| New UUID is generated if not provided.
| group_id (str): Group id to use if it didn't already have one.
| chord (Signature): Chord body when freezing a chord header.
| root_id (str): Root id to use.
| parent_id (str): Parent id to use.
| group_index (int): Group index to use.
|
| Returns:
| ~@AsyncResult: promise of future evaluation.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| link(self, callback)
| Add callback task to be applied if this task succeeds.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| link_error(self, errback)
| Add callback task to be applied on error in task execution.
|
| Returns:
| Signature: the argument passed, for chaining
| or use with :func:`~functools.reduce`.
|
| on_error(self, errback)
| Version of :meth:`link_error` that supports chaining.
|
| on_error chains the original signature, not the errback so::
|
| >>> add.s(2, 2).on_error(errback.s()).delay()
|
| calls the ``add`` task, not the ``errback`` task, but the
| reverse is true for :meth:`link_error`.
|
| partial = clone(self, args=None, kwargs=None, **opts)
|
| replace(self, args=None, kwargs=None, options=None)
| Replace the args, kwargs or options set for this signature.
|
| These are only replaced if the argument for the section is
| not :const:`None`.
|
| reprcall(self, *args, **kwargs)
| Return a string representation of the signature.
|
| Merges the given arguments with the signature's arguments
| only for the purpose of generating the string representation.
| The signature itself is not modified.
|
| Example:
| >>> add.s(2, 2).reprcall()
| 'add(2, 2)'
|
| set(self, immutable=None, **options)
| Set arbitrary execution options (same as ``.options.update(…)``).
|
| Returns:
| Signature: This is a chaining method call
| (i.e., it will return ``self``).
|
| set_immutable(self, immutable)
|
| stamp(self, visitor=None, append_stamps=False, **headers)
| Stamp this signature with additional custom headers.
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| .. versionadded:: 5.3
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| stamp_links(self, visitor, append_stamps=False, **headers)
| Stamp this signature links (callbacks and errbacks).
| Using a visitor will pass on responsibility for the stamping
| to the visitor.
|
| Arguments:
| visitor (StampingVisitor): Visitor API object.
| append_stamps (bool):
| If True, duplicated stamps will be appended to a list.
| If False, duplicated stamps will be replaced by the last stamp.
| headers (Dict): Stamps that should be added to headers.
|
| ----------------------------------------------------------------------
| Class methods inherited from Signature:
|
| register_type(name=None)
| Register a new type of signature.
| Used as a class decorator, for example:
| >>> @Signature.register_type()
| >>> class mysig(Signature):
| >>> pass
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Signature:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Signature:
|
| AsyncResult
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| app
|
| type
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Signature:
|
| TYPES = {'chain': <class 'celery.canvas._chain'>, 'chord': <class 'cel...
|
| args = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| id = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| immutable = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| kwargs = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| options = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| parent_id = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| root_id = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| subtask_type = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| task = <class 'celery.canvas.xstarmap'>
| Map operation for tasks, using star arguments.
|
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None