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.11 by jbrinson, Fri Jul 12 14:40:31 2013 UTC vs.
Revision 1.12 by ahart, Thu Aug 29 21:26:53 2013 UTC

# Line 57 | Line 57 | if not os.path.exists (condor_dir):
57   split_datasets = split_composite_datasets(datasets, composite_dataset_definitions)
58  
59   clusters = ""
60 + submissionErrors = False
61   for dataset in split_datasets:
62      output_dir = "%s/%s" % (condor_dir, dataset)
63      skim_dir = ""
# Line 79 | Line 80 | for dataset in split_datasets:
80      while p0.poll () is None:
81          try:
82              tmpOutput = p0.stdout.read (1024)
83 <            print tmpOutput,
83 >            if re.search (r"[^ \f\n\r\t]", tmpOutput):
84 >                print tmpOutput,
85              output += tmpOutput
86          except IOError:
87              pass
88      tmpOutput = p0.stdout.read (1024)
89 <    print tmpOutput,
89 >    if re.search (r"[^ \f\n\r\t]", tmpOutput):
90 >        print tmpOutput,
91      output += tmpOutput
92      output = re.sub (r"[\f\n\r]", r"", output)
93 <    output = re.sub (r".*submitted to cluster (.*)\..*$", r"\1", output)
94 <    clusters += " " + output
93 >    if re.search (r"submitted to cluster", output):
94 >        output = re.sub (r".*submitted to cluster (.*)\..*$", r"\1", output)
95 >        clusters += " " + output
96 >    else:
97 >        submissionErrors = True
98      if arguments.skimDir and os.path.exists (skim_channel_dir + "/skimNumberOfEvents.txt") and os.path.exists (skim_dir + "/numberOfEvents.txt") and os.path.exists (skim_dir + "/crossSectionInPicobarn.txt"):
99          shutil.copy (skim_channel_dir + "/skimNumberOfEvents.txt", output_dir + "/skimNumberOfEvents.txt")
100          shutil.copy (skim_dir + "/numberOfEvents.txt", output_dir + "/originalNumberOfEvents.txt")
# Line 109 | Line 115 | for dataset in split_datasets:
115          f.write (str (crossSectionInPicobarn) + "\n")
116          f.close ()
117  
118 < if arguments.mergeDaemon:
119 <    command = "mergeOutput.py"
120 <    if arguments.condorDir:
121 <        command += " -c " + arguments.condorDir
122 <    pid = os.fork ()
123 <    if not pid:
124 <        signal.signal (signal.SIGHUP, signal.SIG_IGN)
125 <        pid = os.getpid ()
126 <        if arguments.localConfig:
127 <            shutil.copy (arguments.localConfig, "mergeDaemonOptions_" + str (pid) + ".py")
128 <            command += " -l mergeDaemonOptions_" + str (pid) + ".py"
129 <        os.execvp ("mergeDaemon.pl", ["mergeDaemon.pl", command] + clusters.split ())
130 <    else:
131 <        print "\nMerging daemon PID: " + str (pid)
118 > if arguments.mergeDaemon and len (clusters) > 0:
119 >    response = "y"
120 >    if submissionErrors:
121 >        print "\nIt looks like there were errors during submission."
122 >        response = raw_input ("Launch merging daemon anyway? (y/N): ").lower ()
123 >        response = re.sub (r"[ \f\n\r\t]", r"", response)
124 >    if len (response) > 0 and response[0] == "y":
125 >        command = "mergeOutput.py"
126 >        if arguments.condorDir:
127 >            command += " -c " + arguments.condorDir
128 >        pid = os.fork ()
129 >        if not pid:
130 >            signal.signal (signal.SIGHUP, signal.SIG_IGN)
131 >            pid = os.getpid ()
132 >            if arguments.localConfig:
133 >                shutil.copy (arguments.localConfig, "mergeDaemonOptions_" + str (pid) + ".py")
134 >                command += " -l mergeDaemonOptions_" + str (pid) + ".py"
135 >            os.execvp ("mergeDaemon.pl", ["mergeDaemon.pl", command] + clusters.split ())
136 >        else:
137 >            print "\nMerging daemon PID: " + str (pid)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines