每当我跑步"停止芹菜工人"在主管停止我的芹菜工人我得到以下错误:
625[2014-05-18 14:41:59,650: ERROR/MainProcess] Task tasks.send_process_my_task[2ff51473-80f9-4c53-9b9a-b8ddc8c36618] raised unexpected: WorkerLostError('Worker exited prematurely: signal 15 (SIGTERM).',)
626Traceback (most recent call last):
627 File "/usr/local/envs/mylocalenv/local/lib/python2.7/site-packages/billiard/pool.py", line 1168, in mark_as_worker_lost
628 human_status(exitcode)),
629WorkerLostError: Worker exited prematurely: signal 15 (SIGTERM).
630[2014-05-18 14:41:59,653: ERROR/MainProcess] Process 'Worker-4' pid:2279 exited with exitcode -15
631[2014-05-18 14:41:59,683: ERROR/MainProcess] Task tasks.send_process_my_task[9847bda0-9073-4b66-872f-ab4ed18b8690] raised unexpected: WorkerLostError('Worker exited prematurely: signal 15 (SIGTERM).',)
但是,如果我使用Ctrl-C将工作人员停在前台,工作人员会正常关闭而不会出现任何错误:
[2014-05-18 14:53:39,124: DEBUG/MainProcess] | Worker: Stopping Pool...
190[2014-05-18 14:53:46,769: INFO/MainProcess] Task tasks.send_process_my_task[8071162a-b47a-4aa4-94e7-72f51443b411] succeeded in 16.467172019s: u''
191[2014-05-18 14:53:46,816: INFO/MainProcess] Task tasks.send_process_my_task[1dd4cb3c-322c-41a3-94ea-f0dde604e6d3] succeeded in 16.389319943s: u''
192[2014-05-18 14:53:46,817: INFO/MainProcess] Task tasks.send_process_my_task[5e72e357-352b-47aa-9dda-51da53220a5e] succeeded in 16.424921152s: u''
193[2014-05-18 14:53:48,903: INFO/MainProcess] Task tasks.send_process_my_task[30c1064a-0f04-49e2-9282-a6031e97a448] succeeded in 18.595272409s: u''
主管中是否有任何导致以这种方式杀害工人的行为?我希望主管发送一个sigterm信号,不要杀死进程。
以下是我的芹菜主管配置的副本:
[program:celery-worker]
command=/path/to/script-running-celery.sh
directory=/path/to/celery/project/tasks
user=myuser
stdout_logfile=/var/log/celery/worker.log
stderr_logfile=/var/log/celery/worker.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 1200
killasgroup=true
stopasgroup=true
priority=50
从主管(运行芹菜)执行的脚本:
#!/bin/bash
export PATH="$PATH:/mylocal-envs/localenv";
cd /path/to/celery/project/tasks;
exec /mylocal-envs/localenv/bin/celery worker -c8 -n my_worker_%h_$(uuid) --without-gossip -A tasks --queues=myqueue --loglevel=INFO -Ofair
感谢您的帮助,
答案 0 :(得分:0)
我发现如果将stopsignal选项更改为INT而不是默认的TERM,则工作人员会优雅地关闭,因为在终端中运行芹菜时会从前台定期热关闭。