ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/submitToCondor.py
(Generate patch)

Comparing UserCode/OSUT3Analysis/Configuration/scripts/submitToCondor.py (file contents):
Revision 1.6 by ahart, Thu Apr 25 18:15:52 2013 UTC vs.
Revision 1.7 by ahart, Wed Jun 19 13:40:12 2013 UTC

# Line 2 | Line 2
2   import os
3   import sys
4   import datetime
5 + import shutil
6 + import re
7   from optparse import OptionParser
8  
9   from OSUT3Analysis.Configuration.configurationOptions import *
# Line 9 | Line 11 | from OSUT3Analysis.Configuration.process
11  
12   parser = OptionParser()
13   parser = set_commandline_arguments(parser)
14 +
15 + parser.remove_option("-o")
16 + parser.remove_option("-t")
17 + parser.remove_option("-q")
18 + parser.remove_option("-n")
19 + parser.remove_option("-u")
20 + parser.remove_option("-e")
21 + parser.remove_option("-r")
22 + parser.remove_option("-R")
23 + parser.remove_option("-d")
24 + parser.remove_option("-b")
25 + parser.remove_option("--2D")
26 + parser.remove_option("-y")
27 + parser.remove_option("-p")
28 +
29 + parser.add_option("-s", "--skimDir", dest="skimDir",
30 +                  help="condor directory containing skim")
31 + parser.add_option("-a", "--skimChannel", dest="skimChannel",
32 +                  help="channel from skim to use")
33 +
34   (arguments, args) = parser.parse_args()
35  
36 + if (arguments.skimDir and not arguments.skimChannel) or (not arguments.skimDir and arguments.skimChannel):
37 +    print "Both the skim directory (--skimDir) and channel (--skimChannel) must be given."
38 +    exit ()
39 +
40   if arguments.localConfig:
41      sys.path.append(os.getcwd())
42      exec("from " + arguments.localConfig.rstrip('.py') + " import *")
43  
44   condor_dir = set_condor_submit_dir(arguments)
45 + short_condor_dir = condor_dir
46 + short_condor_dir = re.sub (r".*/([^/]*)", r"\1", short_condor_dir)
47 + short_condor_dir = list (short_condor_dir)
48 + short_condor_dir[0] = short_condor_dir[0].upper ()
49 + short_condor_dir = "".join (short_condor_dir)
50  
51 < os.system("mkdir %s" % (condor_dir))
51 > if not os.path.exists (condor_dir):
52 >    os.system("mkdir %s" % (condor_dir))
53  
54   split_datasets = split_composite_datasets(datasets, composite_dataset_definitions)
55  
56   for dataset in split_datasets:
57      output_dir = "%s/%s" % (condor_dir, dataset)
58 <    command = "osusub -l %s -m %d %s %s %s %s" % (dataset, maxEvents[dataset], dataset_names[dataset], config_file, output_dir, nJobs[dataset])
58 >    command = "osusub -l %s -m %d -p %s %s %s %s %s" % (dataset, maxEvents[dataset], short_condor_dir, dataset_names[dataset], config_file, output_dir, nJobs[dataset])
59 >    if arguments.skimDir:
60 >        skim_dir = "condor/" + arguments.skimDir + "/" + dataset + "/" + arguments.skimChannel
61 >        if os.path.exists (skim_dir):
62 >            command = "osusub -d %s -l %s -m %d -p %s %s %s %s %s" % (dataset_names[dataset], dataset, maxEvents[dataset], short_condor_dir, skim_dir, config_file, output_dir, nJobs[dataset])
63 >        else:
64 >            print dataset + "/" + arguments.skimChannel + " not in skim directory. Skipping."
65 >            continue
66      print command
67      os.system(command)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines