-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Replacing a task with a chain which contains a group now returns a result instead of hanging #9604
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
base: main
Are you sure you want to change the base?
Conversation
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.
may be we should also add some unit test for this?
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #9604 +/- ##
==========================================
- Coverage 78.51% 78.50% -0.01%
==========================================
Files 153 153
Lines 19127 19129 +2
Branches 2533 2534 +1
==========================================
Hits 15018 15018
+ Misses 3821 3820 -1
- Partials 288 291 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@Nusnus boss, need some help here, can you point me where exactly to adjust the unit test for this :D forgot many thing |
Integration tests and docker build failures are not related to this specific pr |
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.
@Nusnus boss, need some help here, can you point me where exactly to adjust the unit test for this :D forgot many thing
Np, I got your back!
Check this: https://github.com/celery/celery/blob/main/t/unit/tasks/test_canvas.py
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.
Pull Request Overview
This PR fixes a hanging task by ensuring that a chain containing a group returns a result by appending the accumulate callback appropriately.
- Introduces a new task (replace_with_chain_which_contains_a_group) that wraps a chain with a group.
- Updates tests in t/integration/test_canvas.py to validate the new behavior.
- Adjusts celery/app/task.py to append the accumulate callback when a chain’s final task is a group.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
t/integration/test_canvas.py | Adds test for replacing a task with a chain that contains a group. |
t/integration/tasks.py | Introduces the new task replace_with_chain_which_contains_a_group. |
celery/app/task.py | Updates the replace method to attach the accumulate callback to groups in chains. |
Comments suppressed due to low confidence (1)
t/integration/tasks.py:157
- [nitpick] The function name 'replace_with_chain_which_contains_a_group' is quite lengthy; consider simplifying it to 'replace_with_chain_containing_group' for improved readability.
def replace_with_chain_which_contains_a_group(self):
Description
The following task
did not return a result. This PR fixes the issue and now a result is returned correctly instead of hanging until timeout occurs.