def start(self): """ Starts local worker. """ if _USE_SUBPROCESS: if sys.platform.startswith("win"): import win32process proc = subprocess.Popen( self.command, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, creationflags=win32process.CREATE_NO_WINDOW, ) else: proc = subprocess.Popen( self.command, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, ) self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin) else: self.t = pptransport.CPipeTransport( *popen2.popen3(self.command)[:2]) self.pid = int(self.t.receive()) self.t.send(str(self.pickle_proto)) self.is_free = True
def start(self): """Starts local worker""" if _USE_SUBPROCESS: proc = subprocess.Popen(self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin) else: self.t = pptransport.CPipeTransport( *popen2.popen3(self.command)[:2]) self.pid = int(self.t.receive()) self.t.send(str(self.pickle_proto)) self.is_free = True
def start(self): """Starts local worker""" if _USE_SUBPROCESS: proc = subprocess.Popen(self.command, stdin=subprocess.PIPE, \ stdout=subprocess.PIPE, stderr=subprocess.PIPE, \ shell=True) self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin) self.msg_pipe = proc.stderr else: stdin, stdout, stderr = popen2.popen3(self.command) self.t = pptransport.CPipeTransport(stdin, stdout) self.msg_pipe = stderr self.pid = int(self.t.receive()) self.t.send(str(self.pickle_proto)) self.is_free = True
def __init__(self): self.hashmap = {} self.e = sys.__stderr__ self.sout = StringIO.StringIO() sys.stdout = self.sout sys.stderr = self.sout self.t = pptransport.CPipeTransport(sys.stdin, sys.__stdout__) self.t.send(str(os.getpid())) self.pickle_proto = int(self.t.receive())
def start(self): """Starts local worker""" if _USE_SUBPROCESS: proc = subprocess.Popen(self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin) else: self.t = pptransport.CPipeTransport( *popen2.popen3(self.command)[:2]) #open('/tmp/pp.debug', 'a+').write('Starting _Worker\n') #open('/tmp/pp.debug', 'a+').write('receiving... \n') self.pid = int(self.t.receive()) #open('/tmp/pp.debug', 'a+').write('received: %s\n' % self.pid) #open('/tmp/pp.debug', 'a+').write('sending: %s\n' % self.pickle_proto) self.t.send(str(self.pickle_proto)) #open('/tmp/pp.debug', 'a+').write('...sent \n') self.is_free = True
def __init__(self): self.hashmap = {} self.e = sys.__stderr__ self.sout = ioStringIO() # self.sout = open("/tmp/pp.debug","a+") sys.stdout = self.sout sys.stderr = self.sout self.t = pptransport.CPipeTransport(sys.stdin, sys.__stdout__) self.t.send(str(os.getpid())) self.pickle_proto = int(self.t.receive())
def start(self): """Starts local worker""" if _USE_MULTIPROCESSING: import ppworker localPipeEnd, remotePipeEnd = multiprocessing.Pipe() self.t = pptransport.CMultiprocessingPipeTransport(localPipeEnd) self.proc = multiprocessing.Process(target=ppworker._WorkerProcessRunner, args=(remotePipeEnd,)) self.proc.start() elif _USE_SUBPROCESS: proc = subprocess.Popen(self.command, stdin=subprocess.PIPE, \ stdout=subprocess.PIPE, stderr=subprocess.PIPE, \ shell=False) self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin) else: self.t = pptransport.CPipeTransport(\ *popen2.popen3(self.command)[:2]) self.pid = int(self.t.receive()) self.id = self.pid self.t.send(str(self.pickle_proto)) self.is_free = True
def __init__(self): self.hashmap = {} self.e = sys.__stderr__ self.sout = ioStringIO() # self.sout = open("/tmp/pp.debug","a+") sys.stdout = self.sout sys.stderr = self.sout self.t = pptransport.CPipeTransport(sys.stdin, sys.__stdout__) #open('/tmp/pp.debug', 'a+').write('Starting _WorkerProcess\n') #open('/tmp/pp.debug', 'a+').write('send... \n') self.t.send(str(os.getpid())) #open('/tmp/pp.debug', 'a+').write('send: %s\n' % str(os.getpid())) #open('/tmp/pp.debug', 'a+').write('receive... \n') self.pickle_proto = int(self.t.receive())