-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathrun.sh
executable file
·100 lines (88 loc) · 2.22 KB
/
run.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
KEY_LENGTH=${#KEY}
VALUE="${ARGUMENT:$KEY_LENGTH+1}"
export "$KEY"="$VALUE"
done
frontend(){
echo "Running frontend $framework"
if [[ $framework == "react" ]]
then
cd client && export PORT=3001 && npm start
fi
if [[ $framework == "dash" ]]
then
python run_dash_frontend.py $yaml
fi
}
server(){
echo "Running $yaml"
is_elastic=$(echo $(python3.9 parse_yaml.py $yaml models_search)| grep -c "ElasticBERT")
is_webexBot=$(echo $(python3.9 parse_yaml.py $yaml UI)| grep -c "webex_bot")
is_slackBot=$(echo $(python3.9 parse_yaml.py $yaml UI)| grep -c "slack_bot")
if (($is_elastic >= 1 ))
then
is_elastic_service_running=$(echo $(curl http://localhost:9200/_cluster/health) | grep -c "elasticsearch")
# echo $is_elastic_service_running
if (($is_elastic_service_running < 1))
then
echo -e "\n\n\nTrying to run elastic seach\n\n\n\n\n"
bash ../elasticsearch/bin/elasticsearch
sleep 10
is_elastic_service_running=$(echo $(curl http://localhost:9200/_cluster/health) | grep -c "elasticsearch")
if (($is_elastic_service_running < 1))
then
echo -e "\n\n\n\nPlease Run Elastic Search to run the backend\n\n\n\n"
else
python run_backend.py $yaml & disown
fi
else
python run_backend.py $yaml & disown
fi
else
python run_backend.py $yaml & disown
fi
if (($is_webexBot >= 1 ))
then
sleep 10
python external_apps/webex_bot/main.py
fi
if (($is_slackBot >= 1 ))
then
sleep 10
python external_apps/slack_bot/run.py
fi
}
echo $1
case $1 in
"build")
echo "Building local development environment"
curl https://pyenv.run | bash
pyenv install -v 3.9.16
pyenv virtualenv 3.9.16 venv
pyenv activate venv
;;
"install")
echo "Installing dependencies"
pip install -r requirements.txt
cd client && npm install
;;
"frontend")
frontend
;;
"server")
server
;;
"bot")
python external_apps/webex_bot/main.py
;;
*)
server &
P1=$!
frontend &
P2=$!
wait $P1 $P2
;;
esac