ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/killCondorTask.sh
Revision: 1.2
Committed: Sat Mar 19 01:49:13 2011 UTC (14 years, 1 month ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_020d, TMit_020d, Mit_020c, Mit_021pre1, Mit_020b, Mit_020a, Mit_020
Changes since 1.1: +3 -0 lines
Log Message:
Small updates here and there.

File Contents

# User Rev Content
1 paus 1.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     id=`echo $line | tr -s ' ' | cut -d ' ' -f 1`
32     runTime=`echo $line | tr -s ' ' | cut -d ' ' -f 2`
33 paus 1.2 dir=`echo $line | tr -s ' ' | cut -d ' ' -f 4`
34     file=`echo $line | tr -s ' ' | cut -d ' ' -f 5`
35 paus 1.1 echo "$id $runTime --> $line"
36     if [ $runTime -gt $TIMEOUT ]
37     then
38     echo " -> removing: condor_rm $id"
39     if [ "$EXEC" == "exec" ]
40     then
41     condor_rm $id
42 paus 1.2 echo "remove --exe $dir/$file"
43 paus 1.1 fi
44     fi
45     done
46     echo ""
47    
48     exit 0