ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/killCondorTask.sh
Revision: 1.5
Committed: Tue Feb 28 11:54:36 2012 UTC (13 years, 2 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, HEAD
Changes since 1.4: +2 -1 lines
Log Message:
Last updates.

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 -format "%d " 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 tmp=`echo $line | tr -s ' ' | cut -d ' ' -f 3`
35 runTime=$(( $runTime + $tmp ))
36 dir=`echo $line | tr -s ' ' | cut -d ' ' -f 4`
37 file=`echo $line | tr -s ' ' | cut -d ' ' -f 5`
38 echo "$id $runTime --> $line"
39 if [ $runTime -gt $TIMEOUT ]
40 then
41 echo " -> removing: condor_rm $id; condor_rm -forcex $id; "
42 if [ "$EXEC" == "exec" ]
43 then
44 condor_rm $id
45 condor_rm -forcex $id
46 echo "remove --exe $dir/$file"
47 fi
48 fi
49 done
50 echo ""
51
52 exit 0