forked from gregorgorjanc/GorjancShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc_sge.sh
82 lines (72 loc) · 1.75 KB
/
func_sge.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
# Sun Grid Engine (SGE) functions
#-------------------------------------------------------------------------------
# QSTATJ & QSTATL & QSTATALL & QSTATALLL
#-------------------------------------------------------------------------------
# What: qstatj - job names
# qstatl - qstat | less
# qstatall - qstat of all users
# qstatalll - qstat of all users | less
# Who: Gregor Gorjanc
# When:
# * 2014-05 Initial version
#-------------------------------------------------------------------------------
qstatj()
{
for j in $(qstat | awk 'NR>1 { print $1 }'); do
echo $j $(qstat -j $j | grep job_name)
done
}
export -f qstatj
qstatl()
{
qstat | less
}
export -f qstatl
qstatall()
{
qstat -u "*"
}
export -f qstatall
qstatalll()
{
qstat -u "*" | less
}
export -f qstatalll
# QSTATR
#-------------------------------------------------------------------------------
# What: qstat with refresh
# Who: Kenton D'Mellow
# When:
# * 2014-04 Initial version
#-------------------------------------------------------------------------------
qstatr()
{
clear
TMPFILE=`mktemp -t 2>&1`
rm -f $TMPFILE
mkfifo $TMPFILE
( cat $TMPFILE & )
while ( `qstat $1 -u $USER|grep . > $TMPFILE` ); do
( cat $TMPFILE & )
sleep 10
clear
done
rm -f $TMPFILE
}
export -f qstatr
# QDELALL
#-------------------------------------------------------------------------------
# What: qdel all the jobs in a queue
# Who: Gregor Gorjanc
# When:
# * 2014-05 Initial version
#-------------------------------------------------------------------------------
qdelall()
{
echo "Are you sure (y/N)? This will kill all the jobs in a queue!!!"
read YORN
if [ "$YORN" == "Y" -o "$YORN" == "y" ]; then
qdel $(qstat | awk 'NR>2 { print $1 }')
fi
}
export -f qdelall