##// END OF EJS Templates
split init_sockets into a few steps, so they can be better reused
MinRK -
Show More
@@ -218,7 +218,9 b' class KernelApp(BaseIPythonApplication):'
218 self.stdin_socket = context.socket(zmq.ROUTER)
218 self.stdin_socket = context.socket(zmq.ROUTER)
219 self.stdin_port = self._bind_socket(self.stdin_socket, self.stdin_port)
219 self.stdin_port = self._bind_socket(self.stdin_socket, self.stdin_port)
220 self.log.debug("stdin ROUTER Channel on port: %i"%self.stdin_port)
220 self.log.debug("stdin ROUTER Channel on port: %i"%self.stdin_port)
221
221
222 def init_heartbeat(self):
223 """start the heart beating"""
222 # heartbeat doesn't share context, because it mustn't be blocked
224 # heartbeat doesn't share context, because it mustn't be blocked
223 # by the GIL, which is accessed by libzmq when freeing zero-copy messages
225 # by the GIL, which is accessed by libzmq when freeing zero-copy messages
224 hb_ctx = zmq.Context()
226 hb_ctx = zmq.Context()
@@ -230,7 +232,9 b' class KernelApp(BaseIPythonApplication):'
230 # Helper to make it easier to connect to an existing kernel.
232 # Helper to make it easier to connect to an existing kernel.
231 # set log-level to critical, to make sure it is output
233 # set log-level to critical, to make sure it is output
232 self.log.critical("To connect another client to this kernel, use:")
234 self.log.critical("To connect another client to this kernel, use:")
233
235
236 def log_connection_info(self):
237 """display connection info, and store ports"""
234 basename = os.path.basename(self.connection_file)
238 basename = os.path.basename(self.connection_file)
235 if basename == self.connection_file or \
239 if basename == self.connection_file or \
236 os.path.dirname(self.connection_file) == self.profile_dir.security_dir:
240 os.path.dirname(self.connection_file) == self.profile_dir.security_dir:
@@ -292,7 +296,9 b' class KernelApp(BaseIPythonApplication):'
292 self.init_session()
296 self.init_session()
293 self.init_poller()
297 self.init_poller()
294 self.init_sockets()
298 self.init_sockets()
295 # writing connection file must be *after* init_sockets
299 self.init_heartbeat()
300 # writing/displaying connection info must be *after* init_sockets/heartbeat
301 self.log_connection_info()
296 self.write_connection_file()
302 self.write_connection_file()
297 self.init_io()
303 self.init_io()
298 self.init_signal()
304 self.init_signal()
General Comments 0
You need to be logged in to leave comments. Login now