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.7 by ahart, Tue Oct 9 10:20:47 2012 UTC vs.
Revision 1.11 by ahart, Thu Jan 17 20:51:46 2013 UTC

# Line 37 | Line 37 | my $nFiles = outputRunList ($ARGV[0], $A
37   my $nJobs = $ARGV[3];
38   my $realNJobs = ceil ($nFiles / ceil ($nFiles / $nJobs));
39   outputPset ($ARGV[2]);
40 < outputCondor ($ARGV[2], $realNJobs);
40 > outputCondor ($ARGV[2], $realNJobs, $ARGV[0]);
41   copy ($ARGV[1], "$ARGV[2]/userConfig_cfg.py");
42   chdir $ARGV[2];
43   print "Submitting $realNJobs jobs to run on $nFiles files.\n";
# Line 74 | Line 74 | outputRunList
74    my $dataset = shift;
75    my $workingDir = shift;
76  
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";
81 <      exit;
77 >  my $location;
78 >  my $nFiles;
79 >  my $status;
80 >  my $crossSection;
81 >  my $isLocation = 0;
82 >  $isLocation = 1 if -e $dataset;
83 >  if (!$isLocation)
84 >    {
85 >      ($location, $nFiles, $status, $crossSection) = getLocation ($dataset);
86 >      if ($status ne "present")
87 >        {
88 >          print "This dataset is not marked as present on the Tier 3!\n";
89 >          print "Continue anyway? (y/N): ";
90 >          my $response = <STDIN>;
91 >          $response =~ s/\n//g;
92 >          exit if !$response || lc ($response) ne "y";
93 >        }
94 >      if (!(-e $location))
95 >        {
96 >          print "The database does not know where this dataset is!\n";
97 >          exit;
98 >        }
99      }
100 <  if (!(-e $location))
100 >  else
101      {
102 <      print "The database does not know where this dataset is!\n";
86 <      exit;
102 >      $location = $dataset;
103      }
104    opendir (LOCATION, $location);
105    my @files = readdir (LOCATION);
106    closedir (LOCATION);
107 <  if (@files - 2 != $nFiles)
107 >  if (!$isLocation && @files - 2 != $nFiles)
108      {
109        print "Number of files does not match database entry!\n";
110 <      exit;
110 >      print "Continue anyway? (y/N): ";
111 >      my $response = <STDIN>;
112 >      $response =~ s/\n//g;
113 >      exit if !$response || lc ($response) ne "y";
114 >    }
115 >  elsif ($isLocation)
116 >    {
117 >      $nFiles = @files - 2;
118      }
119    open (RUNLIST, ">$workingDir/runList.py");
120    print RUNLIST "runList = [\n";
# Line 124 | Line 147 | getLocation
147    my $queryDataset = $dataset;
148    $queryDataset =~ s/\*/%/g;
149    $queryDataset =~ s/(.*)/%$1%/g;
150 <  my $query = "select dataset,user,creationTime,location,nFiles,status,crossSectionInPicobarn from ntuple where dataset like '$queryDataset' and status='present' order by creationTime";
150 >  my $query = "select dataset,user,creationTime,location,nFiles,status,crossSectionInPicobarn from ntuple where dataset like '$queryDataset' order by creationTime";
151    $db->selectdb ("ntuple");
152    $results = $db->query ($query);
153    if ($results->numrows () == 1)
# Line 164 | Line 187 | outputCondor
187   {
188    my $workingDir = shift;
189    my $nJobs = shift;
190 +  my $dataset = shift;
191  
192    my $cmsRun = `which cmsRun`;
193    open (SUB, ">$workingDir/condor.sub");
# Line 171 | Line 195 | outputCondor
195    print SUB "Executable              = $cmsRun\n";
196    print SUB "Universe                = vanilla\n";
197    print SUB "Getenv                  = True\n";
198 <  print SUB "Arguments               = config_cfg.py $nJobs \$(Process)\n";
198 >  print SUB "Arguments               = config_cfg.py True $nJobs \$(Process) $dataset\n";
199    print SUB "\n";
200    print SUB "Output                  = condor_\$(Process).out\n";
201    print SUB "Error                   = condor_\$(Process).err\n";
# Line 192 | Line 216 | printHelp
216    $exeName =~ s/^.*\/([^\/]*)$/$1/;
217  
218    print "Usage: $exeName [OPTION]... DATASET CONFIG DIRECTORY NJOBS\n";
219 +  print "  or:  $exeName [OPTION]... LOCATION CONFIG DIRECTORY NJOBS\n";
220    print "Submits CMSSW jobs to the OSU Tier 3 compute nodes using Condor.\n";
221    print "\n";
222    printf "%-29s%s\n", "  -h, --help", "print this help message";
223    print "\n";
224 <  print "The DATASET must exist in the Tier 3 ntuple database, and CONFIG must be a valid\n";
225 <  print "CMSSW python configuration which can be used with cmsRun. DIRECTORY is a working\n";
224 >  print "The first argument must be either a DATASET registered in the Tier 3 ntuple\n";
225 >  print "database or a LOCATION which exists on disk. CONFIG must be a valid CMSSW\n";
226 >  print "python configuration which can be used with cmsRun. DIRECTORY is a working\n";
227    print "directory that is created and in which all output, both from the CMSSW jobs and\n";
228    print "from Condor, is placed. Finally, NJOBS is the number of Condor jobs that will\n";
229    print "be created.\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines