forked from yannikschaelte/study_abc_slad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_main.sh
More file actions
executable file
·37 lines (30 loc) · 884 Bytes
/
run_main.sh
File metadata and controls
executable file
·37 lines (30 loc) · 884 Bytes
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
#!/bin/bash
set -e
# read arguments
for ARG in "$@"; do
KEY=$(echo $ARG | cut -f1 -d=)
VAL=$(echo $ARG | cut -f2 -d=)
case "$KEY" in
--file) FILE=$VAL ;;
--host) HOST=$VAL ;;
--port) PORT=$VAL ;;
--procs) PROCS=$VAL ;;
--daemon) DAEMON=$VAL ;;
*) echo "Unknown argument: $KEY"; exit 1 ;;
esac
done
if [ -z $FILE ]; then echo "file unset"; exit 1; fi
if [ -z $HOST ]; then echo "host unset"; exit 1; fi
if [ -z $PORT ]; then echo "port unset"; exit 1; fi
if [ -z $PROCS ]; then echo "procs unset"; exit 1; fi
if [ -z $DAEMON ]; then echo "daemon unset"; exit 1; fi
# load environment
. start_env.sh
# start ncpu-1 workers
echo "Starting workers"
abc-redis-worker --host=$HOST --port=$PORT --runtime=24h \
--processes=$((PROCS-1)) --daemon=$DAEMON &
sleep 1
# run main program
echo "Starting main program"
python $FILE --host=$HOST --port=$PORT