forked from OpenVisualCloud/Video-Curation-Sample
-
Notifications
You must be signed in to change notification settings - Fork 1
/
start_app.sh
executable file
·120 lines (96 loc) · 3.22 KB
/
start_app.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash -e
#######################################################################################################################
# This script runs the Curation application
#######################################################################################################################
# DEFAULT VARIABLES
INGESTION="object,face"
EXP_TYPE=compose
REGISTRY=None
NCPU=0
NCURATIONS=1
IN_SOURCE=stream
SOURCE="-DSTREAM_URL="udp://localhost:8088" -DIN_SOURCE=${IN_SOURCE}"
DIR=$(dirname $(readlink -f "$0"))
BUILD_DIR=$DIR/build
LONG_LIST=(
"ingestion"
"type"
"registry"
"ncurations"
"ncpu"
"source"
)
OPTS=$(getopt \
--longoptions "$(printf "%s:," "${LONG_LIST[@]}")" \
--name "$(basename "$0")" \
--options "hi:t:r:n:c:s:" \
-- "$@"
)
eval set -- $OPTS
if [ -d "$BUILD_DIR" ]; then
rm -rf $BUILD_DIR
fi
mkdir -p $BUILD_DIR
#######################################################################################################################
# GET SCRIPT OPTIONS
script_usage()
{
cat <<EOF
This script runs the Video Curation Streaming Application
Usage: $0 [ options ]
Options:
-h optional Print this help message
-i or --ingestion optional Ingestion tyoe (object, face) [Default: "object,face"]
-t or --type optional Deployment method (compose, k8) [Default: compose]
-r or --registry optional Registry [Default: None]
-n or --ncurations optional Number of ingestion containers [Default: 1]
-c or --ncpu optional Number CPUs for each ingestion container [Default: 0]
-s or --source optional Input source type (videos, stream) [Default: stream]
EOF
}
while true; do
case "$1" in
-h) script_usage; exit 0 ;;
-i | --ingestion) shift; INGESTION=$1; shift ;;
-t | --type) shift; EXP_TYPE="$1"; shift ;;
-r | --registry) shift; REGISTRY="$1"; shift ;;
-n | --ncurations) shift; NCURATIONS=$1; shift ;;
-c | --ncpu) shift; NCPU=$1; shift ;;
-s | --source)
shift;
IN_SOURCE="$1";
if [ $IN_SOURCE == "stream" ]; then
SOURCE="-DSTREAM_URL="udp://localhost:8088" -DIN_SOURCE=${IN_SOURCE}";
elif [ $IN_SOURCE == "videos" ]; then
SOURCE="-DIN_SOURCE=${IN_SOURCE}";
else
echo "INVALID SOURCE TYPE (-s): ${IN_SOURCE}";
script_usage;
exit 0;
fi
shift;
;;
--) shift; break ;;
*) script_usage; exit 0 ;;
esac
done
#######################################################################################################################
# BUILD AND START APP
cd $BUILD_DIR
if [ $REGISTRY == "None" ]; then
cmake -DINGESTION=$INGESTION $SOURCE -DNCPU=$NCPU -DNCURATIONS=$NCURATIONS ..
else
cmake -DREGISTRY=$REGISTRY -DINGESTION=$INGESTION $SOURCE -DNCPU=$NCPU -DNCURATIONS=$NCURATIONS ..
fi
make
if [ $EXP_TYPE == "compose" ]; then
make start_docker_compose
elif [ $EXP_TYPE == "k8" ]; then
if [ $REGISTRY == "None" ]; then
make update
fi
make start_kubernetes
else
echo "INVALID TYPE: ${EXP_TYPE}"
fi
cd $DIR