Skip to content

fix: Chord counting of group children - #6733

Merged
thedrow merged 4 commits into
masterfrom
fix/group-child-chord-counting
Apr 28, 2021
Merged

thedrow merged 4 commits into
masterfrom
fix/group-child-chord-counting

Conversation

@maybe-sybr

@maybe-sybr maybe-sybr commented Apr 19, 2021 •

Copy link
Copy Markdown
Contributor

Description

Fixes #6721

This PR fixes the faulty chord counting reported in #6721, as well as an edge case where the tail task of a chain being counted for chord size could be an empty group (or other zero sized thing).

@maybe-sybr

Copy link
Copy Markdown
Contributor Author

I have to duck out for a bit, but I still need to run the MRTC from #6721 with this change and also add it to the integration test suite. FWICT this diff is enough to fix the issue, may need some massaging to be mergable.

@codecov

codecov Bot commented Apr 19, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #6733 (445c1b7) into master (230c9ac) will increase coverage by 0.09%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6733      +/-   ##
==========================================
+ Coverage   70.51%   70.60%   +0.09%     
==========================================
  Files         138      138              
  Lines       16499    16501       +2     
  Branches     2066     2066              
==========================================
+ Hits        11634    11651      +17     
+ Misses       4665     4655      -10     
+ Partials      200      195       -5     
Flag Coverage Δ
unittests 70.60% <87.50%> (+0.09%) ⬆️

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

Impacted Files Coverage Δ
celery/canvas.py 94.82% <87.50%> (+1.95%) ⬆️

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 230c9ac...445c1b7. Read the comment docs.

@lgtm-com

lgtm-com Bot commented Apr 19, 2021

Copy link
Copy Markdown

This pull request introduces 2 alerts and fixes 2 when merging e989a7b into 8ebcce1 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Unnecessary 'else' clause in loop

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Module is imported with 'import' and 'import from'

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

changes look good to me, can you also add an integration test for this?

@thedrow thedrow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've left some comments and questions.

Comment thread celery/canvas.py Resolved
Comment thread celery/canvas.py Resolved
Comment thread celery/canvas.py Resolved
Comment thread celery/canvas.py Resolved
@maybe-sybr
maybe-sybr force-pushed the fix/group-child-chord-counting branch from e989a7b to dbf7cff Compare April 19, 2021 08:22
Comment thread t/integration/test_canvas.py Resolved
@lgtm-com

lgtm-com Bot commented Apr 19, 2021

Copy link
Copy Markdown

This pull request introduces 2 alerts when merging dbf7cff into 8ebcce1 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Unnecessary 'else' clause in loop

@auvipy
auvipy self-requested a review April 19, 2021 09:18
@maybe-sybr

Copy link
Copy Markdown
Contributor Author

pypy3 failure is that bool/event confusion again. Unrelated to this diff AFAICT

@maybe-sybr
maybe-sybr force-pushed the fix/group-child-chord-counting branch from dbf7cff to e14f095 Compare April 19, 2021 23:21
@maybe-sybr

Copy link
Copy Markdown
Contributor Author

@mjhoffman65 if you have time to look over this changeset wrt evolution from the changes we added in #6576 which were needed for executing tasks from generators, it'd be appreciated :)

@lgtm-com

lgtm-com Bot commented Apr 19, 2021

Copy link
Copy Markdown

This pull request introduces 1 alert when merging e14f095 into 8ebcce1 - view on LGTM.com

new alerts:

  • 1 for Unnecessary 'else' clause in loop

This will allow us to call it from other code in this module which needs
to accurately count chord sizes.
This change ensures that we only have one piece of code which calculates
chord sizes (ie. `_chord._descend()`, recently made protected so other
canvas classes can use it as required). By doing so, we fix some edge
cases in the chord counting logic which was being used for children of
groups, and also add some unit tests to capture those cases and their
expected behaviours.

This change also introduces an integration test which checks the current
behaviour of chains used as chord bodies when nested in groups. Due to
some misbehaviour, likely with promise fulfillment, the `GroupResult`
object will time out unless all of its children are resolved prior to
`GroupResult` being joined (specifically, native joins block forever or
until timeout). This misbehaviour is tracked by #6734 and the test in
not marked as `xfail`ing to ensure that the current janky behaviour
continues to work as expected rather than regressing.
@maybe-sybr
maybe-sybr force-pushed the fix/group-child-chord-counting branch from e14f095 to 445c1b7 Compare April 27, 2021 02:09
@maybe-sybr

Copy link
Copy Markdown
Contributor Author

Labelling this as a blocker since it's needed to fix some of the behaviours tested in #6746

@maybe-sybr

Copy link
Copy Markdown
Contributor Author

I think this should be good to go now, @thedrow

@lgtm-com

lgtm-com Bot commented Apr 27, 2021

Copy link
Copy Markdown

This pull request introduces 1 alert and fixes 2 when merging 445c1b7 into 230c9ac - view on LGTM.com

new alerts:

  • 1 for Unnecessary 'else' clause in loop

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Unused import

jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
* improv: Deconflict `chord` class and kwarg names

* improv: Make `chord.descend` protected not private

This will allow us to call it from other code in this module which needs
to accurately count chord sizes.

* fix: Counting of chord-chain tails of zero tasks

* fix: Chord counting of group children

This change ensures that we only have one piece of code which calculates
chord sizes (ie. `_chord._descend()`, recently made protected so other
canvas classes can use it as required). By doing so, we fix some edge
cases in the chord counting logic which was being used for children of
groups, and also add some unit tests to capture those cases and their
expected behaviours.

This change also introduces an integration test which checks the current
behaviour of chains used as chord bodies when nested in groups. Due to
some misbehaviour, likely with promise fulfillment, the `GroupResult`
object will time out unless all of its children are resolved prior to
`GroupResult` being joined (specifically, native joins block forever or
until timeout). This misbehaviour is tracked by celery#6734 and the test in
not marked as `xfail`ing to ensure that the current janky behaviour
continues to work as expected rather than regressing.
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.

5.1.0b1 chord of chains dont work

4 participants