Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backend.get_task_meta ignores the result_extended config parameter in mongodb backend #8391

Merged
merged 6 commits into from
Jul 28, 2023

Conversation

ycc140
Copy link
Contributor

@ycc140 ycc140 commented Jul 25, 2023

Fix for bug report: #8387.

backend.get_task_meta ignores the result_extended config parameter in mongodb backend

Note: Before submitting this pull request, please review our contributing
guidelines
.

Description

Fix for bug report: #8387.

backend.get_task_meta ignores the result_extended config parameter in mongodb backend
@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1c36387) 87.07% compared to head (f2b6efb) 87.07%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8391   +/-   ##
=======================================
  Coverage   87.07%   87.07%           
=======================================
  Files         148      148           
  Lines       18492    18494    +2     
  Branches     3152     3153    +1     
=======================================
+ Hits        16102    16104    +2     
  Misses       2110     2110           
  Partials      280      280           
Flag Coverage Δ
unittests 87.04% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
celery/backends/mongodb.py 98.77% <100.00%> (+0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -197,6 +197,21 @@ def _get_task_meta_for(self, task_id):
"""Get task meta-data for a task by id."""
obj = self.collection.find_one({'_id': task_id})
if obj:
if self.app.conf.find_value_for_key('extended', 'result'):
return self.meta_from_decoded({
Copy link
Member

Choose a reason for hiding this comment

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

we will need full unit test coverage for this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Being a newbie here I have no idea how to write a unit test for this. The only tests that I could find was in the pytest-celery repo but I could not figure out where to do a pull request for the test coverage.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointers. I have added a new test case, It works on my laptop :-)

Reformatted code with correct indentation.
@@ -197,6 +197,21 @@ def _get_task_meta_for(self, task_id):
"""Get task meta-data for a task by id."""
obj = self.collection.find_one({'_id': task_id})
if obj:
if self.app.conf.find_value_for_key('extended', 'result'):
return self.meta_from_decoded({
Copy link
Member

Choose a reason for hiding this comment

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

@auvipy
Copy link
Member

auvipy commented Jul 26, 2023

thanks lets wait for the CI

@ycc140
Copy link
Contributor Author

ycc140 commented Jul 27, 2023

So did it pas CI processing? Is there anything else that I have to do?

@auvipy
Copy link
Member

auvipy commented Jul 28, 2023

CI is passing

@auvipy auvipy added this to the 5.3.x milestone Jul 28, 2023
@auvipy auvipy changed the title Update mongodb.py Fix backend.get_task_meta ignores the result_extended config parameter in mongodb backend Jul 28, 2023
@auvipy auvipy merged commit 7c55890 into celery:main Jul 28, 2023
28 checks passed
@auvipy
Copy link
Member

auvipy commented Jul 28, 2023

thanks

asukero added a commit to asukero/celery that referenced this pull request Aug 11, 2023
Nusnus pushed a commit that referenced this pull request Aug 16, 2023
…mongo backend (#8432)

* Fix #8431: Set format_date to False when calling _get_result_meta on mongo backend

* Add testcase on _get_result_meta format_date for PR #8391

* #8432 : Fix lint error E721
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