Skip to content

Commit

Permalink
short kernel heartbeat interval (jupyter-server#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer authored and GitHub Enterprise committed May 2, 2022
1 parent fe76e78 commit b005dfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion data_studio_jupyter_extensions/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
"default_provisioner_name": "notebook-service-provisioner"
},
"KernelManager": {
"restarter_class": "data_studio_jupyter_extensions.configurables.kernel_restarter.DataStudioKernelPoller"
"restarter_class": "data_studio_jupyter_extensions.configurables.kernel_restarter.DataStudioKernelRestarter"
},
"KernelRestarter": {"time_to_dead": 1},
"Session": {"key": b"notebooks"},
"ServerApp": {
"log_level": "DEBUG",
Expand Down
10 changes: 5 additions & 5 deletions data_studio_jupyter_extensions/configurables/kernel_restarter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from data_studio_jupyter_extensions.configurables.kernel_status import KernelStatusMixin


class DataStudioKernelPoller(AsyncIOLoopKernelRestarter, KernelStatusMixin):
class DataStudioKernelRestarter(AsyncIOLoopKernelRestarter, KernelStatusMixin):
"""Replaces the default Restarter with an object that *does not* restart kernels, but
just polls them.
"""

_attempt_count = Int(0)
_connected_once = Bool(False)
Expand Down Expand Up @@ -72,8 +75,6 @@ async def poll(self):
if km.heartbeat_timeout < (now - self._start_time):
self._disconnected_state()
await self.kernel_manager.shutdown_kernel()
return
return
# Kernel connected before; but a heartbeat was missed
else:
self._attempt_count += 1
Expand All @@ -99,5 +100,4 @@ async def poll(self):
# shutdown the kernel.
self._disconnected_state()
await self.kernel_manager.shutdown_kernel()
return
self._attempt_count = 0
self._attempt_count = 0

0 comments on commit b005dfd

Please sign in to comment.