Skip to content

task_replace chord inside chord fix (fixes #4368) - #4369

Merged
auvipy merged 5 commits into
celery:masterfrom
zpl:task_replace_chord_fix
Jan 14, 2018
Merged

auvipy merged 5 commits into
celery:masterfrom
zpl:task_replace_chord_fix

Conversation

@zpl

@zpl zpl commented Nov 6, 2017

Copy link
Copy Markdown
Contributor

Fixes #4368

Sorry, but I have no time to write unit tests, could someone help? Thanks.

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

could you also add testcase to verify the changes?

@thedrow

thedrow commented Nov 12, 2017

Copy link
Copy Markdown
Contributor

What's the difference between the old code and the new code?

@zpl

zpl commented Nov 13, 2017

Copy link
Copy Markdown
Contributor Author

The problem is that sig.freeze doesn't set group_id and chord for new task.

that's we need to call sig.set before

@thedrow

thedrow commented Nov 23, 2017

Copy link
Copy Markdown
Contributor

I don't understand why the call tofreeze() was removed in that case.

@thedrow

thedrow commented Dec 12, 2017

Copy link
Copy Markdown
Contributor

@zpl ping?

@zpl

zpl commented Dec 12, 2017

Copy link
Copy Markdown
Contributor Author

@thedrow, plz double check. it's NOT removed. it's replaced to

sig.freeze(self.request.id)

so it's replaced to sig.set + sig.freeze

because sig.freeze don't store state for sig

@AlexHill

AlexHill commented Dec 13, 2017 •

Copy link
Copy Markdown
Contributor

Looking at the code for chord.freeze() this makes sense. Signature.freeze() sets some keys of self.options from its arguments, whereas chord.freeze() doesn't.

The case where a nested chord's body is replaced still doesn't work with this patch, and it would be nice to fix that too. I can write tests for this.

@thedrow

thedrow commented Dec 13, 2017

Copy link
Copy Markdown
Contributor

Thank you very much. I'm assigning the issue to you. You should be able to push to this branch. :)

@AlexHill AlexHill added this to the v4.2 milestone Dec 14, 2017
@AlexHill AlexHill mentioned this pull request Dec 14, 2017
@AlexHill

Copy link
Copy Markdown
Contributor

I've rebased this, added tests and made sure the fix applies to replaced bodies as well as header tasks. @zpl can you test to make sure your case is still fixed please?

@thedrow

thedrow commented Dec 16, 2017

Copy link
Copy Markdown
Contributor

@AlexHill Can you please address the lint and test failures?

@AlexHill

Copy link
Copy Markdown
Contributor

Yep. I've just added some integration tests for add_to_chord since that's changed in this PR as well.

Comment thread celery/app/task.py
@@ -846,20 +846,20 @@ def replace(self, sig):

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.

The branch above is never entered during the test suite, i.e. 'chord' in sig.options is never true. I think this makes sense - for it to be true, we'd have to be replacing a task in a chord with another task that is a part of a different chord. I'm not sure how that would work - it might be worth just raising an exception in this branch rather than having this undefined untested behaviour in there.

@thedrow

thedrow commented Dec 16, 2017

Copy link
Copy Markdown
Contributor

Also when tests are added to a PR please remove the Needs Test Coverage label.

@codecov

codecov Bot commented Dec 16, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #4369 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4369      +/-   ##
==========================================
+ Coverage   82.46%   82.49%   +0.02%     
==========================================
  Files         140      140              
  Lines       15873    15872       -1     
  Branches     1983     1982       -1     
==========================================
+ Hits        13090    13093       +3     
+ Misses       2583     2580       -3     
+ Partials      200      199       -1
Impacted Files Coverage Δ
celery/app/task.py 96.57% <100%> (+1.12%) ⬆️

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 5eba340...9263795. Read the comment docs.

@zpl

zpl commented Dec 16, 2017

Copy link
Copy Markdown
Contributor Author

@zpl can you test to make sure your case is still fixed please?

@AlexHill, Thanks for your work. I will test it at monday and write results. thanks.

@thedrow

thedrow commented Jan 3, 2018

Copy link
Copy Markdown
Contributor

@AlexHill @zpl This PR needs to be rebased.

@zpl Did you get the chance to test this?

@auvipy auvipy modified the milestones: v4.2, v5.0.0 Jan 13, 2018
@AlexHill

Copy link
Copy Markdown
Contributor

I've rebased and added the exception I described above, plus an accompanying test. Would be good if this could sneak into 4.2.

@auvipy auvipy removed this from the v5.0.0 milestone Jan 14, 2018
@auvipy auvipy added this to the v4.2 milestone Jan 14, 2018
@auvipy
auvipy merged commit 442f42b into celery:master Jan 14, 2018
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.

4 participants