-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·33 lines (30 loc) · 1.07 KB
/
docker-entrypoint.sh
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
#!/bin/bash
set -ea
echo "RUNNING SERVICE"
# Launch parameters, environement variables and dependencies check
if [ -z "$SERVICE_MODE" ]
then
echo "ERROR: Must specify a serving mode: [ http | task ]"
exit -1
else
if [ "$SERVICE_MODE" = "http" ]
then
echo "RUNNING HTTP SERVER"
python http_server/ingress.py --debug
elif [ "$SERVICE_MODE" == "task" ]
then
if [[ -z "$SERVICES_BROKER" ]]
then
echo "ERROR: SERVICES_BROKER variable not specified, cannot start celery worker."
return -1
fi
/usr/src/app/wait-for-it.sh $(echo $SERVICES_BROKER | cut -d'/' -f 3) --timeout=20 --strict -- echo " $SERVICES_BROKER (Service Broker) is up"
echo "RUNNING CELERY WORKER"
POOL=$([ $USE_GPU == "True" ] && echo "gevent" || echo "prefork")
celery --app=celery_app.celeryapp worker -Ofair -n nlp_${SERVICE_NAME}_worker@%h --queues=${SERVICE_NAME} -c ${CONCURRENCY} --pool=$POOL
else
echo "ERROR: Wrong serving command: $1"
exit -1
fi
fi
echo "Service stopped"