From 4605af7dba5aa3b4823204c045fd6ae54b50c3c9 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Sun, 14 Jul 2024 20:33:31 +0100 Subject: [PATCH 1/3] WIP: Switch to nbclassic --- build.json | 2 +- stack/base/Dockerfile | 2 +- stack/lab/Dockerfile | 23 +++++++++-------------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/build.json b/build.json index c5d110f4..a12f4b9a 100644 --- a/build.json +++ b/build.json @@ -7,7 +7,7 @@ "default": "15" }, "RMQ_VERSION": { - "default": "3.9.13" + "default": "3.11.4" }, "AIIDA_VERSION": { "default": "2.5.1" diff --git a/stack/base/Dockerfile b/stack/base/Dockerfile index 25e5091d..f3af9f1e 100644 --- a/stack/base/Dockerfile +++ b/stack/base/Dockerfile @@ -46,7 +46,7 @@ ENV PIP_USER 1 # Upgrade pip and mamba to latest # Install aiida-core and other shared requirements. -RUN mamba update -y pip && \ +RUN mamba update -y pip zstandard && \ mamba install --yes \ aiida-core==${AIIDA_VERSION} \ mamba-bash-completion \ diff --git a/stack/lab/Dockerfile b/stack/lab/Dockerfile index 3bcb97bd..e5588d8a 100644 --- a/stack/lab/Dockerfile +++ b/stack/lab/Dockerfile @@ -4,11 +4,9 @@ FROM base LABEL maintainer="AiiDAlab Team " # By default, Jupyter Docker image launches the JupyterLab interface. -# Here, we change it to the classic Jupyter Notebook which is used by AiiDAlab. -# In the future, we might want to switch to other options such as `nbclassic` or `retro`, -# but the `nbclassic` is not supported because of appmode. -# see: https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#switching-back-to-the-classic-notebook-or-using-a-different-startup-command -ENV DOCKER_STACKS_JUPYTER_CMD=notebook +# Here, we change it to the nbclassic Jupyter Notebook which is used by AiiDAlab. +# https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#switching-back-to-the-classic-notebook-or-using-a-different-startup-command +ENV DOCKER_STACKS_JUPYTER_CMD=nbclassic USER root WORKDIR /opt/ @@ -17,6 +15,7 @@ WORKDIR /opt/ ARG AIIDALAB_VERSION RUN mamba install --yes \ aiidalab=${AIIDALAB_VERSION} \ + appmode=1.0.0 \ && mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" @@ -38,14 +37,9 @@ RUN git clone https://github.com/aiidalab/aiidalab-home && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" -# Install and enable appmode, turning Jupyter notebooks to Apps -RUN pip install appmode==0.8.0 --no-cache-dir --no-user -# Enable appmode extension -RUN jupyter nbextension enable --py --sys-prefix appmode && \ - jupyter serverextension enable --py --sys-prefix appmode - # Swap appmode icon for AiiDAlab gears icon, shown during app load -COPY --chown=${NB_UID}:${NB_GID} gears.svg ${CONDA_DIR}/share/jupyter/nbextensions/appmode/gears.svg +# TODO: What is the correct directory for nbclassic? +#COPY --chown=${NB_UID}:${NB_GID} gears.svg ${CONDA_DIR}/share/jupyter/nbextensions/appmode/gears.svg # Copy start-up scripts for AiiDAlab. COPY before-notebook.d/* /usr/local/bin/before-notebook.d/ @@ -75,7 +69,8 @@ USER ${NB_USER} WORKDIR "/home/${NB_USER}" -RUN mkdir -p /home/${NB_USER}/apps +RUN mkdir -p /home/${NB_USER}/apps +RUN mkdir -p /home/${NB_USER}/.tmp_notebooks # When a Jupyter notebook server looses a connection to the frontend, # it keeps the messages in a buffer. If there is a background thread running @@ -89,7 +84,7 @@ RUN mkdir -p /home/${NB_USER}/apps # more than 12 hours. We also close all inactive terminals after 10 minutes. ENV NOTEBOOK_ARGS \ "--NotebookApp.default_url='/apps/apps/home/start.ipynb'" \ - "--ContentsManager.allow_hidden=True" \ + "--Appmode.temp_dir=/home/${NB_USER}/.tmp_notebooks" \ "--MappingKernelManager.buffer_offline_messages=True" \ "--MappingKernelManager.cull_busy=True" \ "--MappingKernelManager.cull_connected=True" \ From f1afae25bc122bc9f2b8859406eb5dad2f90f872 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Sun, 14 Jul 2024 21:11:03 +0100 Subject: [PATCH 2/3] Python 3.11 --- build.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.json b/build.json index a12f4b9a..c393374f 100644 --- a/build.json +++ b/build.json @@ -1,13 +1,13 @@ { "variable": { "PYTHON_VERSION": { - "default": "3.9.13" + "default": "3.11.4" }, "PGSQL_VERSION": { "default": "15" }, "RMQ_VERSION": { - "default": "3.11.4" + "default": "3.9.13" }, "AIIDA_VERSION": { "default": "2.5.1" From 9f351bc3e607de347f3d559d301c1fe6f1b0d13c Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Mon, 15 Jul 2024 00:04:34 +0100 Subject: [PATCH 3/3] Fix integration test --- tests/test_aiidalab_apps.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_aiidalab_apps.py b/tests/test_aiidalab_apps.py index c30fcd8c..f690f777 100644 --- a/tests/test_aiidalab_apps.py +++ b/tests/test_aiidalab_apps.py @@ -35,6 +35,11 @@ def _generate_aiidalab_install_output(package_name): if pkg: app_name = pkg.split("@")[0] aiidalab_exec(f"aiidalab uninstall --yes --force {app_name}", user=nb_user) + # TODO: Remove this after solving https://github.com/aiidalab/aiidalab/issues/405 + pkg_name = app_name + if app_name.lower() == "quantum-espresso": + pkg_name = "aiidalab-qe" + aiidalab_exec(f"pip uninstall --yes {pkg_name}", user=nb_user) @pytest.mark.parametrize("package_name", ["aiidalab-widgets-base", "quantum-espresso"])