ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/killCondorTask.sh
Revision: 1.4
Committed: Mon Sep 19 21:45:41 2011 UTC (13 years, 7 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_025c_branch1, Mit_025c_branch0, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2
Branch point for: Mit_025c_branch
Changes since 1.3: +3 -1 lines
Log Message:
Reinstate the bin and python areas.

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"
42 if [ "$EXEC" == "exec" ]
43 then
44 condor_rm $id
45 echo "remove --exe $dir/$file"
46 fi
47 fi
48 done
49 echo ""
50
51 exit 0