58 |
|
$eventsPerJob = ceil ($opt{"maxEvents"} / $realNJobs) if $opt{"maxEvents"} && $opt{"maxEvents"} >= 0; |
59 |
|
my $realMaxEvents = $eventsPerJob * $realNJobs; |
60 |
|
outputPset ($directory, $dataset, $opt{"maxEvents"}, $eventsPerJob); |
61 |
< |
outputCondor ($directory, $realNJobs, $dataset); |
61 |
> |
outputCondor ("$ENV{'CMSSW_BASE'}/src/OSUT3Analysis/DBTools/data/condor.sub", $directory, $realNJobs, $dataset); |
62 |
|
copy ($config, "$directory/userConfig_cfg.py"); |
63 |
|
chdir $directory; |
64 |
|
print "Submitting $realNJobs jobs to run on $realMaxEvents events in $nFiles files.\n" if $realMaxEvents >= 0; |
215 |
|
sub |
216 |
|
outputCondor |
217 |
|
{ |
218 |
+ |
my $condorFileName = shift; |
219 |
|
my $workingDir = shift; |
220 |
|
my $nJobs = shift; |
221 |
|
my $dataset = shift; |
222 |
|
|
223 |
|
my $cmsRun = `which cmsRun`; |
224 |
< |
open (SUB, ">$workingDir/condor.sub"); |
224 |
> |
my $condorFile = ""; |
225 |
|
|
226 |
< |
print SUB "Executable = $cmsRun\n"; |
227 |
< |
print SUB "Universe = vanilla\n"; |
228 |
< |
print SUB "Getenv = True\n"; |
229 |
< |
print SUB "Arguments = config_cfg.py True $nJobs \$(Process) $dataset\n" if $dataset; |
230 |
< |
print SUB "Arguments = config_cfg.py True $nJobs \$(Process) NULL\n" if !$dataset; |
231 |
< |
print SUB "\n"; |
232 |
< |
print SUB "Output = condor_\$(Process).out\n"; |
233 |
< |
print SUB "Error = condor_\$(Process).err\n"; |
234 |
< |
print SUB "Log = condor_\$(Process).log\n"; |
235 |
< |
print SUB "\n"; |
236 |
< |
print SUB "+IsLocalJob = true\n"; |
237 |
< |
print SUB "Rank = TARGET.IsLocalSlot\n"; |
238 |
< |
print SUB "\n"; |
239 |
< |
print SUB "Queue $nJobs\n"; |
226 |
> |
if (!(-e $condorFileName)) |
227 |
> |
{ |
228 |
> |
$condorFile .= "Executable = $cmsRun\n"; |
229 |
> |
$condorFile .= "Universe = vanilla\n"; |
230 |
> |
$condorFile .= "Getenv = True\n"; |
231 |
> |
$condorFile .= "Arguments = config_cfg.py True $nJobs \$(Process) $dataset\n" if $dataset; |
232 |
> |
$condorFile .= "Arguments = config_cfg.py True $nJobs \$(Process) NULL\n" if !$dataset; |
233 |
> |
$condorFile .= "\n"; |
234 |
> |
$condorFile .= "Output = condor_\$(Process).out\n"; |
235 |
> |
$condorFile .= "Error = condor_\$(Process).err\n"; |
236 |
> |
$condorFile .= "Log = condor_\$(Process).log\n"; |
237 |
> |
$condorFile .= "\n"; |
238 |
> |
$condorFile .= "+IsLocalJob = true\n"; |
239 |
> |
$condorFile .= "Rank = TARGET.IsLocalSlot\n"; |
240 |
> |
$condorFile .= "\n"; |
241 |
> |
$condorFile .= "Queue $nJobs\n"; |
242 |
> |
} |
243 |
> |
else |
244 |
> |
{ |
245 |
> |
open (SUB, "<$condorFileName"); |
246 |
> |
my @condorFile = <SUB>; |
247 |
> |
close (SUB); |
248 |
> |
$condorFile = join ("", @condorFile); |
249 |
> |
$condorFile =~ s/\$cmsRun/$cmsRun/g; |
250 |
> |
$condorFile =~ s/\$nJobs/$nJobs/g; |
251 |
> |
$condorFile =~ s/\$dataset/$dataset/g if $dataset; |
252 |
> |
$condorFile =~ s/\$dataset/NULL/g if !$dataset; |
253 |
> |
} |
254 |
|
|
255 |
+ |
open (SUB, ">$workingDir/condor.sub"); |
256 |
+ |
print SUB $condorFile; |
257 |
|
close (SUB); |
258 |
|
} |
259 |
|
|