Print

Print


Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/uiowa/uiowapfa/scripts on MAIN
submit.sh+106added 1.1
adding new PFA code

lcsim-contrib/src/main/java/org/lcsim/contrib/uiowa/uiowapfa/scripts
submit.sh added at 1.1
diff -N submit.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ submit.sh	27 May 2011 13:08:48 -0000	1.1
@@ -0,0 +1,106 @@
+#!/bin/csh
+
+##-- This is input section
+##-- Default values are defined here
+##-- All values can be changed from command line
+@ eventsPerJob = 50
+@ eventsPerFile = 500
+set nfshome = /nfs/slac/g/uiowa/u01/zaidan/batch/joboutputs
+set workdir = $nfshome/testJob
+set queue = long # xlong # xxl # 
+set inputList = list
+###############################
+
+set scriptname = $0
+set label = main
+goto $label
+
+printHelp:
+    echo ""
+    echo "Usage $scriptname [options [option arguments]] [workdir]"
+    echo ""
+    echo "  [workdir] is the path where the job should run relative to the nfs home specified by the --nfs option"
+    echo "  Options are:"
+    echo "    -h,--help: prints this help message and exits"
+    echo "    -n,--eventsPerJob number: number of events per job [default: $eventsPerJob]"
+    echo "    -N,--eventsPerFile number: number of events per file [default: $eventsPerFile]"
+    echo "    --nfs path: absolute path to the nfs home [default: $nfshome]"
+    echo "    -q,--queue queueName: name of the batch queue where to send the job [default: $queue]"
+    echo "    -i,--input file: text file containing a list of input files [default: $inputList]"
+    echo ""
+    echo "  N.B.: It is important that the [workdir] argument is passed after setting the --nfs option"
+    echo ""
+    goto $label
+
+main:
+
+set workdirSet = false
+while ($#argv != 0)
+    set arg = $1
+    if( "$arg" == "--help" || "$arg" == "-h" ) then
+	set label = done
+	goto printHelp
+    endif
+    if( "$arg" == "--eventsPerJob" || "$arg" == "-n" ) then
+	shift
+	@ eventsPerJob = $1
+    else if( "$arg" == "--eventsPerFile" || "$arg" == "-N" ) then
+	shift
+	@ eventsPerFile = $1
+    else if( "$arg" == "--nfs" ) then
+	shift
+	if( $workdirSet == true) then
+	    echo "Warning: the --nfs option should be set before the [workdir] argument: option ignored"
+	    echo "         type $scriptname --help for more info"
+	else
+	    set nfshome = $1
+	endif
+    else if( "$arg" == "--queue" || "$arg" == "-q" ) then
+	shift
+	set queue = $1
+    else if( "$arg" == "--input" || "$arg" == "-i" ) then
+	shift
+	set inputList = $1
+    else
+	set workdir = $nfshome/$1
+	set workdirSet = true
+    endif
+    shift
+end
+
+set curdir = `pwd`
+
+rm -rf $workdir
+mkdir -p $workdir
+cp java-init-cache.sh $workdir
+cd $workdir
+./java-init-cache.sh
+cd $curdir
+
+@ i = 0
+@ jobsPerFile = $eventsPerFile / $eventsPerJob
+
+foreach f (`cat $inputList`)
+    @ j = 0
+    @ skip = 0
+    while($j < $jobsPerFile)
+	set jobdir = $workdir/$i
+	rm -rf $jobdir
+	mkdir -p $jobdir
+	cp exportCLASSPATH.sh $jobdir
+	cp java-run.sh $jobdir
+	cp run-pfa.sh $jobdir
+	ln -s $workdir/.jarlist $jobdir/.jarlist
+	ln -s $workdir/.workdir $jobdir/.workdir
+	echo $f > $jobdir/list
+	echo "cd $jobdir; ./run-pfa.sh $skip $eventsPerJob list | grep -v WARNING;" > $jobdir/run.sh
+	chmod a+x $jobdir/run.sh
+	bsub -q $queue -R linux -J $1_$i -o $jobdir/job.log $jobdir/run.sh
+	@ skip = $skip + $eventPerJob
+	@ i = $i + 1
+	@ j = $j + 1
+    end
+end
+
+done:
+    exit
CVSspam 0.2.8