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.2 by ahart, Thu Jun 14 17:42:30 2012 UTC vs.
Revision 1.7 by ahart, Tue Oct 9 10:20:47 2012 UTC

# Line 4 | Line 4 | use strict;
4   use Mysql;
5   use File::Copy;
6   use Getopt::Long;
7 + use POSIX;
8  
9   sub printHelp;
10   sub outputPset;
# Line 11 | Line 12 | sub outputRunList;
12   sub getLocation;
13   sub outputCondor;
14  
15 < our $db;
15 > our $db = Mysql->connect ("cmshead", "ntuple", "osuT3User");
16  
17   my %opt;
18   Getopt::Long::Configure ("bundling");
# Line 32 | Line 33 | if (-e $ARGV[2])
33      exit;
34    }
35   mkdir $ARGV[2];
36 < outputRunList ($ARGV[0], $ARGV[2]);
36 > my $nFiles = outputRunList ($ARGV[0], $ARGV[2]);
37 > my $nJobs = $ARGV[3];
38 > my $realNJobs = ceil ($nFiles / ceil ($nFiles / $nJobs));
39   outputPset ($ARGV[2]);
40 < outputCondor ($ARGV[2], $ARGV[3]);
40 > outputCondor ($ARGV[2], $realNJobs);
41   copy ($ARGV[1], "$ARGV[2]/userConfig_cfg.py");
42   chdir $ARGV[2];
43 + print "Submitting $realNJobs jobs to run on $nFiles files.\n";
44   system ("condor_submit condor.sub");
45  
46   sub
# Line 70 | Line 74 | outputRunList
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";
# Line 101 | Line 105 | outputRunList
105      }
106    print RUNLIST "]";
107    close (RUNLIST);
108 +  if ($crossSection && $crossSection >= 0.0)
109 +    {
110 +      open (CROSS_SECTION, ">$workingDir/crossSectionInPicobarn.txt");
111 +      print CROSS_SECTION "$crossSection\n";
112 +      close (CROSS_SECTION);
113 +    }
114 +
115 +  return $nFiles;
116   }
117  
118   sub
# Line 112 | Line 124 | getLocation
124    my $queryDataset = $dataset;
125    $queryDataset =~ s/\*/%/g;
126    $queryDataset =~ s/(.*)/%$1%/g;
127 <  $db = Mysql->connect ("cmshead", "ntuple", "osuT3User");
116 <  my $query = "select dataset,user,creationTime,location,nFiles,status from ntuple where dataset like '$queryDataset' order by lastUpdateTime";
127 >  my $query = "select dataset,user,creationTime,location,nFiles,status,crossSectionInPicobarn from ntuple where dataset like '$queryDataset' and status='present' order by creationTime";
128    $db->selectdb ("ntuple");
129    $results = $db->query ($query);
130    if ($results->numrows () == 1)
131      {
132        my @row = $results->fetchrow ();
133 <      return ($row[3], $row[4], $row[5]);
133 >      return ($row[3], $row[4], $row[5], $row[6]);
134      }
135    if ($results->numrows () == 0)
136      {
# Line 132 | Line 143 | getLocation
143    for (my $i = 1; $i <= $results->numrows (); $i++)
144      {
145        my @row = $results->fetchrow ();
146 <      $map{"$i"} = [$row[3], $row[4], $row[5]];
146 >      $map{"$i"} = [$row[3], $row[4], $row[5], $row[6]];
147        printf "(%2d) $row[0]\n", $i;
148        print "     created by $row[1] on $row[2]\n";
149      }
# Line 145 | Line 156 | getLocation
156        exit;
157      }
158  
159 <  return ($map{$response}[0], $map{$response}[1], $map{$response}[2]);
159 >  return ($map{$response}[0], $map{$response}[1], $map{$response}[2], $map{$response}[3]);
160   }
161  
162   sub
# Line 166 | Line 177 | outputCondor
177    print SUB "Error                   = condor_\$(Process).err\n";
178    print SUB "Log                     = condor_\$(Process).log\n";
179    print SUB "\n";
180 +  print SUB "+IsLocalJob             = true\n";
181 +  print SUB "Rank                    = TARGET.IsLocalSlot\n";
182 +  print SUB "\n";
183    print SUB "Queue $nJobs\n";
184  
185    close (SUB);
# Line 177 | Line 191 | printHelp
191    my $exeName = $0;
192    $exeName =~ s/^.*\/([^\/]*)$/$1/;
193  
194 <  print "Usage: $exeName [OPTIONS] DATASET CONFIG DIRECTORY NJOBS\n";
194 >  print "Usage: $exeName [OPTION]... DATASET CONFIG DIRECTORY NJOBS\n";
195    print "Submits CMSSW jobs to the OSU Tier 3 compute nodes using Condor.\n";
196    print "\n";
197    printf "%-29s%s\n", "  -h, --help", "print this help message";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines