-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun-dev.sh
executable file
·42 lines (36 loc) · 1.2 KB
/
run-dev.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
34
35
36
37
38
39
40
41
42
#!/bin/bash
trap cleanup SIGINT
list_descendants ()
{
argproc=$1
local children=$(ps -x -o pid,ppid | awk -v argproc=$argproc '{ if($2==argproc) {print $1} }')
for pid in $children
do
list_descendants "$pid"
done
echo "$children"
}
cleanup() {
echo "Killing all processes."
kill $(list_descendants $$) &> /dev/null
}
die() {
echo "$1" >&2
echo
cleanup
exit 1
}
REDIS_PORT=7777
echo "Starting redis server. Log location: ./redis.log"
( bash run-redis.sh $REDIS_PORT &> redis.log || die "Launching redis failed. see ./redis.log" ) &
sleep 1
echo "Starting interartic. Log location: ./interartic.log"
( python3 main.py $REDIS_PORT &> interartic.log || die "Launching inteartic failed. see ./interartic.log" ) &
sleep 1
echo "Starting celery. Log location: ./celery.log"
( eval "$(conda shell.bash hook)"; conda activate artic-ncov2019 ; export PATH=`pwd`/scripts:$PATH; celery worker -A main.celery -b redis://localhost:$REDIS_PORT/0 --result-backend redis://localhost:$REDIS_PORT/0 --concurrency=1 --loglevel=info &> celery.log || die "Launching celery failed. See ./celery.log" ) &
sleep 1
echo ""
echo "Visit http://127.0.0.1:5000 now"
echo "Press ctrl+c to terminate interartic"
wait