##// END OF EJS Templates
Don't pass IPython-specific args to non-IPython kernels...
Min RK -
Show More
@@ -291,7 +291,11 b' class IPythonConsoleApp(ConnectionFileMixin):'
291 291 self.exit(1)
292 292
293 293 self.kernel_manager.client_factory = self.kernel_client_class
294 self.kernel_manager.start_kernel(extra_arguments=self.kernel_argv)
294 # FIXME: remove special treatment of IPython kernels
295 kwargs = {}
296 if self.kernel_manager.ipython_kernel:
297 kwargs['extra_arguments'] = self.kernel_argv
298 self.kernel_manager.start_kernel(**kwargs)
295 299 atexit.register(self.kernel_manager.cleanup_ipc_files)
296 300
297 301 if self.sshserver:
@@ -324,7 +324,7 b' class NotebookApp(BaseIPythonApplication):'
324 324 list=(NbserverListApp, NbserverListApp.description.splitlines()[0]),
325 325 )
326 326
327 kernel_argv = List(Unicode)
327 ipython_kernel_argv = List(Unicode)
328 328
329 329 _log_formatter_cls = LogFormatter
330 330
@@ -683,16 +683,17 b' class NotebookApp(BaseIPythonApplication):'
683 683 self.update_config(c)
684 684
685 685 def init_kernel_argv(self):
686 """construct the kernel arguments"""
686 """add the profile-dir to arguments to be passed to IPython kernels"""
687 # FIXME: remove special treatment of IPython kernels
687 688 # Kernel should get *absolute* path to profile directory
688 self.kernel_argv = ["--profile-dir", self.profile_dir.location]
689 self.ipython_kernel_argv = ["--profile-dir", self.profile_dir.location]
689 690
690 691 def init_configurables(self):
691 692 # force Session default to be secure
692 693 default_secure(self.config)
693 694 kls = import_item(self.kernel_manager_class)
694 695 self.kernel_manager = kls(
695 parent=self, log=self.log, kernel_argv=self.kernel_argv,
696 parent=self, log=self.log, ipython_kernel_argv=self.ipython_kernel_argv,
696 697 connection_dir = self.profile_dir.security_dir,
697 698 )
698 699 kls = import_item(self.contents_manager_class)
@@ -1,35 +1,18 b''
1 """A kernel manager relating notebooks and kernels
1 """A kernel manager relating notebooks and kernels"""
2 2
3 Authors:
4
5 * Brian Granger
6 """
7
8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2013 The IPython Development Team
10 #
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
13 #-----------------------------------------------------------------------------
14
15 #-----------------------------------------------------------------------------
16 # Imports
17 #-----------------------------------------------------------------------------
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
18 5
19 6 import os
20 7
21 8 from tornado import web
22 9
23 10 from IPython.kernel.multikernelmanager import MultiKernelManager
24 from IPython.utils.traitlets import List, Unicode, TraitError
11 from IPython.utils.traitlets import Unicode, TraitError
25 12
26 13 from IPython.html.utils import to_os_path
27 14 from IPython.utils.py3compat import getcwd
28 15
29 #-----------------------------------------------------------------------------
30 # Classes
31 #-----------------------------------------------------------------------------
32
33 16
34 17 class MappingKernelManager(MultiKernelManager):
35 18 """A KernelManager that handles notebook mapping and HTTP error handling"""
@@ -37,8 +20,6 b' class MappingKernelManager(MultiKernelManager):'
37 20 def _kernel_manager_class_default(self):
38 21 return "IPython.kernel.ioloop.IOLoopKernelManager"
39 22
40 kernel_argv = List(Unicode)
41
42 23 root_dir = Unicode(getcwd(), config=True)
43 24
44 25 def _root_dir_changed(self, name, old, new):
@@ -89,7 +70,6 b' class MappingKernelManager(MultiKernelManager):'
89 70 an existing kernel is returned, but it may be checked in the future.
90 71 """
91 72 if kernel_id is None:
92 kwargs['extra_arguments'] = self.kernel_argv
93 73 if path is not None:
94 74 kwargs['cwd'] = self.cwd_for_path(path)
95 75 kernel_id = super(MappingKernelManager, self).start_kernel(
@@ -13,7 +13,7 b' import zmq'
13 13 from IPython.config.configurable import LoggingConfigurable
14 14 from IPython.utils.importstring import import_item
15 15 from IPython.utils.traitlets import (
16 Instance, Dict, Unicode, Any, DottedObjectName
16 Instance, Dict, List, Unicode, Any, DottedObjectName
17 17 )
18 18 from IPython.utils.py3compat import unicode_type
19 19
@@ -42,6 +42,8 b' def kernel_method(f):'
42 42 class MultiKernelManager(LoggingConfigurable):
43 43 """A class for managing multiple kernels."""
44 44
45 ipython_kernel_argv = List(Unicode)
46
45 47 default_kernel_name = Unicode(NATIVE_KERNEL_NAME, config=True,
46 48 help="The name of the default kernel to start"
47 49 )
@@ -104,6 +106,9 b' class MultiKernelManager(LoggingConfigurable):'
104 106 self.connection_dir, "kernel-%s.json" % kernel_id),
105 107 parent=self, autorestart=True, log=self.log, kernel_name=kernel_name,
106 108 )
109 # FIXME: remove special treatment of IPython kernels
110 if km.ipython_kernel:
111 kwargs.setdefault('extra_arguments', self.ipython_kernel_argv)
107 112 km.start_kernel(**kwargs)
108 113 self._kernels[kernel_id] = km
109 114 return kernel_id
@@ -193,8 +193,10 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):'
193 193 autorestart=True,
194 194 )
195 195 # start the kernel
196 kwargs = dict()
197 kwargs['extra_arguments'] = self.kernel_argv
196 kwargs = {}
197 # FIXME: remove special treatment of IPython kernels
198 if self.kernel_manager.ipython_kernel:
199 kwargs['extra_arguments'] = self.kernel_argv
198 200 kernel_manager.start_kernel(**kwargs)
199 201 kernel_manager.client_factory = self.kernel_client_class
200 202 kernel_client = kernel_manager.client()
General Comments 0
You need to be logged in to leave comments. Login now