python - How to replay a message for app.control.revoke when handling SIGTERM in celery? -


i'm using celery 3.1 django.

right now, have task need run forever, , hope can stop manually. code like:

import signal  @shared_task(bind=true) def mainjob(self, name):      def handler:         stop_running_jobs()         return 'terminated!' # message hope reply.      signal.signal(signal.sigusr1, handler)      keep_running_job() 

and call task using:

result = mainjob.delay() 

when want stop task, call make sure task has stopped.

result.revoke(terminate=true, signal='sigusr1', wait=true, timeout=3) 

but when revoking task, wait 3 seconds, , never receive reply.what should do?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -