|
@@ -815,6 +815,7 @@ class GroupResult(ResultSet):
|
|
|
Arguments:
|
|
|
id (str): The id of the group.
|
|
|
results (Sequence[AsyncResult]): List of result instances.
|
|
|
+ parent (ResultBase): Parent result of this group.
|
|
|
"""
|
|
|
|
|
|
#: The UUID of the group.
|
|
@@ -823,8 +824,9 @@ class GroupResult(ResultSet):
|
|
|
#: List/iterator of results in the group
|
|
|
results = None
|
|
|
|
|
|
- def __init__(self, id=None, results=None, **kwargs):
|
|
|
+ def __init__(self, id=None, results=None, parent=None, **kwargs):
|
|
|
self.id = id
|
|
|
+ self.parent = parent
|
|
|
ResultSet.__init__(self, results, **kwargs)
|
|
|
|
|
|
def save(self, backend=None):
|
|
@@ -853,7 +855,11 @@ class GroupResult(ResultSet):
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
if isinstance(other, GroupResult):
|
|
|
- return other.id == self.id and other.results == self.results
|
|
|
+ return (
|
|
|
+ other.id == self.id and
|
|
|
+ other.results == self.results and
|
|
|
+ other.parent == self.parent
|
|
|
+ )
|
|
|
return NotImplemented
|
|
|
|
|
|
def __ne__(self, other):
|
|
@@ -865,7 +871,7 @@ class GroupResult(ResultSet):
|
|
|
', '.join(r.id for r in self.results))
|
|
|
|
|
|
def as_tuple(self):
|
|
|
- return self.id, [r.as_tuple() for r in self.results]
|
|
|
+ return (self.id, self.parent), [r.as_tuple() for r in self.results]
|
|
|
|
|
|
@property
|
|
|
def children(self):
|
|
@@ -969,13 +975,15 @@ def result_from_tuple(r, app=None):
|
|
|
Result = app.AsyncResult
|
|
|
if not isinstance(r, ResultBase):
|
|
|
res, nodes = r
|
|
|
- if nodes:
|
|
|
- return app.GroupResult(
|
|
|
- res, [result_from_tuple(child, app) for child in nodes],
|
|
|
- )
|
|
|
- # previously didn't include parent
|
|
|
id, parent = res if isinstance(res, (list, tuple)) else (res, None)
|
|
|
if parent:
|
|
|
parent = result_from_tuple(parent, app)
|
|
|
+
|
|
|
+ if nodes:
|
|
|
+ return app.GroupResult(
|
|
|
+ id, [result_from_tuple(child, app) for child in nodes],
|
|
|
+ parent=parent,
|
|
|
+ )
|
|
|
+
|
|
|
return Result(id, parent=parent)
|
|
|
return r
|