Skip to content

Commit

Permalink
Pin jupyter_server>=2.0.0 (#1853)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mathbunnyru and consideRatio authored Dec 30, 2022
1 parent 6d1862c commit 2a1cd45
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ RUN sed -re "s/c.ServerApp/c.NotebookApp/g" \
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server` and `retro` jupyter commands
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
CMD wget -O- --no-verbose --tries=1 --no-check-certificate \
http${GEN_CERT:+s}://localhost:8888${JUPYTERHUB_SERVICE_PREFIX:-/}api || exit 1

Expand Down
2 changes: 2 additions & 0 deletions scipy-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ RUN mamba install --quiet --yes \
'h5py' \
'ipympl'\
'ipywidgets' \
# Temporary fix for: https://github.com/jupyter/docker-stacks/issues/1851
'jupyter_server>=2.0.0' \
'matplotlib-base' \
'numba' \
'numexpr' \
Expand Down
18 changes: 18 additions & 0 deletions tests/base-notebook/test_healthcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import logging
import time

from tests.conftest import TrackedContainer, get_health

LOGGER = logging.getLogger(__name__)


def test_health(container: TrackedContainer) -> None:
running_container = container.run_detached(
tty=True,
)
# sleeping some time to let the server start
time.sleep(10)
assert get_health(running_container) == "healthy"
1 change: 1 addition & 0 deletions tests/base-notebook/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"ca-certificates",
"conda-forge::blas[build=openblas]",
"hdf5",
"jupyter_server[version='>", # Temporary fix for: https://github.com/jupyter/docker-stacks/issues/1851
"openssl",
"protobuf",
"python",
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def find_free_port() -> str:
return s.getsockname()[1] # type: ignore


def get_health(container: Container) -> str:
api_client = docker.APIClient()
inspect_results = api_client.inspect_container(container.name)
return inspect_results["State"]["Health"]["Status"] # type: ignore


@pytest.fixture(scope="session")
def http_client() -> requests.Session:
"""Requests session with retries and backoff."""
Expand Down

0 comments on commit 2a1cd45

Please sign in to comment.