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.12 by ahart, Mon Oct 22 12:50:07 2012 UTC vs.
Revision 1.13 by ahart, Mon Oct 22 13:50:25 2012 UTC

# Line 19 | Line 19 | our $db = Mysql->connect ("cmshead.mps.o
19  
20   my %opt;
21   Getopt::Long::Configure ("bundling");
22 < GetOptions (\%opt, "comment|c=s", "format|f=s", "pyConfig|p=s", "crabCfg|b=s", "jsonFile|j=s", "lumiSummary|s=s", "location|l=s", "fileList|t=s", "release|r=s", "other|o", "help|h");
22 > GetOptions (\%opt, "comment|c=s", "format|f=s", "pyConfig|p=s", "crabCfg|b=s", "jsonFile|j=s", "lumiSummary|s=s", "location|l=s", "fileList|t=s", "release|r=s", "other|o", "recipe|e=s", "help|h");
23   my $argc = @ARGV;
24  
25   printHelp ($ARGV[0]) if $opt{"help"};
# Line 30 | Line 30 | if (($ARGV[0] eq "create" || $ARGV[0] eq
30      print "The directory containing the ntuples must be given!\n";
31      exit;
32    }
33 < if ($ARGV[0] eq "uploadRelease" && !$opt{"pyConfig"} && !$opt{"release"})
33 > if ($ARGV[0] eq "uploadRelease" && (!$opt{"pyConfig"} || !$opt{"release"} || !$opt{"recipe"}))
34    {
35 <    print "Both the Python and the CMSSW release must be given!\n";
35 >    print "The Python config, CMSSW release directory, and recipe file must be given!\n";
36      exit;
37    }
38   if ($ARGV[0] eq "uploadRelease")
# Line 44 | Line 44 | if ($ARGV[0] eq "uploadRelease")
44      $cmsswRelease =~ s/^.*CMSSW_([^\/]*).*$/CMSSW_$1/;
45      `tar -C $parentDir -czf $ARGV[1].tar.gz $opt{"release"}`;
46      $opt{"format"} = "BEAN" if !$opt{"format"};
47 <    uploadRelease ($opt{"format"}, $cmsswRelease, "$ARGV[1].tar.gz", $opt{"pyConfig"}, $ARGV[1], "$ENV{'USER'}", $opt{"comment"});
47 >    uploadRelease ($opt{"format"}, $cmsswRelease, "$ARGV[1].tar.gz", $opt{"pyConfig"}, $ARGV[1], "$ENV{'USER'}", $opt{"comment"}, $opt{"recipe"});
48    }
49   elsif ($ARGV[0] eq "downloadRelease")
50    {
# Line 425 | Line 425 | printHelp
425      }
426    elsif ($command eq "uploadRelease")
427      {
428 <      print "Usage: $exeName -p FILE -r DIRECTORY [OPTION]... uploadRelease NAME\n";
428 >      print "Usage: $exeName -e FILE -p FILE -r DIRECTORY [OPTION]... uploadRelease NAME\n";
429        print "Copies an ntuple release to the appropriate area on the Tier 3, and creates a\n";
430        print "database entry for it, with NAME being the name of the release. An ntuple\n";
431        print "release is a CMSSW release with all the necessary packages added for creating\n";
# Line 433 | Line 433 | printHelp
433        print "\n";
434        print "Mandatory arguments to long options are mandatory for short options too.\n";
435        printf "%-29s%s\n", "  -c, --comment COMMENT", "comment for the database entry";
436 +      printf "%-29s%s\n", "  -e, --recipe FILE", "file containing the recipe for the release";
437        printf "%-29s%s\n", "  -f, --format FORMAT", "ntuple format (default: BEAN)";
438        printf "%-29s%s\n", "  -p, --pyConfig FILE", "default Python config for the release";
439        printf "%-29s%s\n", "  -r, --release DIRECTORY", "CMSSW release containing ntuple packages";
# Line 517 | Line 518 | uploadRelease
518    my $name = shift;
519    my $user = shift;
520    my $comment = shift;
521 +  my $recipeName = shift;
522  
521  move ($release, "/home/hart/public_html/releases/$name.tar.gz") or die "Ntuple releases may only be uploaded on the Tier 3, stopped";
523    if (!(-e $psetName))
524      {
525        print "$psetName does not exist!\n";
526        exit;
527      }
528 +  if (!(-e $recipeName))
529 +    {
530 +      print "$recipeName does not exist!\n";
531 +      exit;
532 +    }
533 +  move ($release, "/home/hart/public_html/releases/$name.tar.gz") or die "Ntuple releases may only be uploaded on the Tier 3, stopped";
534    open (PY_CONFIG, "<$psetName");
535    my @pset = <PY_CONFIG>;
536    close (PY_CONFIG);
537    my $pset = join ("", @pset);
538 +  open (RECIPE, "<$recipeName");
539 +  my @recipe = <RECIPE>;
540 +  close (RECIPE);
541 +  my $recipe = join ("\n", @recipe);
542  
543    my $query = "select max(id) from ntupleRelease";
544    $db->selectdb ("ntuple");
# Line 542 | Line 553 | uploadRelease
553    $format = addSlashes ($format);
554    $cmsswRelease = addSlashes ($cmsswRelease);
555    $comment = addSlashes ($comment);
556 +  $recipe = addSlashes ($recipe);
557  
558 <  my $query = "insert into ntupleRelease (id, name, pset, user, pending, format, cmsswRelease, comment) values ($id, '$name', '$pset', '$user', 1, '$format', '$cmsswRelease', '$comment')";
558 >  my $query = "insert into ntupleRelease (id, name, pset, user, pending, format, cmsswRelease, comment, recipe) values ($id, '$name', '$pset', '$user', 1, '$format', '$cmsswRelease', '$comment', '$recipe')";
559    $db->selectdb ("ntuple");
560    my $results = $db->query ($query);
561   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines