Skip to content

Commit e544fa1

Browse files
add comments to explain signal handling under jupyterhub (#1452)
1 parent 045dc46 commit e544fa1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

jupyter_server/serverapp.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,7 +2410,14 @@ def init_signal(self) -> None:
24102410
signal.signal(signal.SIGINFO, self._signal_info)
24112411

24122412
def _handle_sigint(self, sig: t.Any, frame: t.Any) -> None:
2413-
"""SIGINT handler spawns confirmation dialog"""
2413+
"""SIGINT handler spawns confirmation dialog
2414+
2415+
Note:
2416+
JupyterHub replaces this method with _signal_stop
2417+
in order to bypass the interactive prompt.
2418+
https://github.com/jupyterhub/jupyterhub/pull/4864
2419+
2420+
"""
24142421
# register more forceful signal handler for ^C^C case
24152422
signal.signal(signal.SIGINT, self._signal_stop)
24162423
# request confirmation dialog in bg thread, to avoid
@@ -2468,7 +2475,13 @@ def _confirm_exit(self) -> None:
24682475
self.io_loop.add_callback_from_signal(self._restore_sigint_handler)
24692476

24702477
def _signal_stop(self, sig: t.Any, frame: t.Any) -> None:
2471-
"""Handle a stop signal."""
2478+
"""Handle a stop signal.
2479+
2480+
Note:
2481+
JupyterHub configures this method to be called for SIGINT.
2482+
https://github.com/jupyterhub/jupyterhub/pull/4864
2483+
2484+
"""
24722485
self.log.critical(_i18n("received signal %s, stopping"), sig)
24732486
self.stop(from_signal=True)
24742487

0 commit comments

Comments
 (0)