File indexing completed on 2025-08-05 08:11:09
0001
0002
0003 export TargetDir="$PWD"/condorout
0004
0005 if [ -d ${TargetDir} ]; then
0006 if [ -d ${TargetDir}/OutDir0 ]; then
0007 rm -rf ${TargetDir}/OutDir*
0008 fi
0009 else
0010 mkdir ${TargetDir}
0011 fi
0012
0013 i=0
0014 while read dir; do
0015 li=$(printf "%04d" $i)
0016
0017 rm inputdata.txt
0018
0019
0020 for file in /sphenix/lustre01/sphnxpro/commissioning/DST_ana.387_2023p003/DST_CALOR-000"$dir"-*.root
0021 do
0022 cat >>inputdata.txt<< EOF
0023 $file
0024 EOF
0025 done
0026
0027 j=10
0028 tot_files=$( cat inputdata.txt | wc -l )
0029 echo "total files: $tot_files"
0030 rem=$(( $tot_files%$j ))
0031 files_per_job=$(( $tot_files/$j ))
0032 njob=$j
0033 if [ $rem -ne 0 ]; then
0034 files_per_job=$(( $files_per_job+1 ))
0035 fi
0036 rem2=$(( $tot_files%$files_per_job ))
0037 njob=$(( $tot_files/$files_per_job ))
0038 if [ $rem2 -ne 0 ]; then
0039 njob=$(( ($tot_files/$files_per_job)+1 ))
0040 fi
0041 echo "files per job: $files_per_job"
0042 echo "njob: $njob"
0043
0044
0045 for((q=0;q<$njob;q++));
0046 do
0047
0048 mkdir ${TargetDir}/OutDir$i
0049 export WorkDir="${TargetDir}/OutDir$i"
0050 echo "WorkDir:" ${WorkDir}
0051 start_file=$(( $q*$files_per_job+1 ))
0052 end_file=$(( $start_file+$files_per_job-1 ))
0053 echo "start file: $start_file end file: $end_file"
0054
0055 sed -n $start_file\,${end_file}p inputdata.txt > tmp.txt
0056 mv tmp.txt ${WorkDir}/inputdata.txt
0057
0058 pushd ${WorkDir}
0059
0060
0061
0062 cp -v "$PWD"/../../CondorRun.sh CondorRunJob$li.sh
0063
0064 chmod +x CondorRunJob$li.sh
0065
0066
0067 cat >>ff.sub<< EOF
0068 +JobFlavour = "workday"
0069 transfer_input_files = ${WorkDir}/CondorRunJob$li.sh, ${WorkDir}/input.txt
0070 Executable = CondorRunJob$li.sh
0071 request_memory = 10GB
0072 Universe = vanilla
0073 Notification = Never
0074 GetEnv = True
0075 Priority = +12
0076 Output = condor.out
0077 Error = condor.err
0078 Log = /tmp/condor$li.log
0079 Notify_user = bs3402@columbia.edu
0080
0081 Queue
0082 EOF
0083
0084 condor_submit ff.sub
0085 popd
0086
0087 i=$((i+1))
0088 done
0089 done < runList.txt