Skip to content

Commit 0ace0e8

Browse files
add comments to explain signal handling under jupyterhub
1 parent 74655ce commit 0ace0e8

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
@@ -2388,7 +2388,14 @@ def init_signal(self) -> None:
23882388
signal.signal(signal.SIGINFO, self._signal_info)
23892389

23902390
def _handle_sigint(self, sig: t.Any, frame: t.Any) -> None:
2391-
"""SIGINT handler spawns confirmation dialog"""
2391+
"""SIGINT handler spawns confirmation dialog
2392+
2393+
Note:
2394+
JupyterHub replaces this method with _signal_stop
2395+
in order to bypass the interactive prompt.
2396+
https://github.com/jupyterhub/jupyterhub/pull/4864
2397+
2398+
"""
23922399
# register more forceful signal handler for ^C^C case
23932400
signal.signal(signal.SIGINT, self._signal_stop)
23942401
# request confirmation dialog in bg thread, to avoid
@@ -2446,7 +2453,13 @@ def _confirm_exit(self) -> None:
24462453
self.io_loop.add_callback_from_signal(self._restore_sigint_handler)
24472454

24482455
def _signal_stop(self, sig: t.Any, frame: t.Any) -> None:
2449-
"""Handle a stop signal."""
2456+
"""Handle a stop signal.
2457+
2458+
Note:
2459+
JupyterHub configures this method to be called for SIGINT.
2460+
https://github.com/jupyterhub/jupyterhub/pull/4864
2461+
2462+
"""
24502463
self.log.critical(_i18n("received signal %s, stopping"), sig)
24512464
self.stop(from_signal=True)
24522465

0 commit comments

Comments
 (0)