Gather the results of all tasks as a list in order. Note: This can be an expensive operation for result store backends that must resort to polling (e.g., database). You should consider using :meth:`join_native` if your backend supports it.
(self, timeout=None, propagate=True, interval=0.5,
callback=None, no_ack=True, on_message=None,
disable_sync_subtasks=True, on_interval=None)
| 712 | ) |
| 713 | |
| 714 | def join(self, timeout=None, propagate=True, interval=0.5, |
| 715 | callback=None, no_ack=True, on_message=None, |
| 716 | disable_sync_subtasks=True, on_interval=None): |
| 717 | """Gather the results of all tasks as a list in order. |
| 718 | |
| 719 | Note: |
| 720 | This can be an expensive operation for result store |
| 721 | backends that must resort to polling (e.g., database). |
| 722 | |
| 723 | You should consider using :meth:`join_native` if your backend |
| 724 | supports it. |
| 725 | |
| 726 | Warning: |
| 727 | Waiting for tasks within a task may lead to deadlocks. |
| 728 | Please see :ref:`task-synchronous-subtasks`. |
| 729 | |
| 730 | Arguments: |
| 731 | timeout (float): The number of seconds to wait for results |
| 732 | before the operation times out. |
| 733 | propagate (bool): If any of the tasks raises an exception, |
| 734 | the exception will be re-raised when this flag is set. |
| 735 | interval (float): Time to wait (in seconds) before retrying to |
| 736 | retrieve a result from the set. Note that this does not have |
| 737 | any effect when using the amqp result store backend, |
| 738 | as it does not use polling. |
| 739 | callback (Callable): Optional callback to be called for every |
| 740 | result received. Must have signature ``(task_id, value)`` |
| 741 | No results will be returned by this function if a callback |
| 742 | is specified. The order of results is also arbitrary when a |
| 743 | callback is used. To get access to the result object for |
| 744 | a particular id you'll have to generate an index first: |
| 745 | ``index = {r.id: r for r in gres.results.values()}`` |
| 746 | Or you can create new result objects on the fly: |
| 747 | ``result = app.AsyncResult(task_id)`` (both will |
| 748 | take advantage of the backend cache anyway). |
| 749 | no_ack (bool): Automatic message acknowledgment (Note that if this |
| 750 | is set to :const:`False` then the messages |
| 751 | *will not be acknowledged*). |
| 752 | disable_sync_subtasks (bool): Disable tasks to wait for sub tasks |
| 753 | this is the default configuration. CAUTION do not enable this |
| 754 | unless you must. |
| 755 | |
| 756 | Raises: |
| 757 | celery.exceptions.TimeoutError: if ``timeout`` isn't |
| 758 | :const:`None` and the operation takes longer than ``timeout`` |
| 759 | seconds. |
| 760 | """ |
| 761 | if disable_sync_subtasks: |
| 762 | assert_will_not_block() |
| 763 | time_start = time.monotonic() |
| 764 | remaining = None |
| 765 | |
| 766 | if on_message is not None: |
| 767 | raise ImproperlyConfigured( |
| 768 | 'Backend does not support on_message callback') |
| 769 | |
| 770 | results = [] |
| 771 | for result in self.results: |
no test coverage detected