-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Conversation
Fix for bug report: #8387. backend.get_task_meta ignores the result_extended config parameter in mongodb backend
Codecov ReportPatch coverage:
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
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@@ -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({ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can check this file https://github.com/celery/celery/blob/main/t/unit/backends/test_mongodb.py and other back end tests in https://github.com/celery/celery/blob/main/t/unit/backends/ folder
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can check this file https://github.com/celery/celery/blob/main/t/unit/backends/test_mongodb.py and other back end tests in https://github.com/celery/celery/blob/main/t/unit/backends/ folder
Added test method test_get_task_meta_for_result_extended.
thanks lets wait for the CI |
So did it pas CI processing? Is there anything else that I have to do? |
CI is passing |
thanks |
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