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)
| 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. |
no test coverage detected