Skip to content

Commit

Permalink
👌 IMPROVE: Add aiida_jupyter_extra_args (#64)
Browse files Browse the repository at this point in the history
When doing manual tests in the docker container (generated by `tox converge`), this allows for the addition of `--allow-root`, required to start the jupyter server as root user.
  • Loading branch information
chrisjsewell authored Dec 6, 2020
1 parent 6054697 commit a14fde8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ To start a jupyter lab server:
```console
$ aiida-jupyterlab
...
To access the notebook, open this file in a browser:
file:///root/.local/share/jupyter/runtime/nbserver-14617-open.html
Or copy and paste one of these URLs:
http://localhost:8890/?token=a7086764cda7aba8488a767386d57121429958771a8bccb2
or http://127.0.0.1:8890/?token=a7086764cda7aba8488a767386d57121429958771a8bccb2
```
## Development and testing
Expand Down Expand Up @@ -98,6 +104,26 @@ pip install tox
tox
```

To manually test the created docker container, first run:

```bash
tox converge
```

This will run the ansible role, leaving the container running.
The recommended way to interact with the container is then to use the [VS Code Docker extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
Using this you can then attach a visual studio code instance:

![VS Code Docker extension](./vscode.png)

Inside the container run `aiida-jupyterlab`, and you will be able to access the supplied URL from your local browser.

When you are finished with the container, destroy the container with:

```bash
tox destroy
```

## Code style

Code style is formatted and linted with [pre-commit](https://pre-commit.com/).
Expand Down
2 changes: 2 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ provisioner:
ansible_python_interpreter: /usr/bin/python3
aiida_python_version: "${MOLECULE_PYTHON_VERSION:-3.7}"
install_node: "${MOLECULE_INSTALL_NODE:-no}"
# for testing in docker container
aiida_jupyter_extra_args: "--allow-root"
2 changes: 1 addition & 1 deletion templates/jupyterlab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if jupyter notebook list | grep localhost:${1:-{{ aiida_jupyter_port }}}; then
echo "already open at: $url"
xdg-open $url
else
jupyter lab --MultiKernelManager.default_kernel_name='{{ aiida_kernel_name }}' --port=${1:-{{ aiida_jupyter_port }}}
jupyter lab --MultiKernelManager.default_kernel_name='{{ aiida_kernel_name }}' --port=${1:-{{ aiida_jupyter_port }}} {{ aiida_jupyter_extra_args | default('') }}
fi
Binary file added vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a14fde8

Please sign in to comment.