Skip to main content

GroupResult

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.

Attributes

AttributeTypeDescription
idstr = nullThe UUID of the group.
resultsSequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = nullList/iterator of results in the group

Constructor

Signature

def GroupResult(
id: str = None,
results: Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = None,
parent: [ResultBase](resultbase.md?sid=celery_result_resultbase) = None,
**kwargs: dict
)

Parameters

NameTypeDescription
idstr = NoneThe unique identifier of the group.
resultsSequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = NoneA list or iterator of result instances belonging to the group.
parent[ResultBase](resultbase.md?sid=celery_result_resultbase) = NoneThe parent result associated with this group.
**kwargsdictAdditional keyword arguments passed to the parent ResultSet class.

Signature

def GroupResult(
id: str = None,
results: Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = None,
parent: [ResultBase](resultbase.md?sid=celery_result_resultbase) = None
) - > null

Parameters

NameTypeDescription
idstr = NoneThe unique UUID of the group.
resultsSequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = NoneA list of result instances belonging to this group.
parent[ResultBase](resultbase.md?sid=celery_result_resultbase) = NoneThe parent result associated with this group, if any.

Methods


save()

@classmethod
def save(
backend: [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None
) - > any

Save group-result for later retrieval using :meth:restore.

Parameters

NameTypeDescription
backend[Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = NoneThe result backend to use for persistence; defaults to the application backend.

Returns

TypeDescription
anyThe result of the backend's save operation.

delete()

@classmethod
def delete(
backend: [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None
) - > null

Remove this result if it was previously saved.

Parameters

NameTypeDescription
backend[Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = NoneThe result backend from which to delete the group data.

Returns

TypeDescription
nullnull

as_tuple()

@classmethod
def as_tuple() - > tuple

Serializes the group result and its hierarchy into a nested tuple structure.

Returns

TypeDescription
tupleA tuple containing the group ID, parent data, and a list of child result tuples.

children()

@classmethod
def children() - > Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)]

Provides access to the list of results contained within the group.

Returns

TypeDescription
Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)]The list of result instances in the group.

restore()

@classmethod
def restore(
id: str,
backend: [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None,
app: [Celery](../app/base/celery.md?sid=celery_app_base_celery) = None
) - > [GroupResult](groupresult.md?sid=celery_result_groupresult)

Restore previously saved group result.

Parameters

NameTypeDescription
idstrThe unique ID of the group to restore.
backend[Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = NoneThe result backend to query; defaults to the application backend.
app[Celery](../app/base/celery.md?sid=celery_app_base_celery) = NoneThe Celery app instance used to resolve the backend.

Returns

TypeDescription
[GroupResult](groupresult.md?sid=celery_result_groupresult)The restored GroupResult instance retrieved from the backend.