Skip to content

start chord header tasks as soon as possible - #6576

Merged
thedrow merged 8 commits into
celery:masterfrom
mjhoffman65:chord-header-generator
Mar 4, 2021
Merged

thedrow merged 8 commits into
celery:masterfrom
mjhoffman65:chord-header-generator

Conversation

@mjhoffman65

@mjhoffman65 mjhoffman65 commented Jan 4, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #3021 . Previously, header tasks were not submitted to the broker for
execution until the entire generator was consumed.

Continuation of #6112 and much of this was originally pulled from #3043.

Update: this was split into 2 PRs per below review: #6589 should be merged first. This has been rebased on top of that branch.

@lgtm-com

lgtm-com Bot commented Jan 4, 2021

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 2b9524c into 3546059 - view on LGTM.com

new alerts:

  • 1 for Non-exception in 'except' clause

Comment thread celery/canvas.py.1 Resolved
@mjhoffman65
mjhoffman65 force-pushed the chord-header-generator branch from 2b9524c to f049a12 Compare January 4, 2021 20:16

@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.

I must have to say great effort so far, could you check this PR #6542 and split the related part to another PR and after that get merged rebase this and review & test?

@mjhoffman65

mjhoffman65 commented Jan 4, 2021 •

Copy link
Copy Markdown
Contributor Author

I must have to say great effort so far, could you check this PR #6542 and split the related part to another PR and after that get merged rebase this and review & test?

@auvipy Thanks! Just to make sure I understand, split this PR into 2: first one will replace #6542 and include only the _regen changes and the second one will include the rest?

@auvipy

auvipy commented Jan 7, 2021

Copy link
Copy Markdown
Member

I must have to say great effort so far, could you check this PR #6542 and split the related part to another PR and after that get merged rebase this and review & test?

@auvipy Thanks! Just to make sure I understand, split this PR into 2: first one will replace #6542 and include only the _regen changes and the second one will include the rest?

yes.

@auvipy

auvipy commented Jan 7, 2021

Copy link
Copy Markdown
Member

also, check the conflicts please

@thedrow

thedrow commented Jan 10, 2021 •

Copy link
Copy Markdown
Contributor

I think we had another PR for this one, didn't we? @auvipy Oh I see now that you already discussed this 😄
@mjhoffman65 Could you please include those PR numbers in the description as prior art?

@mjhoffman65 Thank you very much for the contribution.
Would you kindly rebase this so I can review?

@mjhoffman65
mjhoffman65 force-pushed the chord-header-generator branch from f049a12 to cd23981 Compare January 11, 2021 20:02
mjhoffman65 added a commit to mjhoffman65/celery that referenced this pull request Jan 11, 2021
Might fix celery#4298.  This was originally part of
celery#6576.
mjhoffman65 added a commit to mjhoffman65/celery that referenced this pull request Jan 11, 2021
Might fix celery#4298.  This was originally part of celery#6576.
@lgtm-com

lgtm-com Bot commented Jan 11, 2021

Copy link
Copy Markdown

This pull request fixes 1 alert when merging cd23981 into eac0c12 - view on LGTM.com

fixed alerts:

  • 1 for Non-exception in 'except' clause

@mjhoffman65
mjhoffman65 force-pushed the chord-header-generator branch from cd23981 to bea1729 Compare January 11, 2021 21:08
@mjhoffman65

Copy link
Copy Markdown
Contributor Author

