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

Comparing UserCode/OSUT3Analysis/DBTools/scripts/osudb (file contents):
Revision 1.19 by ahart, Fri Jan 25 21:52:38 2013 UTC vs.
Revision 1.23 by ahart, Thu Feb 7 09:04:47 2013 UTC

# Line 21 | Line 21 | our $db = Mysql->connect ("cmshead.mps.o
21  
22   my %opt;
23   Getopt::Long::Configure ("bundling");
24 < GetOptions (\%opt, "comment|c=s", "format|f=s", "pyConfig|p=s", "crabCfg|b=s", "jsonFile|j=s", "lumiSummary|s=s", "location|l=s", "name|n=s", "fileList|t=s", "release|r=s", "other|o", "recipe|e=s", "help|h");
24 > GetOptions (\%opt, "comment|c=s", "format|f=s", "pyConfig|p=s", "crabCfg|b=s", "jsonFile|j=s", "lumiSummary|s=s", "location|l=s", "name|n=s", "fileList|t=s", "release|r=s", "other|o", "recipe|e=s", "globalTag|g=s", "configName|i=s", "xSection|x=s", "help|h");
25   my $argc = @ARGV;
26  
27   printHelp ($ARGV[0]) if $opt{"help"};
# Line 86 | Line 86 | else
86          print "This location is already registered in the database!\n";
87          exit;
88        }
89 <    dbUpdate ($id, $fullDataset, "$ENV{'USER'}\@$ENV{'HOSTNAME'}", $opt{"format"}, $opt{"location"}, $opt{"name"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}) if !$opt{"other"};
89 >    dbUpdate ($id, $fullDataset, "$ENV{'USER'}\@$ENV{'HOSTNAME'}", $opt{"format"}, $opt{"location"}, $opt{"name"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}, $opt{"globalTag"}, $opt{"configName"}, $opt{"xSection"}) if !$opt{"other"};
90      dbUpdateOther ($id, $opt{"comment"}, "$ENV{'USER'}\@$ENV{'HOSTNAME'}") if $opt{"other"};
91      dbDelete ($id) if $ARGV[0] eq "deleteEntry" && !$opt{"other"};
92      dbDeleteOther ($id) if $ARGV[0] eq "deleteEntry" && $opt{"other"};
# Line 191 | Line 191 | dbUpdate
191    my $jsonFileName = shift;
192    my $lumiSummaryName = shift;
193    my $release = shift;
194 +  my $globalTag = shift;
195 +  my $configName = shift;
196 +  my $xSection = shift;
197  
198    my $user = $userAndHost;
199    $user =~ s/@.*$//g;
# Line 262 | Line 265 | dbUpdate
265        close (LUMI_SUMMARY);
266        $lumiSummary = join ("", @lumiSummary);
267      }
268 <  if ($release)
266 <    {
267 <      my $query = "select id from ntupleRelease where name='$release'";
268 <      $db->selectdb ("ntuple");
269 <      my $results = $db->query ($query);
270 <      if ($results->numrows () != 1)
271 <        {
272 <          print "Ntuple release \"$release\" not found!\n";
273 <          exit;
274 <        }
275 <    }
268 >  $release .= ".$configName" if $configName;
269    ($nFiles, $size) = sizeOfDataset ($dataset, $location, $fileList);
270    my $fullLocation = $location;
271    $fullLocation = "$ENV{'PWD'}/$location" if !($location =~ m/^\//);
# Line 290 | Line 283 | dbUpdate
283    $status = addSlashes ($status);
284    $comment = addSlashes ($comment);
285    $release = addSlashes ($release);
286 +  $globalTag = addSlashes ($globalTag);
287  
288    my $results;
289    my $query;
# Line 314 | Line 308 | dbUpdate
308        my $id = 1;
309        $id = $row[0] + 1 if $results->numrows ();
310  
311 <      $query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, lastUpdateUser, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version) values ($id, '$dataset', now(), now(), '$userAndHost', '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release')";
311 >      $query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, lastUpdateUser, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version, globalTag, crossSectionInPicobarn) values ($id, '$dataset', now(), now(), '$userAndHost', '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release', '$globalTag', $xSection)";
312      }
313    if ($id > 0)
314      {
# Line 351 | Line 345 | dbUpdate
345        $values .= ", jsonFile='$jsonFile'" if $jsonFile;
346        $values .= ", lumiSummary='$lumiSummary'" if $lumiSummary;
347        $values .= ", version='$release'" if $release;
348 +      $values .= ", globalTag='$globalTag'" if $globalTag;
349 +      $values .= ", crossSectionInPicobarn=$xSection" if $xSection;
350  
351        $values =~ s/^, //;
352        $query = "update ntuple set $values where id=$id";
# Line 414 | Line 410 | printHelp
410        printf "%-29s%s\n", "  -b, --crabCfg FILE", "CRAB config used to submit ntuple jobs";
411        printf "%-29s%s\n", "  -c, --comment COMMENT", "comment for the database entry";
412        printf "%-29s%s\n", "  -f, --format FORMAT", "ntuple format (default: BEAN)";
413 +      printf "%-29s%s\n", "  -g, --globalTag TAG", "global tag";
414 +      printf "%-29s%s\n", "  -i, --configName NAME", "name of config used to produce ntuples";
415        printf "%-29s%s\n", "  -j, --jsonFile FILE", "JSON file used for this dataset";
416        printf "%-29s%s\n", "  -l, --location DIRECTORY", "directory containing the ntuples";
417        printf "%-29s%s\n", "  -p, --pyConfig FILE", "Python config used to produce ntuples";
418        printf "%-29s%s\n", "  -r, --release NAME", "ntuple release used to produce ntuples";
419        printf "%-29s%s\n", "  -s, --lumiSummary FILE", "lumiSummary.json reported by CRAB";
420 +      printf "%-29s%s\n", "  -x, --xSection XSEC", "cross section in picobarns for the sample";
421      }
422    elsif ($command eq "createOther")
423      {
# Line 437 | Line 436 | printHelp
436        printf "%-29s%s\n", "  -b, --crabCfg FILE", "CRAB config used to submit ntuple jobs";
437        printf "%-29s%s\n", "  -c, --comment COMMENT", "comment for the database entry";
438        printf "%-29s%s\n", "  -f, --format FORMAT", "ntuple format";
439 +      printf "%-29s%s\n", "  -g, --globalTag TAG", "global tag";
440 +      printf "%-29s%s\n", "  -i, --configName NAME", "name of config used to produce ntuples";
441        printf "%-29s%s\n", "  -j, --jsonFile FILE", "JSON file used for this dataset";
442        printf "%-29s%s\n", "  -l, --location DIRECTORY", "directory containing the ntuples";
443        printf "%-29s%s\n", "  -n, --name NAME", "rename the entry";
# Line 444 | Line 445 | printHelp
445        printf "%-29s%s\n", "  -p, --pyConfig FILE", "Python config used to produce ntuples";
446        printf "%-29s%s\n", "  -r, --release NAME", "ntuple release used to produce ntuples";
447        printf "%-29s%s\n", "  -s, --lumiSummary FILE", "lumiSummary.json reported by CRAB";
448 +      printf "%-29s%s\n", "  -x, --xSection XSEC", "cross section in picobarns for the sample";
449      }
450    elsif ($command eq "finish")
451      {
# Line 633 | Line 635 | downloadRelease
635        print "Ntuple release \"$release\" not found!\n";
636        exit;
637      }
636  if (!(-e "/home/osucms/public_html/releases/$release.tar.gz"))
637    {
638      print "Release is in the database but no package exists!\n";
639      exit;
640    }
638    if ($pyConfigName)
639      {
640        my @row = $results->fetchrow ();
# Line 645 | Line 642 | downloadRelease
642        print PY_CONFIG $row[1];
643        close (PY_CONFIG);
644      }
645 <  copy ("/home/osucms/public_html/releases/$release.tar.gz", "$release.tar.gz");
645 >  `wget "http://cmshead.mps.ohio-state.edu/~osucms/releases/$release.tar.gz"`;
646   }
647  
648   sub

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines