Skip to content

Use task_serializer for doing roundtrip serialization for eager tasks#5342

Merged
auvipy merged 2 commits intocelery:masterfrom
bjackson:eager-serialization
Feb 17, 2019
Merged

Use task_serializer for doing roundtrip serialization for eager tasks#5342
auvipy merged 2 commits intocelery:masterfrom
bjackson:eager-serialization

Conversation

@bjackson
Copy link
Contributor

Description

Fixes #5133
When doing the roundtrip serialization for eager tasks, the task serializer will always be JSON unless the serializer argument is present in the call to Task.apply_async. If the serializer argument is present but is 'pickle', an exception will be raised as pickle-serialized objects cannot be deserialized without specifying to serialization.loads what content types should be accepted. The Producer's serializer seems to be set to None, causing the default to JSON serialization.

This PR will continue using (in order) the serializer argument to Task.apply_async, if present, or the Producer's serializer if not None. If the Producer's serializer is None, it will use the Celery app's task_serializer configuration entry as the serializer.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great if you could add a test for this!

@bjackson
Copy link
Contributor Author

I'll add one.

@codecov
Copy link

codecov bot commented Feb 16, 2019

Codecov Report

Merging #5342 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5342   +/-   ##
=======================================
  Coverage   83.56%   83.56%           
=======================================
  Files         143      143           
  Lines       16335    16335           
  Branches     2030     2030           
=======================================
  Hits        13651    13651           
  Misses       2481     2481           
  Partials      203      203
Impacted Files Coverage Δ
celery/app/task.py 96.56% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9149285...326006a. Read the comment docs.

@auvipy auvipy merged commit 76d1045 into celery:master Feb 17, 2019
@auvipy auvipy added this to the v4.3 milestone Feb 17, 2019
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
…celery#5342)

* Use task_serializer for doing roundtrip serialization for eager tasks

* Add test for serialization settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants