forked from open-edge-platform/edge-ai-suites
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_stop.sh
More file actions
executable file
·48 lines (39 loc) · 1.06 KB
/
sample_stop.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.06 KB
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
#!/bin/bash
DLSPS_NODE_IP="localhost"
DLSPS_PORT=8080
function stop_all_pipelines() {
echo
echo -n ">>>>>Stopping all running pipelines."
pipelines=$(curl -k -s -X GET "https://$DLSPS_NODE_IP/api/pipelines/status" -H "accept: application/json" | grep id | awk ' { print $2 } ' | tr -d \" | tr -d '\n')
if [ $? -ne 0 ]; then
echo -e "\nError: curl -k command failed."
return 1
fi
IFS=','
for pipeline in $pipelines; do
response=$(curl -k -s --location -X DELETE "https://$DLSPS_NODE_IP/api/pipelines/${pipeline}")
sleep 2
done
unset IFS
running=true
while [ "$running" == true ]; do
echo -n "."
status=$(curl -k -s --location -X GET "https://$DLSPS_NODE_IP/api/pipelines/status" | grep state | awk ' { print $2 } ' | tr -d \")
if [[ "$status" == *"RUNNING"* ]]; then
running=true
sleep 2
else
running=false
fi
done
echo -n " done."
echo
return 0
}
stop_all_pipelines
if [ $? -ne 0 ]; then
exit 1
echo "Error: Check pipelines manually"
else
echo ">>>>>All running pipelines stopped."
fi