Skip to content

Terminate job implementation for eventlet concurrency backend - #6917

Merged
auvipy merged 5 commits into
celery:masterfrom
idj97:master
Aug 18, 2021
Merged

auvipy merged 5 commits into
celery:masterfrom
idj97:master

Conversation

@idj97

@idj97 idj97 commented Aug 17, 2021

Copy link
Copy Markdown
Contributor

Terminate job implementation for eventlet concurrency backend

Description

Current implementation of TaskPool which is based on eventlet library does not support terminating jobs.
Revoking with terminate=True or terminating task raises NotImplementedError: <class 'celery.concurrency.eventlet.TaskPool'> does not implement kill_job exception while task continues to run.

Fixes #5209 #3429
Fixes only eventlet backend for this issue #4019

@codecov

codecov Bot commented Aug 17, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #6917 (88c5a2b) into master (ad99471) will increase coverage by 0.00%.
The diff coverage is 96.29%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6917   +/-   ##
=======================================
  Coverage   89.20%   89.21%           
=======================================
  Files         138      138           
  Lines       16654    16678   +24     
  Branches     2106     2107    +1     
=======================================
+ Hits        14857    14880   +23     
+ Misses       1578     1577    -1     
- Partials      219      221    +2     
Flag Coverage Δ
unittests 89.21% <96.29%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
celery/concurrency/eventlet.py 99.14% <96.29%> (-0.86%) ⬇️
celery/events/state.py 97.25% <0.00%> (-0.25%) ⬇️
celery/backends/asynchronous.py 60.18% <0.00%> (+0.46%) ⬆️

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 ad99471...88c5a2b. Read the comment docs.

@lgtm-com

lgtm-com Bot commented Aug 17, 2021

Copy link
Copy Markdown

This pull request introduces 2 alerts when merging e77e54e into ad99471 - view on LGTM.com

new alerts:

  • 2 for First parameter of a method is not named 'self'

Comment thread celery/concurrency/eventlet.py Resolved

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

Overall, this looks great.
I do have some rather minor comments and a question.

We also need to document this change.

Comment thread celery/concurrency/eventlet.py Resolved
Comment thread celery/concurrency/eventlet.py Resolved
Comment thread celery/concurrency/eventlet.py Resolved
Comment thread celery/concurrency/eventlet.py Resolved
Comment thread celery/concurrency/eventlet.py Resolved
@lgtm-com

lgtm-com Bot commented Aug 18, 2021

Copy link
Copy Markdown

This pull request fixes 2 alerts when merging c588c97 into ad99471 - view on LGTM.com

fixed alerts:

  • 2 for Wrong name for an argument in a call

@idj97

idj97 commented Aug 18, 2021 •

Copy link
Copy Markdown
Contributor Author

I implement all requested changes. I will squash all commits once we reach approved stage.

We also need to document this change.

I am not sure what I need to do here, only documentation I found that talks about eventlet taskpool in details is this. Rebuilding documentation should add terminate_job method to list?
Am I missing something?

@thedrow

thedrow commented Aug 18, 2021

Copy link
Copy Markdown
Contributor

We should update the docs here to reflect that the eventlet pool also supports cancellation.

@lgtm-com

lgtm-com Bot commented Aug 18, 2021

Copy link
Copy Markdown

This pull request fixes 2 alerts when merging f624d99 into ad99471 - view on LGTM.com

fixed alerts:

  • 2 for Wrong name for an argument in a call

@idj97

idj97 commented Aug 18, 2021

Copy link
Copy Markdown
Contributor Author

We should update the docs here to reflect that the eventlet pool also supports cancellation.

updated.

@auvipy
auvipy merged commit 16959cd into celery:master Aug 18, 2021
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
…#6917)

* Terminate job eventlet implementation

 #asd

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use {} instead of dict

* Requested fixes

* Update workers guide docs

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@azulzaietz

Copy link
Copy Markdown

Hello! How are you? Is it possible for you to address this issue for the gevent backend, please? Issue #4019

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.

I can‘t stop a task by its task_id

4 participants