mirror of
https://github.com/jupyter/notebook.git
synced 2025-04-24 14:20:54 +08:00
Allow caller of MultiKernelManager.start_kernel to pass kernel_id.
This commit is contained in:
parent
4fadfecbb7
commit
ea2dc2ecd5
@ -79,8 +79,14 @@ class MultiKernelManager(LoggingConfigurable):
|
||||
return False
|
||||
|
||||
def start_kernel(self, **kwargs):
|
||||
"""Start a new kernel."""
|
||||
kernel_id = unicode(uuid.uuid4())
|
||||
"""Start a new kernel.
|
||||
|
||||
The caller can pick a kernel_id by passing one in as a keyword arg,
|
||||
otherwise one will be picked using a uuid.
|
||||
"""
|
||||
kernel_id = kwargs.pop('kernel_id', unicode(uuid.uuid4()))
|
||||
if kernel_id in self:
|
||||
raise DuplicateKernelError('Kernel already exists: %s' % kernel_id)
|
||||
# use base KernelManager for each Kernel
|
||||
km = self.kernel_manager_factory(connection_file=os.path.join(
|
||||
self.connection_dir, "kernel-%s.json" % kernel_id),
|
||||
|
Loading…
x
Reference in New Issue
Block a user