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.4 by ahart, Thu Aug 9 06:36:17 2012 UTC vs.
Revision 1.6 by ahart, Sun Sep 9 20:02:20 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 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 <  my $query = "select dataset,user,creationTime,location,nFiles,status from ntuple where dataset like '$queryDataset' and status='present' order by creationTime";
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 131 | 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 144 | 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines