Skip to content

Termination tasks with eventlet/gevent worker pool. #4019

Closed

Description

@alternativshik

This is a feature request about ability to terminate task execution when using eventlet or gevent TaskPool.

Now this feature presents only on Prefork TaskPool, but, I think, this is a useful feature for other Pools.

Activity

  1. auvipy commented on Jan 11, 2018

    @auvipy
    Member

    have you any suggested workarounds?

  2. jengelman commented on Mar 14, 2018

    @jengelman
    Contributor

    +1

  3. sreecodeslayer commented on May 11, 2018

    @sreecodeslayer

    I believe the issue am facing while terminating the task has to do with this feature request

    Am using the celery [ v4.1.0 ] with Flask as : celery -A run.celery worker -P eventlet -c 50 --loglevel=info

    [2018-05-11 17:16:28,137: ERROR/MainProcess] pidbox command error: NotImplementedError("<class 'celery.concurrency.eventlet.TaskPool'> does not implement kill_job",)
    Traceback (most recent call last):
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/kombu/pidbox.py", line 101, in dispatch
        reply = handle(method, arguments)
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/kombu/pidbox.py", line 122, in handle_cast
        return self.handle(method, arguments)
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/kombu/pidbox.py", line 116, in handle
        return self.handlers[method](self.state, **arguments)
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/celery/worker/control.py", line 164, in revoke
        request.terminate(state.consumer.pool, signal=signum)
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/celery/worker/request.py", line 248, in terminate
        pool.terminate_job(self.worker_pid, signal)
      File "/home/sreenadh/Projects/test_project/.tp/lib/python3.5/site-packages/celery/concurrency/base.py", line 115, in terminate_job
        '{0} does not implement kill_job'.format(type(self)))
    NotImplementedError: <class 'celery.concurrency.eventlet.TaskPool'> does not implement kill_job
    

    I believe the killing would be possible using Eventlet API corresponding to the greenthread.kill() ?

  4. MrJeric0 commented on Jun 21, 2018

    @MrJeric0

    +1

  5. seiyata commented on Nov 28, 2018

    @seiyata

    +1

  6. basitiyidir commented on Dec 20, 2018

    @basitiyidir

    +1

  7. antoarva commented on Jan 10, 2019

    @antoarva

    +1

  8. RogerLiNing commented on Feb 19, 2019

    @RogerLiNing

    +1

  9. added this to the v5.0.0 milestone on Mar 12, 2019
  10. tobiaskohler commented on Jun 27, 2019

    @tobiaskohler

    +1

  11. removed this from the v5.0.0 milestone on Jun 29, 2019
  12. MarcDelahousse commented on Jul 2, 2019

    @MarcDelahousse

    +1

  13. added this to the 5.1.0 milestone on Jul 2, 2019
  14. ioliveros commented on Jul 15, 2019

    @ioliveros

    +1

  15. 21 remaining items

  16. Kanishk-Kumar commented on Oct 20, 2023

    @Kanishk-Kumar

    +1

  17. mht2953658596 commented on Aug 18, 2024

    @mht2953658596

    +1

  18. mht2953658596 commented on Aug 18, 2024

    @mht2953658596

    +1

  19. bengabp commented on Sep 19, 2024

    @bengabp

    Not fixed yet ??

  20. Nusnus commented on Sep 19, 2024

    @Nusnus
    Member

    @bengabp

    Not fixed yet ??

    #9083

  21. bengabp commented on Sep 19, 2024

    @bengabp

    @bengabp

    Not fixed yet ??

    #9083

    Yeah I still got the error raised even after using terminate=True

  22. Nusnus commented on Sep 19, 2024

    @Nusnus
    Member

    @bengabp

    Not fixed yet ??

    #9083

    Yeah I still got the error raised even after using terminate=True

    @ldsink Can you give it a look please 🙏

  23. reopened this on Sep 19, 2024
  24. Nusnus commented on Sep 19, 2024

    @Nusnus
    Member

    @bengabp

    @bengabp

    Not fixed yet ??

    #9083

    Yeah I still got the error raised even after using terminate=True

    Can you please share more info?
    Are you doing anything differently than what the PR fixes?

  25. bengabp commented on Sep 19, 2024

    @bengabp

    No. Just a generic task I have which is running on gevent pool and worker raises not implemented exception when I revoke the task

  26. Nusnus commented on Sep 19, 2024

    @Nusnus
    Member

    No. Just a generic task I have which is running on gevent pool and worker raises not implemented exception when I revoke the task

    Are you using the latest pre-release of Celery?
    Just confirming

  27. bengabp commented on Sep 19, 2024

    @bengabp
  28. Nusnus commented on Sep 19, 2024

    @Nusnus
    Member

    @bengabp

    @Nusnus
    image

    This fix was released in 5.5.0b2:
    https://github.com/celery/celery/blob/main/Changelog.rst#L193

    You will need to upgrade to the latest pre-release or wait for the final release to have the fix from the PR.

  29. bengabp commented on Sep 19, 2024

    @bengabp

    Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions