ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/DBTools/scripts/osusub
(Generate patch)

Comparing UserCode/OSUT3Analysis/DBTools/scripts/osusub (file contents):
Revision 1.15 by ahart, Mon Mar 25 18:26:58 2013 UTC vs.
Revision 1.19 by ahart, Thu Jun 6 20:53:32 2013 UTC

# Line 5 | Line 5 | use Mysql;
5   use File::Copy;
6   use Getopt::Long;
7   use POSIX;
8 + use Term::ANSIColor;
9  
10   sub printHelp;
11   sub outputPset;
# Line 16 | Line 17 | our $db = Mysql->connect ("cmshead", "nt
17  
18   my %opt;
19   Getopt::Long::Configure ("bundling");
20 < GetOptions (\%opt, "maxEvents|m=s", "help|h");
20 > GetOptions (\%opt, "label|l=s", "maxEvents|m=s", "help|h");
21   my $argc = @ARGV;
22  
23   printHelp () if $opt{"help"};
# Line 58 | Line 59 | my $eventsPerJob = -1;
59   $eventsPerJob = ceil ($opt{"maxEvents"} / $realNJobs) if $opt{"maxEvents"} && $opt{"maxEvents"} >= 0;
60   my $realMaxEvents = $eventsPerJob * $realNJobs;
61   outputPset ($directory, $dataset, $opt{"maxEvents"}, $eventsPerJob);
62 < outputCondor ("$ENV{'CMSSW_BASE'}/src/OSUT3Analysis/DBTools/data/condor.sub", $directory, $realNJobs, $dataset);
62 > outputCondor ("$ENV{'CMSSW_BASE'}/src/OSUT3Analysis/DBTools/data/condor.sub", $directory, $realNJobs, $dataset, $opt{"label"});
63   copy ($config, "$directory/userConfig_cfg.py");
64   chdir $directory;
65   print "Submitting $realNJobs jobs to run on $realMaxEvents events in $nFiles files.\n" if $realMaxEvents >= 0;
66   print "Submitting $realNJobs jobs to run on all events in $nFiles files.\n" if $realMaxEvents < 0;
67 < system ("condor_submit condor.sub");
67 > system ("LD_LIBRARY_PATH=/usr/lib64/condor:\$LD_LIBRARY_PATH condor_submit condor.sub");
68  
69   sub
70   outputPset
# Line 197 | Line 198 | getLocation
198    for (my $i = 1; $i <= $results->numrows (); $i++)
199      {
200        my @row = $results->fetchrow ();
201 +      $row[2] =~ s/([^ ]*) [^ ]*/$1/g;
202        $map{"$i"} = [$row[3], $row[4], $row[5], $row[7]] if $row[7];
203        $map{"$i"} = [$row[3], $row[4], $row[5], $row[6]] if !$row[7];
204        printf "(%2d) $row[0]\n", $i;
205 <      print "     created by $row[1] on $row[2]\n";
205 >      print "     (";
206 >      print color "green" if $row[5] eq "present";
207 >      print color "bold yellow" if $row[5] eq "submitted";
208 >      print color "bold red" if $row[5] eq "created" or $row[5] eq "cancelled" or $row[5] eq "deprecated";
209 >      print $row[5];
210 >      print color "reset";
211 >      print ") created by $row[1] on $row[2]\n";
212      }
213    print "\nWhich dataset would you like to use?: ";
214    my $response = <STDIN>;
# Line 221 | Line 229 | outputCondor
229    my $workingDir = shift;
230    my $nJobs = shift;
231    my $dataset = shift;
232 +  my $label = shift;
233  
234    my $cmsRun = `which cmsRun`;
235    my $condorFile = "";
236  
237    if (!(-e $condorFileName))
238      {
239 +      my $arguments = "Arguments               = config_cfg.py True $nJobs \$(Process)";
240 +      $arguments .= " $dataset" if $dataset;
241 +      $arguments .= " NULL" if !$dataset;
242 +      $arguments .= " $label" if $label;
243 +      $arguments .= " NULL" if !$label;
244 +      $arguments .= "\n";
245 +
246        $condorFile .= "Executable              = $cmsRun\n";
247        $condorFile .= "Universe                = vanilla\n";
248        $condorFile .= "Getenv                  = True\n";
249 <      $condorFile .= "Arguments               = config_cfg.py True $nJobs \$(Process) $dataset\n" if $dataset;
234 <      $condorFile .= "Arguments               = config_cfg.py True $nJobs \$(Process) NULL\n" if !$dataset;
249 >      $condorFile .= $arguments;
250        $condorFile .= "\n";
251        $condorFile .= "Output                  = condor_\$(Process).out\n";
252        $condorFile .= "Error                   = condor_\$(Process).err\n";
# Line 252 | Line 267 | outputCondor
267        $condorFile =~ s/\$nJobs/$nJobs/g;
268        $condorFile =~ s/\$dataset/$dataset/g if $dataset;
269        $condorFile =~ s/\$dataset/NULL/g if !$dataset;
270 +      $condorFile =~ s/\$label/$label/g if $label;
271 +      $condorFile =~ s/\$label/NULL/g if !$label;
272      }
273  
274    open (SUB, ">$workingDir/condor.sub");
# Line 269 | Line 286 | printHelp
286    print "Submits CMSSW jobs to the OSU Tier 3 compute nodes using Condor.\n";
287    print "\n";
288    printf "%-29s%s\n", "  -h, --help", "print this help message";
289 +  printf "%-29s%s\n", "  -l, --label LABEL", "give the dataset a short label";
290    printf "%-29s%s\n", "  -m, --maxEvents N", "only run over N events in the dataset; default is";
291    printf "%-29s%s\n", " ", "to run over all events";
292    print "\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines