-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_jobs_status.sh
42 lines (34 loc) · 969 Bytes
/
check_jobs_status.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
#!/bin/bash
log_file=$1
num_of_jobs=`cat $log_file | grep job | wc -l`
echo "number of jobs submitted:" $num_of_jobs
num_of_done=0
num_of_running=0
num_of_failed=0
num_of_waiting=0
for id in `cat $log_file | grep job`
do
state=`dx describe $id | grep -e "State"`
if [[ $state == *done ]]
then
num_of_done=`expr $num_of_done + 1`
elif [[ $state == *running ]]
then
num_of_running=`expr $num_of_running + 1`
elif [[ $state == *failed ]]
then
num_of_failed=`expr $num_of_failed + 1`
elif [[ $state == *runnable ]]
then
num_of_waiting=`expr $num_of_waiting + 1`
else
echo "unknown status:" $state
fi
done
state_known=`expr $num_of_done + $num_of_running + $num_of_failed + $num_of_waiting`
state_unknown=`expr $num_of_jobs - $state_known`
echo "Done:" $num_of_done
echo "Running:" $num_of_running
echo "Failed:" $num_of_failed
echo "Waiting:" $num_of_waiting
echo "State unknown:" $state_unknown