37 |
|
my $nJobs = $ARGV[3]; |
38 |
|
my $realNJobs = ceil ($nFiles / ceil ($nFiles / $nJobs)); |
39 |
|
outputPset ($ARGV[2]); |
40 |
< |
outputCondor ($ARGV[2], $realNJobs); |
40 |
> |
outputCondor ($ARGV[2], $realNJobs, $ARGV[0]); |
41 |
|
copy ($ARGV[1], "$ARGV[2]/userConfig_cfg.py"); |
42 |
|
chdir $ARGV[2]; |
43 |
|
print "Submitting $realNJobs jobs to run on $nFiles files.\n"; |
74 |
|
my $dataset = shift; |
75 |
|
my $workingDir = shift; |
76 |
|
|
77 |
< |
my ($location, $nFiles, $status) = getLocation ($dataset); |
77 |
> |
my ($location, $nFiles, $status, $crossSection) = getLocation ($dataset); |
78 |
|
if ($status ne "present") |
79 |
|
{ |
80 |
|
print "This dataset is not marked as present on the Tier 3!\n"; |
81 |
< |
exit; |
81 |
> |
print "Continue anyway? (y/N): "; |
82 |
> |
my $response = <STDIN>; |
83 |
> |
$response =~ s/\n//g; |
84 |
> |
exit if !$response || lc ($response) ne "y"; |
85 |
|
} |
86 |
|
if (!(-e $location)) |
87 |
|
{ |
94 |
|
if (@files - 2 != $nFiles) |
95 |
|
{ |
96 |
|
print "Number of files does not match database entry!\n"; |
97 |
< |
exit; |
97 |
> |
print "Continue anyway? (y/N): "; |
98 |
> |
my $response = <STDIN>; |
99 |
> |
$response =~ s/\n//g; |
100 |
> |
exit if !$response || lc ($response) ne "y"; |
101 |
|
} |
102 |
|
open (RUNLIST, ">$workingDir/runList.py"); |
103 |
|
print RUNLIST "runList = [\n"; |
111 |
|
} |
112 |
|
print RUNLIST "]"; |
113 |
|
close (RUNLIST); |
114 |
+ |
if ($crossSection && $crossSection >= 0.0) |
115 |
+ |
{ |
116 |
+ |
open (CROSS_SECTION, ">$workingDir/crossSectionInPicobarn.txt"); |
117 |
+ |
print CROSS_SECTION "$crossSection\n"; |
118 |
+ |
close (CROSS_SECTION); |
119 |
+ |
} |
120 |
|
|
121 |
|
return $nFiles; |
122 |
|
} |
130 |
|
my $queryDataset = $dataset; |
131 |
|
$queryDataset =~ s/\*/%/g; |
132 |
|
$queryDataset =~ s/(.*)/%$1%/g; |
133 |
< |
my $query = "select dataset,user,creationTime,location,nFiles,status from ntuple where dataset like '$queryDataset' and status='present' order by creationTime"; |
133 |
> |
my $query = "select dataset,user,creationTime,location,nFiles,status,crossSectionInPicobarn from ntuple where dataset like '$queryDataset' order by creationTime"; |
134 |
|
$db->selectdb ("ntuple"); |
135 |
|
$results = $db->query ($query); |
136 |
|
if ($results->numrows () == 1) |
137 |
|
{ |
138 |
|
my @row = $results->fetchrow (); |
139 |
< |
return ($row[3], $row[4], $row[5]); |
139 |
> |
return ($row[3], $row[4], $row[5], $row[6]); |
140 |
|
} |
141 |
|
if ($results->numrows () == 0) |
142 |
|
{ |
149 |
|
for (my $i = 1; $i <= $results->numrows (); $i++) |
150 |
|
{ |
151 |
|
my @row = $results->fetchrow (); |
152 |
< |
$map{"$i"} = [$row[3], $row[4], $row[5]]; |
152 |
> |
$map{"$i"} = [$row[3], $row[4], $row[5], $row[6]]; |
153 |
|
printf "(%2d) $row[0]\n", $i; |
154 |
|
print " created by $row[1] on $row[2]\n"; |
155 |
|
} |
162 |
|
exit; |
163 |
|
} |
164 |
|
|
165 |
< |
return ($map{$response}[0], $map{$response}[1], $map{$response}[2]); |
165 |
> |
return ($map{$response}[0], $map{$response}[1], $map{$response}[2], $map{$response}[3]); |
166 |
|
} |
167 |
|
|
168 |
|
sub |
170 |
|
{ |
171 |
|
my $workingDir = shift; |
172 |
|
my $nJobs = shift; |
173 |
+ |
my $dataset = shift; |
174 |
|
|
175 |
|
my $cmsRun = `which cmsRun`; |
176 |
|
open (SUB, ">$workingDir/condor.sub"); |
178 |
|
print SUB "Executable = $cmsRun\n"; |
179 |
|
print SUB "Universe = vanilla\n"; |
180 |
|
print SUB "Getenv = True\n"; |
181 |
< |
print SUB "Arguments = config_cfg.py $nJobs \$(Process)\n"; |
181 |
> |
print SUB "Arguments = config_cfg.py True $nJobs \$(Process) $dataset\n"; |
182 |
|
print SUB "\n"; |
183 |
|
print SUB "Output = condor_\$(Process).out\n"; |
184 |
|
print SUB "Error = condor_\$(Process).err\n"; |
185 |
|
print SUB "Log = condor_\$(Process).log\n"; |
186 |
|
print SUB "\n"; |
187 |
+ |
print SUB "+IsLocalJob = true\n"; |
188 |
+ |
print SUB "Rank = TARGET.IsLocalSlot\n"; |
189 |
+ |
print SUB "\n"; |
190 |
|
print SUB "Queue $nJobs\n"; |
191 |
|
|
192 |
|
close (SUB); |