##// END OF EJS Templates
fix KeyError creating ZMQStreams in notebook...
MinRK -
Show More
@@ -200,10 +200,12 b' class MultiKernelManager(LoggingConfigurable):'
200 else:
200 else:
201 return "%s://%s-%s" % (transport, ip, port)
201 return "%s://%s-%s" % (transport, ip, port)
202
202
203 def _create_connected_stream(self, kernel_id, socket_type):
203 def _create_connected_stream(self, kernel_id, socket_type, channel):
204 """Create a connected ZMQStream for a kernel."""
204 """Create a connected ZMQStream for a kernel."""
205 cinfo = self.get_connection_info(kernel_id)
205 cinfo = self.get_connection_info(kernel_id)
206 url = self._make_url(cinfo['transport'], cinfo['ip'], cinfo['port'])
206 url = self._make_url(cinfo['transport'], cinfo['ip'],
207 cinfo['%s_port' % channel]
208 )
207 sock = self.context.socket(socket_type)
209 sock = self.context.socket(socket_type)
208 self.log.info("Connecting to: %s" % url)
210 self.log.info("Connecting to: %s" % url)
209 sock.connect(url)
211 sock.connect(url)
@@ -221,7 +223,7 b' class MultiKernelManager(LoggingConfigurable):'
221 =======
223 =======
222 stream : ZMQStream
224 stream : ZMQStream
223 """
225 """
224 iopub_stream = self._create_connected_stream(kernel_id, zmq.SUB)
226 iopub_stream = self._create_connected_stream(kernel_id, zmq.SUB, 'iopub')
225 iopub_stream.socket.setsockopt(zmq.SUBSCRIBE, b'')
227 iopub_stream.socket.setsockopt(zmq.SUBSCRIBE, b'')
226 return iopub_stream
228 return iopub_stream
227
229
@@ -237,7 +239,7 b' class MultiKernelManager(LoggingConfigurable):'
237 =======
239 =======
238 stream : ZMQStream
240 stream : ZMQStream
239 """
241 """
240 shell_stream = self._create_connected_stream(kernel_id, zmq.DEALER)
242 shell_stream = self._create_connected_stream(kernel_id, zmq.DEALER, 'shell')
241 return shell_stream
243 return shell_stream
242
244
243 def create_hb_stream(self, kernel_id):
245 def create_hb_stream(self, kernel_id):
@@ -252,7 +254,7 b' class MultiKernelManager(LoggingConfigurable):'
252 =======
254 =======
253 stream : ZMQStream
255 stream : ZMQStream
254 """
256 """
255 hb_stream = self._create_connected_stream(kernel_id, zmq.REQ)
257 hb_stream = self._create_connected_stream(kernel_id, zmq.REQ, 'hb')
256 return hb_stream
258 return hb_stream
257
259
258
260
General Comments 0
You need to be logged in to leave comments. Login now