python - celery how to terminate and start again task -


i want use celery this: 1. send message start task, task starting 2. if in task condition true task should terminated (canceled) , "returned" messages queue other worker can take , it.

and don't know how terminate task worker function. trying in called function:

if condition == true:     revoke(current_task.request.id, terminate=true) 

and in app when message send trying connect signal 'task_revoke' in way:

@task_revoked.connect def do_something_when_revoke(terminated, signum, expired):     do_something_here... 

but not working me good. maybe can me , tell me i'm doing wrong or maybe different way :) in advance

possibly easier way achieve implement logic inside task itself:

  • you don't have revoke task, don't in it
  • your task can submit new, updated, task queue

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -