MCPcopy
hub / github.com/celery/celery / GroupResult

Class GroupResult

celery/result.py:890–982  ·  view source on GitHub ↗

Like :class:`ResultSet`, but with an associated id. This type is returned by :class:`~celery.group`. It enables inspection of the tasks state and return values as a single entity. Arguments: id (str): The id of the group. results (Sequence[AsyncResult]): List of re

Source from the content-addressed store, hash-verified

888
889@Thenable.register
890class GroupResult(ResultSet):
891 """Like :class:`ResultSet`, but with an associated id.
892
893 This type is returned by :class:`~celery.group`.
894
895 It enables inspection of the tasks state and return values as
896 a single entity.
897
898 Arguments:
899 id (str): The id of the group.
900 results (Sequence[AsyncResult]): List of result instances.
901 parent (ResultBase): Parent result of this group.
902 """
903
904 #: The UUID of the group.
905 id = None
906
907 #: List/iterator of results in the group
908 results = None
909
910 def __init__(self, id=None, results=None, parent=None, **kwargs):
911 self.id = id
912 self.parent = parent
913 super().__init__(results, **kwargs)
914
915 def _on_ready(self):
916 self.backend.remove_pending_result(self)
917 super()._on_ready()
918
919 def save(self, backend=None):
920 """Save group-result for later retrieval using :meth:`restore`.
921
922 Example:
923 >>> def save_and_restore(result):
924 ... result.save()
925 ... result = GroupResult.restore(result.id)
926 """
927 return (backend or self.app.backend).save_group(self.id, self)
928
929 def delete(self, backend=None):
930 """Remove this result if it was previously saved."""
931 (backend or self.app.backend).delete_group(self.id)
932
933 def __reduce__(self):
934 return self.__class__, self.__reduce_args__()
935
936 def __reduce_args__(self):
937 return self.id, self.results
938
939 def __bool__(self):
940 return bool(self.id or self.results)
941 __nonzero__ = __bool__ # Included for Py2 backwards compatibility
942
943 def __eq__(self, other):
944 if isinstance(other, GroupResult):
945 return (
946 other.id == self.id and
947 other.results == self.results and

Callers 2

unlock_chordFunction · 0.85

Calls

no outgoing calls