#! /usr/local/bin/tcsh -f # ----------------------------------------------------------------------------- # # Name : check_concat_log_DCAF.tcsh # # Purpose : Check log files from a concatenation job that was run on a DCAF. # # Usage : check_concat_log_DCAF.tcsh [] # # Arguements : # = directory holding the concat output datafile # e.g., /export/cdfdata/concatenated_files/ttopti # NB: have not yet tested the following # e.g., root://fcdfdata031.fnal.gov//cdf/scratch/cdfmc/snihur/concatenated_files/ttopti # = the name of the logfile # e.g., AC++Dump-concat.0001.ac.log # # Created : 2004-07-07 Rob Snihur Change code RMS20040707 # # ----------------------------------------------------------------------------- echo $$ $0 $* if ( $# < 1 ) then # Require correct number of input arguments. echo "BAD input arguments $*" exit 6 endif set d = $1 # The datafile_dir. #set log = `ls stnmaker_prod-concat*.log` #set name_stub = "stnmaker_prod-concat" set log = `ls stnmaker_prod-concat*.log` #if ( "x"$2 != "x" ) set name_stub = $2 if ( "x"$2 != "x" ) set log = $2 ls ${log} #set log = `ls ${name_stub}*.log` set rc = $status if ( $rc != 0 ) then echo BAD no log in pwd $PWD exit 7 endif set pattern = " Closing output file: " set output_file = (`grep -c "$pattern" $log >& /dev/null && grep "$pattern" $log | cut -f5 -d" "`) #set output_file = `grep -c "$pattern" $log >& /dev/null && grep "$pattern" $log | cut -f5 -d" "` set rc = $status if ( $rc != 0 ) then echo BAD pattern $pattern not in log $log exit 8 endif #set output_file = ${output_file:t} # Drop directory by taking tail. set output_file = (${output_file:gt}) # Drop directory by taking tail. set rc = $status if ( $rc != 0 ) then echo BAD Could not drop dir from output_file $output_file in log $log exit 9 endif #echo output_file $output_file set pattern = " of those records were phyics events" #set n1 = `grep -c "$pattern" $log >& /dev/null && grep "$pattern" $log | cut -f2 -d" "` set n1 = (`grep -c "$pattern" $log >& /dev/null && grep "$pattern" $log | cut -f2 -d" "`) set rc = $status if ( $rc != 0 ) then echo BAD pattern $pattern not in log $log with output_file $output_file exit 10 endif #echo $n1 events if ( $#output_file != $#n1 ) then echo "BAD match #output_file = $#output_file #n1 = $#n1" exit 13 endif set exe = Edm_EventLister which $exe >& /dev/null #&& which $exe set rc = $status if ( $rc != 0 ) then source ~cdfsoft/cdf2.cshrc setup cdfsoft2 which $exe >& /dev/null #&& which $exe set rc = $status if ( $rc != 0 ) then echo BAD No exe $exe for log $log with output_file $output_file exit 11 endif endif while ( $#output_file ) # Loop over output files. #set full_output_file = ${d}/${output_file} set full_output_file = ${d}/${output_file[1]} cat >! $$.in <& /dev/null if ( $rc != 0 ) then echo BAD Exe $exe returned status $rc for log $log with output_file $output_file exit 12 endif set notOK = " " #if ("$list" != "$n1") set notOK = "BAD ACTUALLY" #echo OK $log $n1 `which $exe` $full_output_file $list $notOK if ("$list" != "$n1[1]") set notOK = "BAD ACTUALLY" echo OK $log $n1[1] `which $exe` $full_output_file $list $notOK if ("$list" != "$n1[1]") exit 14 shift output_file shift n1 end