##// END OF EJS Templates
Merge pull request #5469 from dalejung/nbm_kernel_path...
Min RK -
r16424:0c3f033a merge
parent child Browse files
Show More
@@ -63,6 +63,10 b' class MappingKernelManager(MultiKernelManager):'
63 63
64 64 def cwd_for_path(self, path):
65 65 """Turn API path into absolute OS path."""
66 # short circuit for NotebookManagers that pass in absolute paths
67 if os.path.exists(path):
68 return path
69
66 70 os_path = to_os_path(path, self.root_dir)
67 71 # in the case of notebooks and kernels not being on the same filesystem,
68 72 # walk up to root_dir if the paths don't exist
@@ -492,3 +492,7 b' class FileNotebookManager(NotebookManager):'
492 492
493 493 def info_string(self):
494 494 return "Serving notebooks from local directory: %s" % self.notebook_dir
495
496 def get_kernel_path(self, name, path='', model=None):
497 """ Return the path to start kernel in """
498 return os.path.join(self.notebook_dir, path)
@@ -168,6 +168,10 b' class NotebookManager(LoggingConfigurable):'
168 168 # NotebookManager API part 2: methods that have useable default
169 169 # implementations, but can be overridden in subclasses.
170 170
171 def get_kernel_path(self, name, path='', model=None):
172 """ Return the path to start kernel in """
173 return path
174
171 175 def increment_filename(self, basename, path=''):
172 176 """Increment a notebook filename without the .ipynb to make it unique.
173 177
@@ -62,7 +62,9 b' class SessionRootHandler(IPythonHandler):'
62 62 if sm.session_exists(name=name, path=path):
63 63 model = sm.get_session(name=name, path=path)
64 64 else:
65 kernel_id = km.start_kernel(path=path)
65 # allow nbm to specify kernels cwd
66 kernel_path = nbm.get_kernel_path(name=name, path=path)
67 kernel_id = km.start_kernel(path=kernel_path)
66 68 model = sm.create_session(name=name, path=path, kernel_id=kernel_id)
67 69 location = url_path_join(self.base_url, 'api', 'sessions', model['id'])
68 70 self.set_header('Location', url_escape(location))
General Comments 0
You need to be logged in to leave comments. Login now