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.1 by ahart, Wed Jun 6 12:14:37 2012 UTC vs.
Revision 1.4 by ahart, Thu Aug 9 06:36:17 2012 UTC

# Line 4 | Line 4 | use strict;
4   use Mysql;
5   use File::Copy;
6   use Getopt::Long;
7 sub printHelp;
7  
8 + sub printHelp;
9   sub outputPset;
10   sub outputRunList;
11   sub getLocation;
12   sub outputCondor;
13  
14 < our $db;
14 > our $db = Mysql->connect ("cmshead", "ntuple", "osuT3User");
15  
16   my %opt;
17   Getopt::Long::Configure ("bundling");
# Line 109 | Line 109 | getLocation
109    my $dataset = shift;
110  
111    my $results;
112 <  $db = Mysql->connect ("cmshead", "ntuple", "osuT3User");
113 <  my $query = "select user,creationTime,location,nFiles,status from ntuple where dataset='$dataset' order by lastUpdateTime";
112 >  my $queryDataset = $dataset;
113 >  $queryDataset =~ s/\*/%/g;
114 >  $queryDataset =~ s/(.*)/%$1%/g;
115 >  my $query = "select dataset,user,creationTime,location,nFiles,status from ntuple where dataset like '$queryDataset' and status='present' order by creationTime";
116    $db->selectdb ("ntuple");
117    $results = $db->query ($query);
118    if ($results->numrows () == 1)
119      {
120        my @row = $results->fetchrow ();
121 <      return ($row[2], $row[3], $row[4]);
121 >      return ($row[3], $row[4], $row[5]);
122      }
123    if ($results->numrows () == 0)
124      {
# Line 129 | Line 131 | getLocation
131    for (my $i = 1; $i <= $results->numrows (); $i++)
132      {
133        my @row = $results->fetchrow ();
134 <      $map{"$i"} = [$row[2], $row[3], $row[4]];
135 <      print "($i) created by $row[0] on $row[1]\n";
134 >      $map{"$i"} = [$row[3], $row[4], $row[5]];
135 >      printf "(%2d) $row[0]\n", $i;
136 >      print "     created by $row[1] on $row[2]\n";
137      }
138    print "\nWhich dataset would you like to use?: ";
139    my $response = <STDIN>;
# Line 173 | Line 176 | printHelp
176    my $exeName = $0;
177    $exeName =~ s/^.*\/([^\/]*)$/$1/;
178  
179 <  print "Usage: $exeName [OPTION] DATASET CONFIG DIRECTORY NJOBS\n";
179 >  print "Usage: $exeName [OPTION]... DATASET CONFIG DIRECTORY NJOBS\n";
180    print "Submits CMSSW jobs to the OSU Tier 3 compute nodes using Condor.\n";
181    print "\n";
182    printf "%-29s%s\n", "  -h, --help", "print this help message";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines