ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/killCondorTask.sh
Revision: 1.3
Committed: Sun Apr 24 03:18:33 2011 UTC (14 years ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_021, Mit_021pre2
Changes since 1.2: +1 -0 lines
Log Message:
Last update before creating version 021.

File Contents

# Content
1 #!/bin/bash
2 #---------------------------------------------------------------------------------------------------
3 # Remove all jobs related with a given task and sample.
4 #---------------------------------------------------------------------------------------------------
5 H=`basename $0`
6 TASK=$1
7 SAMPLE=$2
8 TIMEOUT=$3
9 EXEC=$4
10
11 # health checks
12 if [ ".$1" == "." ] || [ ".$2" == "." ]
13 then
14 echo "";
15 echo "usage: $H <sample> <task>";
16 echo ""
17 exit 1
18 fi
19
20 # say what we do
21 echo ""
22 echo " ==== Kill local condor jobs matching Sample=$SAMPLE and Task=$TASK ===="
23 echo ""
24
25 # loop through jobs matching the requirements
26 export idxs=""
27 condor_q -format "%d " ClusterId -format "%d " ServerTime-JobStartDate -format "%s " Cmd -format "%s\n " Args | \
28 grep $TASK | grep $SAMPLE | \
29 while read line
30 do
31 echo "Line: $line"
32 id=`echo $line | tr -s ' ' | cut -d ' ' -f 1`
33 runTime=`echo $line | tr -s ' ' | cut -d ' ' -f 2`
34 dir=`echo $line | tr -s ' ' | cut -d ' ' -f 4`
35 file=`echo $line | tr -s ' ' | cut -d ' ' -f 5`
36 echo "$id $runTime --> $line"
37 if [ $runTime -gt $TIMEOUT ]
38 then
39 echo " -> removing: condor_rm $id"
40 if [ "$EXEC" == "exec" ]
41 then
42 condor_rm $id
43 echo "remove --exe $dir/$file"
44 fi
45 fi
46 done
47 echo ""
48
49 exit 0