Show More
@@ -39,7 +39,7 b' class OutStream(object):' | |||||
39 | flush_interval = 0.05 |
|
39 | flush_interval = 0.05 | |
40 | topic=None |
|
40 | topic=None | |
41 |
|
41 | |||
42 | def __init__(self, session, pub_socket, name): |
|
42 | def __init__(self, session, pub_socket, name, pipe=True): | |
43 | self.encoding = 'UTF-8' |
|
43 | self.encoding = 'UTF-8' | |
44 | self.session = session |
|
44 | self.session = session | |
45 | self.pub_socket = pub_socket |
|
45 | self.pub_socket = pub_socket | |
@@ -50,7 +50,9 b' class OutStream(object):' | |||||
50 | self._master_pid = os.getpid() |
|
50 | self._master_pid = os.getpid() | |
51 | self._master_thread = threading.current_thread().ident |
|
51 | self._master_thread = threading.current_thread().ident | |
52 | self._pipe_pid = os.getpid() |
|
52 | self._pipe_pid = os.getpid() | |
53 |
self._ |
|
53 | self._pipe_flag = pipe | |
|
54 | if pipe: | |||
|
55 | self._setup_pipe_in() | |||
54 |
|
56 | |||
55 | def _setup_pipe_in(self): |
|
57 | def _setup_pipe_in(self): | |
56 | """setup listening pipe for subprocesses""" |
|
58 | """setup listening pipe for subprocesses""" | |
@@ -84,7 +86,7 b' class OutStream(object):' | |||||
84 |
|
86 | |||
85 | def _check_mp_mode(self): |
|
87 | def _check_mp_mode(self): | |
86 | """check for forks, and switch to zmq pipeline if necessary""" |
|
88 | """check for forks, and switch to zmq pipeline if necessary""" | |
87 | if self._is_master_process(): |
|
89 | if not self._pipe_flag or self._is_master_process(): | |
88 | return MASTER |
|
90 | return MASTER | |
89 | else: |
|
91 | else: | |
90 | if not self._have_pipe_out(): |
|
92 | if not self._have_pipe_out(): | |
@@ -100,7 +102,7 b' class OutStream(object):' | |||||
100 |
|
102 | |||
101 | def _flush_from_subprocesses(self): |
|
103 | def _flush_from_subprocesses(self): | |
102 | """flush possible pub data from subprocesses into my buffer""" |
|
104 | """flush possible pub data from subprocesses into my buffer""" | |
103 | if not self._is_master_process(): |
|
105 | if not self._pipe_flag or not self._is_master_process(): | |
104 | return |
|
106 | return | |
105 | for i in range(100): |
|
107 | for i in range(100): | |
106 | if self._pipe_poller.poll(0): |
|
108 | if self._pipe_poller.poll(0): | |
@@ -201,4 +203,3 b' class OutStream(object):' | |||||
201 | def _new_buffer(self): |
|
203 | def _new_buffer(self): | |
202 | self._buffer = StringIO() |
|
204 | self._buffer = StringIO() | |
203 | self._start = -1 |
|
205 | self._start = -1 | |
204 |
|
General Comments 0
You need to be logged in to leave comments.
Login now