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
| Attribute | Type | Description |
|---|---|---|
| id | str = null | The UUID of the group. |
| results | Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = null | List/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
| Name | Type | Description |
|---|---|---|
| id | str = None | The unique identifier of the group. |
| results | Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = None | A list or iterator of result instances belonging to the group. |
| parent | [ResultBase](resultbase.md?sid=celery_result_resultbase) = None | The parent result associated with this group. |
| **kwargs | dict | Additional 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
| Name | Type | Description |
|---|---|---|
| id | str = None | The unique UUID of the group. |
| results | Sequence[[AsyncResult](asyncresult.md?sid=celery_result_asyncresult)] = None | A list of result instances belonging to this group. |
| parent | [ResultBase](resultbase.md?sid=celery_result_resultbase) = None | The 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
| Name | Type | Description |
|---|---|---|
| backend | [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None | The result backend to use for persistence; defaults to the application backend. |
Returns
| Type | Description |
|---|---|
any | The 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
| Name | Type | Description |
|---|---|---|
| backend | [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None | The result backend from which to delete the group data. |
Returns
| Type | Description |
|---|---|
null | null |
as_tuple()
@classmethod
def as_tuple() - > tuple
Serializes the group result and its hierarchy into a nested tuple structure.
Returns
| Type | Description |
|---|---|
tuple | A 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
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| id | str | The unique ID of the group to restore. |
| backend | [Backend](../backends/base/backend.md?sid=celery_backends_base_backend) = None | The result backend to query; defaults to the application backend. |
| app | [Celery](../app/base/celery.md?sid=celery_app_base_celery) = None | The Celery app instance used to resolve the backend. |
Returns
| Type | Description |
|---|---|
[GroupResult](groupresult.md?sid=celery_result_groupresult) | The restored GroupResult instance retrieved from the backend. |