Show More
@@ -49,6 +49,7 b' from IPython.kernel.zmq.kernelapp import (' | |||
|
49 | 49 | ) |
|
50 | 50 | from IPython.kernel.zmq.session import Session, default_secure |
|
51 | 51 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell |
|
52 | from IPython.kernel.connect import ConnectionFileMixin | |
|
52 | 53 | |
|
53 | 54 | #----------------------------------------------------------------------------- |
|
54 | 55 | # Network Constants |
@@ -89,8 +90,8 b' aliases = dict(kernel_aliases)' | |||
|
89 | 90 | |
|
90 | 91 | # also scrub aliases from the frontend |
|
91 | 92 | app_aliases = dict( |
|
92 | ip = 'KernelManager.ip', | |
|
93 |
transport = ' |
|
|
93 | ip = 'IPythonConsoleApp.ip', | |
|
94 | transport = 'IPythonConsoleApp.transport', | |
|
94 | 95 | hb = 'IPythonConsoleApp.hb_port', |
|
95 | 96 | shell = 'IPythonConsoleApp.shell_port', |
|
96 | 97 | iopub = 'IPythonConsoleApp.iopub_port', |
@@ -120,7 +121,7 b' except ImportError:' | |||
|
120 | 121 | else: |
|
121 | 122 | classes.append(InlineBackend) |
|
122 | 123 | |
|
123 |
class IPythonConsoleApp(Con |
|
|
124 | class IPythonConsoleApp(ConnectionFileMixin): | |
|
124 | 125 | name = 'ipython-console-mixin' |
|
125 | 126 | |
|
126 | 127 | description = """ |
@@ -254,9 +255,8 b' class IPythonConsoleApp(Configurable):' | |||
|
254 | 255 | self.log.debug(u"Loading connection file %s", fname) |
|
255 | 256 | with open(fname) as f: |
|
256 | 257 | cfg = json.load(f) |
|
257 | ||
|
258 | self.config.KernelManager.transport = cfg.get('transport', 'tcp') | |
|
259 | self.config.KernelManager.ip = cfg.get('ip', LOCALHOST) | |
|
258 | self.transport = cfg.get('transport', 'tcp') | |
|
259 | self.ip = cfg.get('ip', LOCALHOST) | |
|
260 | 260 | |
|
261 | 261 | for channel in ('hb', 'shell', 'iopub', 'stdin'): |
|
262 | 262 | name = channel + '_port' |
@@ -272,11 +272,10 b' class IPythonConsoleApp(Configurable):' | |||
|
272 | 272 | """set up ssh tunnels, if needed.""" |
|
273 | 273 | if not self.existing or (not self.sshserver and not self.sshkey): |
|
274 | 274 | return |
|
275 | ||
|
276 | 275 | self.load_connection_file() |
|
277 | 276 | |
|
278 |
transport = self. |
|
|
279 |
ip = self. |
|
|
277 | transport = self.transport | |
|
278 | ip = self.ip | |
|
280 | 279 | |
|
281 | 280 | if transport != 'tcp': |
|
282 | 281 | self.log.error("Can only use ssh tunnels with TCP sockets, not %s", transport) |
@@ -298,7 +297,7 b' class IPythonConsoleApp(Configurable):' | |||
|
298 | 297 | self.log.info("Forwarding connections to %s via %s"%(ip, self.sshserver)) |
|
299 | 298 | |
|
300 | 299 | # tunnels return a new set of ports, which will be on localhost: |
|
301 |
self |
|
|
300 | self.ip = LOCALHOST | |
|
302 | 301 | try: |
|
303 | 302 | newports = tunnel_to_kernel(info, self.sshserver, self.sshkey) |
|
304 | 303 | except: |
@@ -337,6 +336,8 b' class IPythonConsoleApp(Configurable):' | |||
|
337 | 336 | |
|
338 | 337 | # Create a KernelManager and start a kernel. |
|
339 | 338 | self.kernel_manager = self.kernel_manager_class( |
|
339 | ip=self.ip, | |
|
340 | transport=self.transport, | |
|
340 | 341 | shell_port=self.shell_port, |
|
341 | 342 | iopub_port=self.iopub_port, |
|
342 | 343 | stdin_port=self.stdin_port, |
@@ -367,6 +368,8 b' class IPythonConsoleApp(Configurable):' | |||
|
367 | 368 | self.kernel_client = self.kernel_manager.client() |
|
368 | 369 | else: |
|
369 | 370 | self.kernel_client = self.kernel_client_class( |
|
371 | ip=self.ip, | |
|
372 | transport=self.transport, | |
|
370 | 373 | shell_port=self.shell_port, |
|
371 | 374 | iopub_port=self.iopub_port, |
|
372 | 375 | stdin_port=self.stdin_port, |
@@ -249,10 +249,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):' | |||
|
249 | 249 | self.app.icon = QtGui.QIcon(icon_path) |
|
250 | 250 | QtGui.QApplication.setWindowIcon(self.app.icon) |
|
251 | 251 | |
|
252 | try: | |
|
253 | ip = self.config.KernelManager.ip | |
|
254 | except AttributeError: | |
|
255 | ip = LOCALHOST | |
|
252 | ip = self.ip | |
|
256 | 253 | local_kernel = (not self.existing) or ip in LOCAL_IPS |
|
257 | 254 | self.widget = self.widget_factory(config=self.config, |
|
258 | 255 | local_kernel=local_kernel) |
General Comments 0
You need to be logged in to leave comments.
Login now