1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Kill a task at specific time no matter when it actually started

Discussão em 'Python' iniciado por Stack, Setembro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to have a task killed at a specific time, no matter when it actually started.

    This is for this scenario:

    • task submitted at t=0, runs for 50s
    • task submitted again a t=60 - the previous task must not be running

    The options I could find do not work:

    • time_limit only kicks in when the task starts. If say the worker was down and picked up the task at t=30s, then according to time_limit the task can run up to t=90s, which is not what I want
    • expires only applies if the task has not started yet, so having expires=55 would not apply in the previous scenario

    The submitter is transient, so there will not be a async_result object to call revoke (and as I am using kafka as a broker, I cannot revoke a task anyway).

    How can I make sure a task is not running at a specific time?

    Continue reading...

Compartilhe esta Página