python - How to reset time limit on Celery Task -


i have no experience celery i'm looking if use case solvable in celery.

the client submit job celery, job executed in celerytask. client has send keepalive every 30 seconds keep job active. once job not refreshed keepalive message, job cancelled.

i can think of 2 solutions:

  1. each job-task created have hard time limit of 30s. when client sends keepalive router send message relevant worker reset hard time limit.

  2. each job-task have no time limit. each job-task there special watchdog task launched. watchdog task launched delay of 30s. if new keepalive arrives client watchdog task cancelled , recreated. again delay of 30 seconds. if watchdog executed, kill job-task, eliminating system.

the 1. simpler, i'm not sure how reset task timelimit. solution 2. seems more correct, i'm afraid there various race conditions. watchdog task should running in separate queue reserved watchdogs only.

how possible? 1 of solution or other.

in understanding, want have middleware(one receive keepalive, on control task), link youcelery.app.control.control.terminate.

  1. get task_id of task when apply_async (destination or all workers)
  2. listen keepalive client
  3. if time limit arrived , no keepalive, terminate task app.control.terminate(task_id, reply=true)

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -