diff --git a/Jenkinsfile b/Jenkinsfile index e07652aa..29db25ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { // https://jenkins.io/doc/book/pipeline/syntax/ agent { docker { - image "pavics/workflow-tests:220401" + image "pavics/workflow-tests:220502" label 'linux && docker' } } diff --git a/binder/Dockerfile b/binder/Dockerfile index c7cc9ea8..9ac81ef9 100644 --- a/binder/Dockerfile +++ b/binder/Dockerfile @@ -1,4 +1,4 @@ -FROM pavics/workflow-tests:220401 +FROM pavics/workflow-tests:220502 USER root @@ -12,6 +12,12 @@ WORKDIR /notebooks RUN ./downloadrepos; DEPLOY_PAVICS_LANDING_NB=1 ./reorg-notebooks; rm -rfv downloadrepos default_build_params reorg-notebooks; chown -R jenkins:jenkins . -RUN pip install https://github.com/Ouranosinc/xclim/archive/master.tar.gz +#COPY binder/test-notebooks /notebooks + +#RUN mkdir -p subdir1/subdir2; cp TEST-panel-servable.ipynb subdir1/servable1.ipynb; cp TEST-panel-servable.ipynb subdir1/subdir2/servable2.ipynb; cp TEST-panel-servable.ipynb TEST-panel-servable-Copy.ipynb + +#RUN chown jenkins:jenkins -R . + +# RUN pip install https://github.com/Ouranosinc/xclim/archive/master.tar.gz USER jenkins diff --git a/binder/test-notebooks/TEST-panel-binder.ipynb b/binder/test-notebooks/TEST-panel-binder.ipynb new file mode 100644 index 00000000..284bd260 --- /dev/null +++ b/binder/test-notebooks/TEST-panel-binder.ipynb @@ -0,0 +1,85 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "d79b1053-3144-47d4-824f-49a3666d68e6", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:bokeh.server.util:Host wildcard '*' will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Launching server at http://localhost:5007\n" + ] + } + ], + "source": [ + "import panel as pn\n", + "srv = pn.panel(\n", + " pn.widgets.FloatInput(name='an input')\n", + ").show(port=5007, websocket_origin=\"*\")" + ] + }, + { + "cell_type": "markdown", + "id": "8f18de16-80bd-40dc-9438-ca176fc8c169", + "metadata": {}, + "source": [ + "Your current URL should look something like:\n", + "\n", + "https://hub.gke2.mybinder.org/user/ouranosinc-pavi--workflow-tests-9jerf8qk/lab/tree/TEST-panel-binder.ipynb\n", + "\n", + "Open a new browser tab, then to go to something like this URL (replace `lab/tree/TEST-panel-binder.ipynb` with `proxy/5007/`):\n", + "\n", + "https://hub.gke2.mybinder.org/user/ouranosinc-pavi--workflow-tests-9jerf8qk/proxy/5007/" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d39a37c-8df6-4f27-9aeb-54181f35c295", + "metadata": {}, + "outputs": [], + "source": [ + "srv.stop() # To stop the server." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fb898f21-f543-40b4-8bf4-b701559b842f", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/binder/test-notebooks/TEST-panel-servable.ipynb b/binder/test-notebooks/TEST-panel-servable.ipynb new file mode 100644 index 00000000..16e5ca2a --- /dev/null +++ b/binder/test-notebooks/TEST-panel-servable.ipynb @@ -0,0 +1,36 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7acdd82a-bc2d-443c-8fa8-e432de9cfa30", + "metadata": {}, + "outputs": [], + "source": [ + "import panel as pn\n", + "pn.panel('# Ceci est un test').servable()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docker/Dockerfile b/docker/Dockerfile index 6c19bf04..02ce8a47 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ # Change /opt/conda folder permissions for jupyter-conda extension. RUN groupadd --gid 1000 jenkins \ && useradd --uid 1000 --gid jenkins --create-home jenkins && \ - chmod -R a+rwx /opt/conda + chmod -R a+rwX /opt/conda COPY environment.yml /environment.yml @@ -70,7 +70,9 @@ RUN python -m ipykernel install --name birdy # https://github.com/plotly/jupyter-dash/issues/49 RUN jupyter lab build -RUN jupyter serverextension enable voila --sys-prefix +RUN jupyter serverextension enable voila --sys-prefix \ + && jupyter serverextension enable panel.io.jupyter_server_extension --sys-prefix \ + && jupyter serverextension list # && jupyter labextension install jupyterlab-clipboard # This should be "master" but commit @@ -94,7 +96,11 @@ RUN wget https://raw.githubusercontent.com/jupyter/docker-stacks/$DOCKER_STACKS_ chmod a+rx /usr/local/bin/start.sh /usr/local/bin/start-singleuser.sh /usr/local/bin/start-notebook.sh /usr/local/bin/fix-permissions && \ chmod a+r /etc/jupyter/jupyter_notebook_config.py && \ mkdir /notebook_dir && chown jenkins /notebook_dir && \ - chmod a+rwX -R /opt/conda/envs/birdy/fonts + chmod a+rwX -R /opt/conda/envs/birdy/fonts && \ + chmod a+rwX -R /opt/conda/pkgs/cache + +# For jupyter-panel-proxy launcher. +ENV BOKEH_ALLOW_WS_ORIGIN "*" # problem running start-notebook.sh when being root # the jupyter/base-notebook image also do not default to root user so we do the same here diff --git a/docker/environment.yml b/docker/environment.yml index 62a156c7..0b342762 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -5,6 +5,7 @@ channels: - cdat - bokeh - plotly # for jupyter-dash + - pyviz/label/dev # for jupyter-panel-proxy, panel - defaults dependencies: @@ -27,9 +28,6 @@ dependencies: - dask <= 2022.1.0 - distributed <= 2022.1.0 - # Pin cf_xarray for slow WPS_example.ipynb. - - cf_xarray<=0.6.3 - - matplotlib # - xarray # from xclim and ravenpy # - numpy # from xclim and ravenpy @@ -57,7 +55,7 @@ dependencies: - jupyter_bokeh - pscript - h5netcdf - - panel + - panel >= 0.13.1a3 # https://github.com/holoviz/panel - pyviz_comms # (was labextension pyviz/jupyterlab_pyviz in jupyterlab v2) - holoviews @@ -119,7 +117,7 @@ dependencies: # warnings.warn(f'Downloading: {url}', DownloadWarning) - shapely <= 1.7.1 # https://github.com/roocs/clisops - - clisops >= 0.8.0 + - clisops >= 0.9.0 # Universal Regridder for Geospatial Data # https://github.com/pangeo-data/xESMF # xesmf-0.6.2 requires clisops>=0.8.0 @@ -170,6 +168,12 @@ dependencies: # xeus-python: back-end kernel implementing the Jupyter Debug Protocol - xeus-python - jupyter-dash + # https:://github.com/jupyterhub/jupyter-server-proxy + - jupyter-server-proxy + # https://github.com/dask/dask-labextension + - dask-labextension + # https://github.com/holoviz/jupyter-panel-proxy + - jupyter-panel-proxy >= 0.2.0a2 # Force newer nodejs for 'jupyter lab build' issue # https://github.com/jupyterlab/jupyterlab/issues/11726#issuecomment-998901247 # TODO: remove nodejs once all extensions move to prebuilt extensions, see comment @@ -197,7 +201,9 @@ dependencies: # Mimics how one might format their calculation if it were written with a # pencil: write the symbolic formula, followed by numeric substitutions, # and then the result. - - handcalcs + # DISABLE handcalcs, interfere with "Panel preview" button + # See comment https://github.com/holoviz/panel/issues/3440#issuecomment-1112182170 + # - handcalcs # https://github.com/ShopRunner/jupyter-notify # Jupyter Magic For Browser Notifications of Cell Completion. - jupyternotify diff --git a/launchcontainer b/launchcontainer index 0b1a1338..d074153e 100755 --- a/launchcontainer +++ b/launchcontainer @@ -1,7 +1,7 @@ #!/bin/sh -x if [ -z "$DOCKER_IMAGE" ]; then - DOCKER_IMAGE="pavics/workflow-tests:220401" + DOCKER_IMAGE="pavics/workflow-tests:220502" fi if [ -z "$CONTAINER_NAME" ]; then diff --git a/launchnotebook b/launchnotebook index b6e60684..f8a1b445 100755 --- a/launchnotebook +++ b/launchnotebook @@ -7,7 +7,7 @@ if [ -z "$PORT" ]; then fi if [ -z "$DOCKER_IMAGE" ]; then - DOCKER_IMAGE="pavics/workflow-tests:220401" + DOCKER_IMAGE="pavics/workflow-tests:220502" fi if [ -z "$CONTAINER_NAME" ]; then