-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqqstat
executable file
·91 lines (79 loc) · 2.05 KB
/
qqstat
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
#!/bin/bash
# torqq -- run Portable Batch System scripts locally
# torqq is released under the New BSD license (see LICENSE.txt).
# Go to the project home page for more info:
# https://github.com/abernatskiy/torqq
STARTED_FILE=/tmp/torqq-started
FINISHED_FILE=/tmp/torqq-finished
CLEAN_FILES_UP=true
fullDesc ()
{
cat << EndOfMessage
Job Id: $1
Job_Owner = ${USER}@${HOSTNAME}
job_state = R
queue = default
server = ${HOSTNAME}
Checkpoint = u
exec_host = ${HOSTNAME}
Hold_Types = n
Join_Path = n
Keep_Files = n
Mail_Points = n
Priority = 0
Rerunable = True
euser = ${USER}
submit_host = ${HOSTNAME}
EndOfMessage
}
shortRec ()
{
printf "%-23s %-11s %-8s %-16s %6s %5s %6s %9s %9s %1s %9s\n" $1 ${USER} default $1 - - - - - R -
}
# Extract the list of currently running jobs
if [ -f "$STARTED_FILE" ]; then
if [ -f "$FINISHED_FILE" ]; then
RUNNING_JOBS=`grep -Fxvf "$FINISHED_FILE" "$STARTED_FILE"`
else
RUNNING_JOBS=`cat "$STARTED_FILE"`
fi
else
exit 0
fi
# If the list is empty, all jobs are done - the files can be removed
if [[ "$RUNNING_JOBS" == "" && "$CLEAN_FILES_UP" == "true" ]]; then
rm "$STARTED_FILE" "$FINISHED_FILE"
fi
# Parse the command line and behave accordingly
while getopts ":f:u:" opt; do
case $opt in
u)
TORQQ_USER="$OPTARG"
;;
f)
for job in $RUNNING_JOBS; do
fullDesc $job
done
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo "usage:"
echo " qsub [-f] [-u user]"
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
cat << EndOfMessage
${HOSTNAME}:
Req'd Req'd Elap
Job ID Username Queue Jobname SessID NDS TSK Memory Time S Time
----------------------- ----------- -------- ---------------- ------ ----- ------ --------- --------- - ---------
EndOfMessage
for job in $RUNNING_JOBS; do
shortRec $job
done