I defined some tasks with a time limit of 1200:
@celery.task(time_limit=1200) def create_ne_list(text): c = Client() return c.create_ne_list(text)
I also use the worker_process_init signal to initialize, each time a new process starts:
@worker_process_init.connect def init(sender=None, conf=None, **kwargs): init_system(celery.conf) init_pdf(celery.conf)
This initialization function takes a few seconds.
In addition, I use the following configuration:
CELERY_RESULT_SERIALIZER = 'json' CELERY_TASK_SERIALIZER = 'json' CELERY_ACCEPT_CONTENT = ['json'] BROKER_URL = 'amqp://' CELERY_RESULT_BACKEND = 'amqp://' CELERY_TIMEZONE = 'Europe/Berlin' CELERY_ENABLE_UTC = True
and run my worker with the following command:
celery -A isc worker -l info --concurrency=3
As expected, starting an employee causes the initialization function to be called three times. Now I can send tasks, and they are executed, and everything works fine.
BUT: As soon as the task exceeds the deadline, the worker enters an endless spawning cycle and is killed again due to the excess of the deadline.
[2014-06-13 09:46:18,978: ERROR/MainProcess] Timed out waiting for UP message from <Worker(Worker-20381, started daemon)> [2014-06-13 09:46:20,000: ERROR/MainProcess] Process 'Worker-20381' pid:18953 exited with 'signal 9 (SIGKILL)' // new worker 20382 getting started, initialization getting triggerd and soon after that --> [2014-06-13 09:46:18,978: ERROR/MainProcess] Timed out waiting for UP message from <Worker(Worker-20382, started daemon)> [2014-06-13 09:46:20,000: ERROR/MainProcess] Process 'Worker-20382' pid:18954 exited with 'signal 9 (SIGKILL)' // and so on....
Does anyone have an idea why this is happening?