MCPcopy
hub / github.com/celery/celery / apply_async

Method apply_async

celery/canvas.py:369–400  ·  view source on GitHub ↗

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

(self, args=None, kwargs=None, route_name=None, **options)

Source from the content-addressed store, hash-verified

367 return self.type.apply(args, kwargs, **options)
368
369 def apply_async(self, args=None, kwargs=None, route_name=None, **options):
370 """Apply this task asynchronously.
371
372 Arguments:
373 args (Tuple): Partial args to be prepended to the existing args.
374 kwargs (Dict): Partial kwargs to be merged with existing kwargs.
375 options (Dict): Partial options to be merged
376 with existing options.
377
378 Returns:
379 ~@AsyncResult: promise of future evaluation.
380
381 See also:
382 :meth:`~@Task.apply_async` and the :ref:`guide-calling` guide.
383 """
384 args = args if args else ()
385 kwargs = kwargs if kwargs else {}
386 # Extra options set to None are dismissed
387 options = {k: v for k, v in options.items() if v is not None}
388 try:
389 _apply = self._apply_async
390 except IndexError: # pragma: no cover
391 # no tasks for chain, etc to find type
392 return
393 # For callbacks: extra args are prepended to the stored args.
394 if args or kwargs or options:
395 args, kwargs, options = self._merge(args, kwargs, options)
396 else:
397 args, kwargs, options = self.args, self.kwargs, self.options
398 # pylint: disable=too-many-function-args
399 # Works on this, as it's a property
400 return _apply(args, kwargs, **options)
401
402 def _merge(self, args=None, kwargs=None, options=None, force=False):
403 """Merge partial args/kwargs/options with existing ones.

Callers 2

delayMethod · 0.95
__invert__Method · 0.95

Calls 2

_mergeMethod · 0.95
itemsMethod · 0.45

Tested by

no test coverage detected