Repository navigation
Complete a chord whose header chain ends in a group - #11186
Open
ChristianMurphy wants to merge 4 commits into
Open
ChristianMurphy wants to merge 4 commits into
ChristianMurphy wants to merge 4 commits into
Conversation
On the cache, DynamoDB and GCS backends such a chord stayed pending since celery#11072. The header entry of a chain that ends in a group is the group. Before a chord completes, the backend checks that every header result is stored, and it looked for one under the id of the group: the tasks of the group return to the chord, each with its own result. The backend now looks at the tasks of a group in the header: for the check, for the size of the chord when the request has none, for the part keys it deletes and for the results it expires when the chord completes. Also build the request in test_chord_expires as a worker does: it failed against memcached since celery#11072.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11186 +/- ##
=======================================
Coverage 91.82% 91.83%
=======================================
Files 153 153
Lines 22314 22323 +9
Branches 2798 2800 +2
=======================================
+ Hits 20490 20500 +10
Misses 1529 1529
+ Partials 295 294 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Every other chord of test_random_chords now puts some header tasks in groups, up to two levels deep, so returns, kills, concurrent returns, retries and a lost group are checked for those headers too.
A header chain ending in a group alone, with 30 tasks, with a chain or a group in the group, with a failing task, and with a task of the group that returns twice.
This branch has not been deployed
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.
Note: Before submitting this pull request, please review our contributing
guidelines & Anti AI spamming Guidelines. Before opening an AI based PR make sure you asked
in the discussion forum or in the related open issues first.
Description
This fixes a regression from #11072 (mine), which I found while reviewing #11176. It is not in a release.
On the cache, DynamoDB and GCS result backends, a chord whose header has a chain that ends in a group stays
PENDING:The header entry of that chain is the group. Since #11072 the backend checks that every header result is stored before it completes the chord, and it looked for one under the id of the group. The tasks of the group return to the chord, each with its own result, and nothing is stored under the group's id.
With memcached 1.6 and a Redis broker:
chain(a, group(b, c)), alone or next to another task, fast or slow tasksPENDING, 20 of 20PENDING, 3 of 3PENDING, 3 of 3PENDING, 3 of 3With this change the backend looks at the tasks of a group in the header. That goes for the check before completion, for the size of the chord when the request has none, for the part keys it deletes and for the results it expires when the chord completes. Flat headers go through the same code as before.
Why #11072 missed it
Every test and every run for #11072 used a flat header, and the new check is only right for a flat header.
test_chord_expiresin it has failed since Complete a chord once on the cache, DynamoDB and GCS backends #11072, and one run of that file would have shown it.What is different this time
Not changed, and the same before #11072: when the chain fails before it reaches its group, the chord stays
PENDING.One thing to know for an upgrade, now in the docs notes: while a 5.7.0 worker and a worker with #11072 share a chord with a group in its header, about half of them stayed
PENDINGand a few ran the body twice. Flat chords were fine.Test details
t/unit/backends/test_chord_parts.py. One of them counts calls of_complete_chord_once. The body runs either way, so the call count is the only thing that shows the chord is sized by its tasks.test_chord_expiresint/integration/test_cache_backend.pybuilds its request by hand withoutignore_result. It now builds it as a worker does.t/unit/backends,t/unit/tasks/test_chord.pyandt/unit/tasks/test_canvas.pyas tox runs them (python -bb): the same five tests fail on main and here, none in this change.