Merge pull request #241 from mozilla/bug-1076774-implement-buildapi-queue

Bug 1076774 - use a separate worker for jobs ingestion
This commit is contained in:
camd 2014-10-06 08:46:20 -07:00
Родитель 893d89ce84 9555d42872
Коммит 7546d5d74a
4 изменённых файлов: 39 добавлений и 3 удалений

25
bin/run_celery_worker_buildapi Executable file
Просмотреть файл

@ -0,0 +1,25 @@
#!/bin/bash
curr_dir=$( dirname "${BASH_SOURCE[0]}" )
cd $( dirname $curr_dir)
source /etc/profile.d/treeherder.sh
if [[ ${NEW_RELIC_LICENSE_KEY+isset} = isset ]]; then
NEWRELIC_ADMIN="newrelic-admin run-program"
fi
if [ -f ../venv/bin/python ]; then
source ../venv/bin/activate
PYTHON=../venv/bin/python
else
PYTHON=python
fi
LOGFILE=/var/log/celery/celery_worker_buildapi.log
if [ ! -f $LOGFILE ]; then
touch $LOGFILE
fi
exec $NEWRELIC_ADMIN $PYTHON manage.py celery worker -Q buildapi \
--concurrency=5 --logfile=$LOGFILE -l INFO \
--maxtasksperchild=500

Просмотреть файл

@ -17,3 +17,13 @@ priority=998
stdout_logfile=/var/log/celery/worker_pushlog.log
stderr_logfile=/var/log/celery/worker_pushlog_err.log
[program:celery_buildapi]
command=/home/vagrant/treeherder-service/bin/run_celery_worker_buildapi
user=vagrant
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
priority=998
stdout_logfile=/var/log/celery/worker_buildapi.log
stderr_logfile=/var/log/celery/worker_buildapi_err.log

Просмотреть файл

@ -90,7 +90,7 @@
"routing_key": null,
"crontab": null,
"interval": 2,
"queue": null,
"queue": "buildapi",
"total_run_count": 0,
"expires": null,
"kwargs": "{}",
@ -132,7 +132,7 @@
"routing_key": null,
"crontab": null,
"interval": 2,
"queue": null,
"queue": "buildapi",
"total_run_count": 0,
"expires": null,
"kwargs": "{}",
@ -153,7 +153,7 @@
"routing_key": null,
"crontab": null,
"interval": 1,
"queue": null,
"queue": "buildapi",
"total_run_count": 0,
"expires": null,
"kwargs": "{}",

Просмотреть файл

@ -192,6 +192,7 @@ CELERY_QUEUES = (
# queue for mirroring the sheriffing activity to tbpl
Queue('high_priority', Exchange('default'), routing_key='high_priority'),
Queue('pushlog', Exchange('default'), routing_key='pushlog'),
Queue('buildapi', Exchange('default'), routing_key='buildapi')
)
CELERY_ACCEPT_CONTENT = ['json']