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_status.sh
More file actions
executable file
·48 lines (39 loc) · 1.39 KB
/
sample_status.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.39 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
46
47
48
#!/bin/bash
DLSPS_NODE_IP="localhost"
DLSPS_PORT=8080
function get_status() {
interval=10
start_time=$(date +%s)
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=false
echo -e "\nNo running pipelines"
exit 0
else
running=true
echo -e "\n>>>>>Pipeline status reported every $interval seconds."
echo -e "\n>>>>>Press Ctrl+C to exit..."
while [ "$running" == true ]; do
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=false
else
results_pipeline=()
elapsed_time=$(($(date +%s) - $start_time))
echo -e "\n>>>>>>>>>>>>>>> $elapsed_time seconds."
results=$(curl -k -s --location -X GET "https://$DLSPS_NODE_IP/api/pipelines/status" | grep -A 2 -B 5 RUNNING | grep fps | awk -F': ' '{print $2}' | awk -F',' '{printf" %.2f ", $1}')
results_pipeline+=("$results")
echo -e "pipelines fps: (${results_pipeline[@]})"
sleep $interval
fi
done
fi
}
# Function to handle exit
cleanup() {
echo -e "\n>>>>>Ctrl+C pressed, terminating the script..."
exit 0
}
# Set trap to catch SIGINT (Ctrl+C) and call cleanup
trap cleanup SIGINT
get_status