ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/killCondorTask.sh
Revision: 1.1
Committed: Sun Dec 5 01:01:21 2010 UTC (14 years, 5 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_020pre1, Mit_018, Mit_017
Log Message:
Next iteration with improved downloading tool.

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     echo "$id $runTime --> $line"
34     if [ $runTime -gt $TIMEOUT ]
35     then
36     echo " -> removing: condor_rm $id"
37     if [ "$EXEC" == "exec" ]
38     then
39     condor_rm $id
40     fi
41     fi
42     done
43     echo ""
44    
45     exit 0