Skip to content

Chords, get body_type independently to handle cases where body.type does not exist ... - #6847

Merged
auvipy merged 3 commits into
celery:masterfrom
ghoulmaster:master
Jul 9, 2021
Merged

auvipy merged 3 commits into
celery:masterfrom
ghoulmaster:master

Conversation

@ghoulmaster

Copy link
Copy Markdown
Contributor

… due to tasks being created via Signatures

Note: Before submitting this pull request, please review our contributing
guidelines
.

Description

When celery Chords are created by Signatures where the workflow is Task_1+Group+Task_2, when the Task_1 gets executed and moves to start the Chain, if the callback Chord Task_2 does not belong to the same queue as Task_1, body.type does not exist and ends up throwing error as the Task_2 does not belong to Task_1's task list and we end up with a NotRegistered error.

Fixes #6846

…exist due to tasks being created via Signatures
@ghoulmaster ghoulmaster changed the title Chords, get body_type independently to handle cases where body.type does exist ... Chords, get body_type independently to handle cases where body.type does not exist ... Jul 8, 2021
@lgtm-com

lgtm-com Bot commented Jul 8, 2021

Copy link
Copy Markdown

This pull request introduces 2 alerts when merging db2d158 into e885a47 - view on LGTM.com

new alerts:

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

Comment thread celery/backends/base.py Outdated
kwargs['result'] = [r.as_tuple() for r in header_result]
queue = body.options.get('queue', getattr(body.type, 'queue', None))
priority = body.options.get('priority', getattr(body.type, 'priority', 0))
body_type = body.get('type', None)

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.

this change need to be unit test covered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will add unit tests and fix current failing one.

Oddly enough the auto unit tests here fail, yet running on windows 10 via cli the same test passes, even odder if I debug through the test it fails.

I will attempt to resolve all this tonight.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@auvipy Unit tests added to existing test_chord_unlock_queue test. If you want a separate test for this I can split it out. Just let me know!

…tRegistered Error if the app that generated the task is not the app that owns the task
@lgtm-com

lgtm-com Bot commented Jul 8, 2021

Copy link
Copy Markdown

This pull request introduces 1 alert when merging fce1334 into e885a47 - view on LGTM.com

new alerts:

  • 1 for Unused import

@codecov

codecov Bot commented Jul 8, 2021 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@e885a47). Click here to learn what that means.
The diff coverage is 71.71%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #6847   +/-   ##
=========================================
  Coverage          ?   79.21%           
=========================================
  Files             ?      138           
  Lines             ?    16616           
  Branches          ?     2097           
=========================================
  Hits              ?    13162           
  Misses            ?     3227           
  Partials          ?      227           
Flag Coverage Δ
unittests 79.21% <71.71%> (?)

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

Impacted Files Coverage Δ
celery/__main__.py 0.00% <0.00%> (ø)
celery/_state.py 40.32% <ø> (ø)
celery/app/__init__.py 65.38% <0.00%> (ø)
celery/app/backends.py 65.51% <0.00%> (ø)
celery/concurrency/__init__.py 100.00% <ø> (ø)
celery/concurrency/base.py 98.13% <ø> (ø)
celery/concurrency/eventlet.py 100.00% <ø> (ø)
celery/concurrency/gevent.py 100.00% <ø> (ø)
celery/concurrency/prefork.py 97.75% <ø> (ø)
celery/concurrency/solo.py 100.00% <ø> (ø)
... and 128 more

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 e885a47...0702904. Read the comment docs.

@lgtm-com

lgtm-com Bot commented Jul 8, 2021

Copy link
Copy Markdown

This pull request introduces 2 alerts when merging 0702904 into e885a47 - view on LGTM.com

new alerts:

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

@auvipy
auvipy merged commit 52b6238 into celery:master Jul 9, 2021
@auvipy auvipy added this to the 5.1.x milestone Jul 9, 2021
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
…oes not exist ... (celery#6847)

* Get body_type independently to handle cases where body.type does not exist due to tasks being created via Signatures

* body.get() was returning None always, must getattr() and catch the NotRegistered Error if the app that generated the task is not the app that owns the task

* flake8 fix for too many blank lines
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.

Chord across multiple apps using signatures breaks on task not registered

3 participants