Deserialize all tasks in a chain#4015
Merged
auvipy merged 1 commit intocelery:masterfrom Jun 2, 2017
fcoelho:chain-from-dict
Merged
Deserialize all tasks in a chain#4015auvipy merged 1 commit intocelery:masterfrom fcoelho:chain-from-dict
auvipy merged 1 commit intocelery:masterfrom
fcoelho:chain-from-dict
Conversation
When loading a chain that had been fully serialized to json, deserialization
happened only in part of the original task. Specifically, take a
json-serialized task that looks like the following:
{
...,
"kwargs": {
"tasks": [
{...}, {...}, {...}
]
}
}
After calling `celery.signature(that_thing_above)`, we get an object that
actually looks like this:
{
...,
"kwargs": {
"tasks": [
task_1, # an instance of celery.Signature
{...}, {...} # same as before deserialization
]
}
}
The culprit was `chain.from_dict`, which was converting only the first subtask
of the chain to actual `Signature` instances. This commit changes that
behaviour and converts all subtasks to signatures instead. Without this, some
operations on the chain object, such as calling `chain.on_error(...)` would
cause errors of the form `'dict' object has no attribute 'xyz'`.
auvipy
approved these changes
Jun 2, 2017
SebastianBerchtold
pushed a commit
to smartlane/celery
that referenced
this pull request
Jun 11, 2018
When loading a chain that had been fully serialized to json, deserialization
happened only in part of the original task. Specifically, take a
json-serialized task that looks like the following:
{
...,
"kwargs": {
"tasks": [
{...}, {...}, {...}
]
}
}
After calling `celery.signature(that_thing_above)`, we get an object that
actually looks like this:
{
...,
"kwargs": {
"tasks": [
task_1, # an instance of celery.Signature
{...}, {...} # same as before deserialization
]
}
}
The culprit was `chain.from_dict`, which was converting only the first subtask
of the chain to actual `Signature` instances. This commit changes that
behaviour and converts all subtasks to signatures instead. Without this, some
operations on the chain object, such as calling `chain.on_error(...)` would
cause errors of the form `'dict' object has no attribute 'xyz'`.
This was referenced Sep 8, 2020
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When loading a chain that had been fully serialized to json, deserialization
happened only in part of the original task. Specifically, take a
json-serialized task that looks like the following:
After calling
celery.signature(that_thing_above), we get an object thatactually looks like this:
The culprit was
chain.from_dict, which was converting only the first subtaskof the chain to actual
Signatureinstances. This commit changes thatbehaviour and converts all subtasks to signatures instead. Without this, some
operations on the chain object, such as calling
chain.on_error(...)wouldcause errors of the form
'dict' object has no attribute 'xyz'.