@auvipy @thedrow Merge conflicts have been resolved and this PR has been split (#6589) as requested.

@mjhoffman65
mjhoffman65 requested a review from auvipy January 11, 2021 21:17
@lgtm-com

lgtm-com Bot commented Jan 11, 2021

Copy link
Copy Markdown

This pull request fixes 2 alerts when merging bea1729 into eac0c12 - view on LGTM.com

fixed alerts:

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

@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 need to review this in detail.
In the meantime, I suspect one thing has to be changed.

Comment thread celery/utils/functional.py Resolved
@mjhoffman65
mjhoffman65 force-pushed the chord-header-generator branch from bea1729 to a4f2116 Compare January 12, 2021 15:56
@mjhoffman65
mjhoffman65 requested a review from thedrow January 12, 2021 15:59
auvipy pushed a commit that referenced this pull request Jan 12, 2021
* Makes regen less greedy

Might fix #4298.  This was originally part of #6576.

* adds assertion to ensure regen item is not lost
@auvipy

auvipy commented Jan 12, 2021

Copy link
Copy Markdown
Member

rebase please

@mjhoffman65
mjhoffman65 force-pushed the chord-header-generator branch from a4f2116 to b6a2696 Compare January 12, 2021 17:40
@mjhoffman65

Copy link
Copy Markdown
Contributor Author

rebase please

👍 rebased

@maybe-sybr

Copy link
Copy Markdown
Contributor

A quick look at the changes to the redis backend make me think that we can't land this in a patch release since it introduces new key dependencies when handling chords in flight.

I'm yet to review in full.

Comment thread celery/canvas.py Resolved
@thedrow

thedrow commented Jan 17, 2021

Copy link
Copy Markdown
Contributor

@maybe-sybr Feel free to move the milestone to 5.1.0 if you deem it necessary.

Comment thread celery/canvas.py Resolved
Comment thread celery/canvas.py Resolved
@thedrow

thedrow commented Feb 28, 2021

Copy link
Copy Markdown
Contributor

@mjhoffman65 If you'd like to contribute more, we can add you to our team.

@auvipy

auvipy commented Mar 2, 2021 •

Copy link
Copy Markdown
Member

@mjhoffman65 If you'd like to contribute more, we can add you to our team.

I think it's still too early.

@lgtm-com

lgtm-com Bot commented Mar 2, 2021

Copy link
Copy Markdown

This pull request fixes 1 alert when merging cdbd8f9 into 5baf972 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

mjhoffman65 and others added 7 commits March 2, 2021 11:17
Fixes celery#3012. Previously, subtasks were not submitted to the broker for
execution until the entire generator was consumed.
Co-authored-by: Omer Katz <[email protected]>
Co-authored-by: Omer Katz <[email protected]>

@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.

Can you please take a look into the test failure?

@lgtm-com

lgtm-com Bot commented Mar 2, 2021

Copy link
Copy Markdown

This pull request fixes 1 alert when merging 1d4e9f9 into e913312 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@codecov

codecov Bot commented Mar 2, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #6576 (79fc219) into master (50ae433) will increase coverage by 0.02%.
The diff coverage is 89.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6576      +/-   ##
==========================================
+ Coverage   70.41%   70.44%   +0.02%     
==========================================
  Files         138      138              
  Lines       16446    16478      +32     
  Branches     2064     2075      +11     
==========================================
+ Hits        11581    11608      +27     
- Misses       4662     4666       +4     
- Partials      203      204       +1     
Flag Coverage Δ
unittests 70.44% <89.69%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
celery/app/task.py 93.81% <ø> (ø)
celery/utils/functional.py 66.07% <60.00%> (+1.43%) ⬆️
celery/canvas.py 92.86% <85.71%> (-0.50%) ⬇️
celery/backends/redis.py 82.99% <95.23%> (-0.29%) ⬇️
celery/backends/base.py 94.85% <100.00%> (+0.03%) ⬆️
celery/backends/cache.py 100.00% <100.00%> (ø)
celery/utils/imports.py 65.51% <0.00%> (+1.14%) ⬆️

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 50ae433...d8d7741. Read the comment docs.

@mjhoffman65

Copy link
Copy Markdown
Contributor Author

Can you please take a look into the test failure?

Should be fixed now

@mjhoffman65

Copy link
Copy Markdown
Contributor Author

@mjhoffman65 If you'd like to contribute more, we can add you to our team.

I think it's still too early.

I'd love to contribute more. No worries about joining the team if it is too early. But let me know what I can help on next.

@mjhoffman65
mjhoffman65 requested a review from thedrow March 2, 2021 15:36

@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.

LGTM. Thank you!

@auvipy

auvipy commented Mar 5, 2021

Copy link
Copy Markdown
Member

thanks a lot to all of you who were involved to make this PR merge <3

@maybe-sybr maybe-sybr mentioned this pull request Apr 13, 2021
4 of 18 tasks
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
* Makes regen less greedy

Might fix celery#4298.  This was originally part of celery#6576.

* adds assertion to ensure regen item is not lost
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
* start chord header tasks as soon as possible

Fixes celery#3012. Previously, subtasks were not submitted to the broker for
execution until the entire generator was consumed.

* Update celery/canvas.py as per review

Co-authored-by: Omer Katz <[email protected]>

* keeps chord_length terminology consistent

* refactors unit test

* Update celery/canvas.py

Co-authored-by: Omer Katz <[email protected]>

* Update celery/canvas.py

Co-authored-by: Omer Katz <[email protected]>

* Fix formatting.

* adds comments and fixes test

Co-authored-by: Asif Saif Uddin <[email protected]>
Co-authored-by: Omer Katz <[email protected]>
Comment thread celery/canvas.py
# We are draining from a geneator here.
tasks1, tasks2 = itertools.tee(self._unroll_tasks(self.tasks))
results = regen(self._freeze_tasks(tasks1, group_id, chord, root_id, parent_id))
self.tasks = regen(x[0] for x in zip(tasks2, results))

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.

Hi @mjhoffman65 , I'm a new project member.
I am trying to understand what you did here, I would appreciate if you could clarify it for me.
I don't get why you zipped tasks2 with results only to get x[0], resulting in a generator with only tasks2's tasks. Why did you write this and not self.tasks = regen(tasks2)?
TIA :)

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.

group and chord: subtasks are not executed until entire generator is consumed

5 participants