Skip to content

Commit 2a1cd45

Browse files
Pin jupyter_server>=2.0.0 (#1853)
* Pin jupyter_server==2.0.0 * Update scipy-notebook/Dockerfile Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com> * Fix test * Fix test * Test healthcheck properly * Fix typing Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
1 parent 6d1862c commit 2a1cd45

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

base-notebook/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ RUN sed -re "s/c.ServerApp/c.NotebookApp/g" \
6868
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
6969
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server` and `retro` jupyter commands
7070
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
71-
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
71+
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
7272
CMD wget -O- --no-verbose --tries=1 --no-check-certificate \
7373
http${GEN_CERT:+s}://localhost:8888${JUPYTERHUB_SERVICE_PREFIX:-/}api || exit 1
7474

scipy-notebook/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ RUN mamba install --quiet --yes \
3939
'h5py' \
4040
'ipympl'\
4141
'ipywidgets' \
42+
# Temporary fix for: https://github.com/jupyter/docker-stacks/issues/1851
43+
'jupyter_server>=2.0.0' \
4244
'matplotlib-base' \
4345
'numba' \
4446
'numexpr' \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
4+
import logging
5+
import time
6+
7+
from tests.conftest import TrackedContainer, get_health
8+
9+
LOGGER = logging.getLogger(__name__)
10+
11+
12+
def test_health(container: TrackedContainer) -> None:
13+
running_container = container.run_detached(
14+
tty=True,
15+
)
16+
# sleeping some time to let the server start
17+
time.sleep(10)
18+
assert get_health(running_container) == "healthy"

tests/base-notebook/test_packages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"ca-certificates",
7070
"conda-forge::blas[build=openblas]",
7171
"hdf5",
72+
"jupyter_server[version='>", # Temporary fix for: https://github.com/jupyter/docker-stacks/issues/1851
7273
"openssl",
7374
"protobuf",
7475
"python",

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ def find_free_port() -> str:
2424
return s.getsockname()[1] # type: ignore
2525

2626

27+
def get_health(container: Container) -> str:
28+
api_client = docker.APIClient()
29+
inspect_results = api_client.inspect_container(container.name)
30+
return inspect_results["State"]["Health"]["Status"] # type: ignore
31+
32+
2733
@pytest.fixture(scope="session")
2834
def http_client() -> requests.Session:
2935
"""Requests session with retries and backoff."""

0 commit comments

Comments
 (0)