이콜레모 개발자 위키

Page history of celery



Title: celery | edited by Youngrok Pak at 10 years, 6 months ago.

<p>파이썬으로 개발된 <a href="TaskQueue">TaskQueue</a> 서버. 보통 <a href="http://www.rabbitmq.com/">rabbitmq</a>를 백엔드로 쓰며, <a href="Django">Django</a>랑 쉽게 연동할 수 있다. 하지만 django-celery가 주는 이득은 그냥 초기화를 쉽게 해준다는 정도.</p>
<h2><a href="우분투">우분투</a> 설정</h2>
<p><code>/etc/init/celery.conf</code></p>
<pre>description "django-celery worker for newsqu"<br>author      "youngrok - http://ecolemo.com"<br><br># used to be: start on startup<br># until we found some mounts weren't ready yet while booting:<br>start on started mountall<br>stop on shutdown<br><br># Automatically Respawn:<br>respawn<br>respawn limit 99 5<br><br>script<br>    cd /path/to/project<br>    exec sudo -uubuntu celery worker -E -l INFO --concurrency 2 --logfile=/path/to/celery.log<br>end script<br><br>post-start script<br>   # Optionally put a script here that will notifiy you node has (re)started<br>   # /root/bin/hoptoad.sh "node.js has started!"<br>end script</pre>
<p>그러면 다음 명령으로 시작이 가능하다.</p>
<pre>sudo start celery</pre>
<p><code>--concurrency</code>가 중요한 옵션. 프로세스가 몇 개 떠 있을지를 결정한다.</p>
<h2>모니터링</h2>
<p>여러 도구가 있지만 <a href="http://docs.celeryproject.org/en/latest/userguide/monitoring.html#flower-real-time-celery-web-monitor">flower</a>가 가장 강력하다. celery와 비슷하게 설정하며 실행 명령만 다음과 같이 바꾸면 된다.</p>
<pre>celery flower --broker_api=http://guest:guest@localhost:15672/api/</pre>
<p><code>--broker_api</code> 설정이 맞아야 브로커 모니터링이 가능하다. 물론 설치는 따로 해야 한다.</p>
Wiki at WikiNamu