-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathrun-worker-by-queue.sh
More file actions
executable file
·41 lines (34 loc) · 1.07 KB
/
run-worker-by-queue.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
# setup
python _check_setup.py
if [ $? -ne 0 ]; then
echo 'Setup failed.'
exit 1
fi
# pip install
PIP_REQUIREMENTS_FILE_PATH=`python _config.py PIP_REQUIREMENTS_FILE_PATH`
EXTRA_PYTHON_IMPORT_PATH=`python _config.py EXTRA_PYTHON_IMPORT_PATH`
if [ -f ${PIP_REQUIREMENTS_FILE_PATH} ]; then
pip install -r ${PIP_REQUIREMENTS_FILE_PATH} --target ${EXTRA_PYTHON_IMPORT_PATH}
fi
# gen queue names
queue_prefix='DataFluxFunc-worker#workerQueue@'
enabled_queues=''
for queue in $*; do
if [ "${enabled_queues}" == "" ]; then
enabled_queues=${queue_prefix}${queue}
else
enabled_queues=${enabled_queues},${queue_prefix}${queue}
fi
done
# 单纯处理系统队列/调试队列的工作单元,不需要太多并发量
if [ ${enabled_queues} = "${queue_prefix}0" ]; then
# 系统队列
_WORKER_CONCURRENCY=3
elif [ ${enabled_queues} = "${queue_prefix}7" ]; then
# 调试队列
_WORKER_CONCURRENCY=2
fi
# run worker
_WORKER_CONCURRENCY=${_WORKER_CONCURRENCY} python _celery.py worker -A worker -l error -q -Q ${enabled_queues}