Skip to content

Commit

Permalink
fix: Ensure group tasks are deeply deserialised
Browse files Browse the repository at this point in the history
Fixes #6341
  • Loading branch information
maybe-sybr committed Sep 16, 2020
1 parent 9ae20f8 commit 63d7558
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion celery/canvas.py
Expand Up @@ -1028,8 +1028,9 @@ class group(Signature):

@classmethod
def from_dict(cls, d, app=None):
tasks = [maybe_signature(task) for task in d["kwargs"]["tasks"]]
return _upgrade(
d, group(d['kwargs']['tasks'], app=app, **d['options']),
d, group(tasks, app=app, **d['options']),
)

def __init__(self, *tasks, **options):
Expand Down
4 changes: 0 additions & 4 deletions t/unit/tasks/test_canvas.py
Expand Up @@ -633,15 +633,13 @@ def test_from_dict(self):
x['args'] = None
assert group.from_dict(dict(x))

@pytest.mark.xfail(reason="#6341")
def test_from_dict_deep_deserialize(self):
original_group = group([self.add.s(1, 2)] * 42)
serialized_group = json.loads(json.dumps(original_group))
deserialized_group = group.from_dict(serialized_group)
for ds_task in deserialized_group.tasks:
assert isinstance(ds_task, Signature)

@pytest.mark.xfail(reason="#6341")
def test_from_dict_deeper_deserialize(self):
inner_group = group([self.add.s(1, 2)] * 42)
outer_group = group([inner_group] * 42)
Expand Down Expand Up @@ -859,7 +857,6 @@ def test_from_dict_deep_deserialize(self):
assert isinstance(task, Signature)
assert isinstance(deserialized_chord.body, Signature)

@pytest.mark.xfail(reason="#6341")
def test_from_dict_deep_deserialize_group(self):
header = body = group([self.add.s(1, 2)]* 42)
original_chord = chord(header=header, body=body)
Expand All @@ -874,7 +871,6 @@ def test_from_dict_deep_deserialize_group(self):
for task in deserialized_chord.body.tasks:
assert isinstance(task, Signature)

@pytest.mark.xfail(reason="#6341")
def test_from_dict_deeper_deserialize_group(self):
inner_group = group([self.add.s(1, 2)] * 42)
header = body = group([inner_group] * 42)
Expand Down

0 comments on commit 63d7558

Please sign in to comment.