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.8 by ahart, Thu Jun 27 23:54:18 2013 UTC vs.
Revision 1.9 by ahart, Tue Jul 2 23:50:19 2013 UTC

# Line 6 | Line 6 | import shutil
6   import re
7   import subprocess
8   import signal
9 + import fcntl
10   from optparse import OptionParser
11  
12   from OSUT3Analysis.Configuration.configurationOptions import *
# Line 69 | Line 70 | for dataset in split_datasets:
70              print dataset + "/" + arguments.skimChannel + " not in skim directory. Skipping."
71              continue
72      print command
73 <    output = subprocess.Popen (command.split (), stdout=subprocess.PIPE).communicate ()[0]
74 <    print output,
73 >    pid = os.getpid ()
74 >    p0 = subprocess.Popen (command.split (), bufsize=1, stdout=subprocess.PIPE)
75 >    flags = fcntl.fcntl (p0.stdout.fileno (), fcntl.F_GETFL, 0)
76 >    fcntl.fcntl (p0.stdout.fileno (), fcntl.F_SETFL, flags | os.O_NONBLOCK)
77 >    output = ""
78 >    while p0.poll () is None:
79 >        try:
80 >            tmpOutput = p0.stdout.read (1024)
81 >            print tmpOutput,
82 >            output += tmpOutput
83 >        except IOError:
84 >            pass
85 >    tmpOutput = p0.stdout.read (1024)
86 >    print tmpOutput,
87 >    output += tmpOutput
88      output = re.sub (r"[\f\n\r]", r"", output)
89      output = re.sub (r".*submitted to cluster (.*)\..*$", r"\1", output)
90      clusters += " " + output

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines