Merge pull request #6961 from minrk/profile-dir-no-3p

Don't pass IPython-specific args to non-IPython kernels
This commit is contained in:
Thomas Kluyver 2014-11-18 14:09:35 -08:00
commit 2414db41e6
2 changed files with 11 additions and 26 deletions

View File

@ -324,7 +324,7 @@ class NotebookApp(BaseIPythonApplication):
list=(NbserverListApp, NbserverListApp.description.splitlines()[0]),
)
kernel_argv = List(Unicode)
ipython_kernel_argv = List(Unicode)
_log_formatter_cls = LogFormatter
@ -683,16 +683,17 @@ class NotebookApp(BaseIPythonApplication):
self.update_config(c)
def init_kernel_argv(self):
"""construct the kernel arguments"""
"""add the profile-dir to arguments to be passed to IPython kernels"""
# FIXME: remove special treatment of IPython kernels
# Kernel should get *absolute* path to profile directory
self.kernel_argv = ["--profile-dir", self.profile_dir.location]
self.ipython_kernel_argv = ["--profile-dir", self.profile_dir.location]
def init_configurables(self):
# force Session default to be secure
default_secure(self.config)
kls = import_item(self.kernel_manager_class)
self.kernel_manager = kls(
parent=self, log=self.log, kernel_argv=self.kernel_argv,
parent=self, log=self.log, ipython_kernel_argv=self.ipython_kernel_argv,
connection_dir = self.profile_dir.security_dir,
)
kls = import_item(self.contents_manager_class)

View File

@ -1,35 +1,22 @@
"""A kernel manager relating notebooks and kernels
"""A MultiKernelManager for use in the notebook webserver
Authors:
* Brian Granger
- raises HTTPErrors
- creates REST API models
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from tornado import web
from IPython.kernel.multikernelmanager import MultiKernelManager
from IPython.utils.traitlets import List, Unicode, TraitError
from IPython.utils.traitlets import Unicode, TraitError
from IPython.html.utils import to_os_path
from IPython.utils.py3compat import getcwd
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class MappingKernelManager(MultiKernelManager):
"""A KernelManager that handles notebook mapping and HTTP error handling"""
@ -37,8 +24,6 @@ class MappingKernelManager(MultiKernelManager):
def _kernel_manager_class_default(self):
return "IPython.kernel.ioloop.IOLoopKernelManager"
kernel_argv = List(Unicode)
root_dir = Unicode(getcwd(), config=True)
def _root_dir_changed(self, name, old, new):
@ -89,7 +74,6 @@ class MappingKernelManager(MultiKernelManager):
an existing kernel is returned, but it may be checked in the future.
"""
if kernel_id is None:
kwargs['extra_arguments'] = self.kernel_argv
if path is not None:
kwargs['cwd'] = self.cwd_for_path(path)
kernel_id = super(MappingKernelManager, self).start_kernel(