Show More
@@ -37,7 +37,7 b' from IPython.parallel.apps.baseapp import (' | |||||
37 | catch_config_error, |
|
37 | catch_config_error, | |
38 | ) |
|
38 | ) | |
39 | from IPython.zmq.log import EnginePUBHandler |
|
39 | from IPython.zmq.log import EnginePUBHandler | |
40 | from IPython.zmq.ipkernel import Kernel |
|
40 | from IPython.zmq.ipkernel import Kernel, IPKernelApp | |
41 | from IPython.zmq.session import ( |
|
41 | from IPython.zmq.session import ( | |
42 | Session, session_aliases, session_flags |
|
42 | Session, session_aliases, session_flags | |
43 | ) |
|
43 | ) | |
@@ -49,7 +49,7 b' from IPython.parallel.util import disambiguate_url' | |||||
49 |
|
49 | |||
50 | from IPython.utils.importstring import import_item |
|
50 | from IPython.utils.importstring import import_item | |
51 | from IPython.utils.py3compat import cast_bytes |
|
51 | from IPython.utils.py3compat import cast_bytes | |
52 | from IPython.utils.traitlets import Bool, Unicode, Dict, List, Float |
|
52 | from IPython.utils.traitlets import Bool, Unicode, Dict, List, Float, Instance | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | #----------------------------------------------------------------------------- |
|
55 | #----------------------------------------------------------------------------- | |
@@ -174,6 +174,9 b' class IPEngineApp(BaseParallelApplication):' | |||||
174 | log_url = Unicode('', config=True, |
|
174 | log_url = Unicode('', config=True, | |
175 | help="""The URL for the iploggerapp instance, for forwarding |
|
175 | help="""The URL for the iploggerapp instance, for forwarding | |
176 | logging to a central location.""") |
|
176 | logging to a central location.""") | |
|
177 | ||||
|
178 | # an IPKernelApp instance, used to setup listening for shell frontends | |||
|
179 | kernel_app = Instance(IPKernelApp) | |||
177 |
|
180 | |||
178 | aliases = Dict(aliases) |
|
181 | aliases = Dict(aliases) | |
179 | flags = Dict(flags) |
|
182 | flags = Dict(flags) | |
@@ -226,7 +229,41 b' class IPEngineApp(BaseParallelApplication):' | |||||
226 | config.EngineFactory.sshserver |
|
229 | config.EngineFactory.sshserver | |
227 | except AttributeError: |
|
230 | except AttributeError: | |
228 | config.EngineFactory.sshserver = d['ssh'] |
|
231 | config.EngineFactory.sshserver = d['ssh'] | |
|
232 | ||||
|
233 | def listen_kernel(self): | |||
|
234 | """setup engine as listening Kernel, for frontends""" | |||
|
235 | if self.kernel_app is not None: | |||
|
236 | return | |||
|
237 | ||||
|
238 | self.log.info("Opening ports for direct connections") | |||
|
239 | ||||
|
240 | kernel = self.kernel | |||
|
241 | ||||
|
242 | app = self.kernel_app = IPKernelApp(log=self.log, config=self.config, | |||
|
243 | profile_dir = self.profile_dir, | |||
|
244 | session=self.engine.session, | |||
|
245 | ) | |||
|
246 | app.init_connection_file() | |||
|
247 | # relevant contents of init_sockets: | |||
|
248 | ||||
|
249 | app.shell_port = app._bind_socket(kernel.shell_streams[0], app.shell_port) | |||
|
250 | app.log.debug("shell ROUTER Channel on port: %i", app.shell_port) | |||
229 |
|
251 | |||
|
252 | app.iopub_port = app._bind_socket(kernel.iopub_socket, app.iopub_port) | |||
|
253 | app.log.debug("iopub PUB Channel on port: %i", app.iopub_port) | |||
|
254 | ||||
|
255 | kernel.stdin_socket = self.engine.context.socket(zmq.ROUTER) | |||
|
256 | app.stdin_port = app._bind_socket(kernel.stdin_socket, app.stdin_port) | |||
|
257 | app.log.debug("stdin ROUTER Channel on port: %i", app.stdin_port) | |||
|
258 | ||||
|
259 | # start the heartbeat, and log connection info: | |||
|
260 | ||||
|
261 | app.init_heartbeat() | |||
|
262 | ||||
|
263 | app.log_connection_info() | |||
|
264 | app.write_connection_file() | |||
|
265 | ||||
|
266 | ||||
230 | def init_engine(self): |
|
267 | def init_engine(self): | |
231 | # This is the working dir by now. |
|
268 | # This is the working dir by now. | |
232 | sys.path.insert(0, '') |
|
269 | sys.path.insert(0, '') |
General Comments 0
You need to be logged in to leave comments.
Login now