Skip to content

Commit 680fda9

Browse files
committed
Revert "Changes necessary to get async kernel startup working"
This reverts commit 5103959. Plan is to introduce parallel start_kernel_async methods on KernelManager and MultiKernelManager for now.
1 parent 5103959 commit 680fda9

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

jupyter_client/manager.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import time
1414

1515
import zmq
16-
from tornado import gen
16+
1717
from ipython_genutils.importstring import import_item
1818
from .localinterfaces import is_local_ip, local_ips
1919
from traitlets import (
@@ -205,7 +205,6 @@ def _close_control_socket(self):
205205
self._control_socket.close()
206206
self._control_socket = None
207207

208-
@gen.coroutine
209208
def start_kernel(self, **kw):
210209
"""Starts a kernel on this host in a separate process.
211210
@@ -247,7 +246,8 @@ def start_kernel(self, **kw):
247246

248247
# launch the kernel subprocess
249248
self.log.debug("Starting kernel: %s", kernel_cmd)
250-
self.kernel = yield gen.maybe_future(self._launch_kernel(kernel_cmd, env=env, **kw))
249+
self.kernel = self._launch_kernel(kernel_cmd, env=env,
250+
**kw)
251251
self.start_restarter()
252252
self._connect_control_socket()
253253

@@ -324,7 +324,6 @@ def shutdown_kernel(self, now=False, restart=False):
324324

325325
self.cleanup(connection_file=not restart)
326326

327-
@gen.coroutine
328327
def restart_kernel(self, now=False, newports=False, **kw):
329328
"""Restarts a kernel with the arguments that were used to launch it.
330329
@@ -362,7 +361,7 @@ def restart_kernel(self, now=False, newports=False, **kw):
362361

363362
# Start new kernel.
364363
self._launch_args.update(kw)
365-
yield gen.maybe_future(self.start_kernel(**self._launch_args))
364+
self.start_kernel(**self._launch_args)
366365

367366
@property
368367
def has_kernel(self):

jupyter_client/multikernelmanager.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import os
99
import uuid
10+
1011
import zmq
1112

12-
from tornado import gen
1313
from traitlets.config.configurable import LoggingConfigurable
1414
from ipython_genutils.importstring import import_item
1515
from traitlets import (
@@ -82,7 +82,6 @@ def __len__(self):
8282
def __contains__(self, kernel_id):
8383
return kernel_id in self._kernels
8484

85-
@gen.coroutine
8685
def start_kernel(self, kernel_name=None, **kwargs):
8786
"""Start a new kernel.
8887
@@ -108,9 +107,9 @@ def start_kernel(self, kernel_name=None, **kwargs):
108107
parent=self, log=self.log, kernel_name=kernel_name,
109108
**constructor_kwargs
110109
)
111-
yield gen.maybe_future(km.start_kernel(**kwargs))
110+
km.start_kernel(**kwargs)
112111
self._kernels[kernel_id] = km
113-
raise gen.Return(kernel_id)
112+
return kernel_id
114113

115114
@kernel_method
116115
def shutdown_kernel(self, kernel_id, now=False, restart=False):
@@ -187,25 +186,15 @@ def signal_kernel(self, kernel_id, signum):
187186
"""
188187
self.log.info("Signaled Kernel %s with %s" % (kernel_id, signum))
189188

190-
@gen.coroutine
189+
@kernel_method
191190
def restart_kernel(self, kernel_id, now=False):
192191
"""Restart a kernel by its uuid, keeping the same ports.
193192
194193
Parameters
195194
==========
196195
kernel_id : uuid
197-
The id of the kernel to restart.
198-
199-
now : bool, optional
200-
If True, the kernel is forcefully restarted *immediately*, without
201-
having a chance to do any cleanup action. Otherwise the kernel is
202-
given 1s to clean up before a forceful restart is issued.
203-
204-
In all cases the kernel is restarted, the only difference is whether
205-
it is given a chance to perform a clean shutdown or not.
196+
The id of the kernel to interrupt.
206197
"""
207-
km = self.get_kernel(kernel_id)
208-
yield gen.maybe_future(km.restart_kernel(now))
209198
self.log.info("Kernel restarted: %s" % kernel_id)
210199

211200
@kernel_method

0 commit comments

Comments
 (0)