irfpy.aspera developement version on Docker

Using docker for developing and testing irfpy is an interesting approach.

Clone from gitlab

One needs to get the full tree from Gitlab. Contact Futaana for details. Then clone from gitlab.

git clone git@gitlab.irf.se:irfpy/aspera
cd aspera
git checkout develop

git clone git@gitlab.irf.se:irfpy/util irfpy-deps/irfpy.util
git clone git@gitlab.irf.se:irfpy/planets irfpy-deps/irfpy.planets
git clone git@gitlab.irf.se:irfpy/spice irfpy-deps/irfpy.spice

Create an image

To create an image, you can use the command

docker build -t irfpy/aspera-dev -f bin/Dockerfile.dev .

Running ipython

To run the container, you may need to optimize some parameters.

  • data_location: The location where irfpy dataset is stored.

  • local_work_directory: The local working directory.

docker run -it \
        -v <data_location>:/Volumes/scidata/data \
        -v <local_work_directory>:/notebooks irfpy/aspera-dev \
        ipython

For example, you may use

docker run -it --rm \
        -v /Volumes/scidata256/data:/Volumes/scidata/data \
        -v $(pwd):/notebooks irfpy/aspera-dev \
        ipython

Then ipython is launched.

In [1]: import irfpy.aspera
In [2]: print(irfpy.aspera.__version__)
4.3.15a1

Start Jupyter Notebook

To run the Jupyter notebook, one should also specify the local port to be opened.

  • local_port: The listening port for Jupyter.

docker run --rm -it \
        -p <local_port>:8888 \
        -v <data_location>:/Volumes/scidata/data \
        -v <local_work_directory>:/notebooks irfpy/aspera \
        bash -c "/opt/conda/bin/jupyter notebook --notebook-dir=/notebooks --ip=0.0.0.0 -

-port=8888 –no-browser –allow-root”

For example,

docker run --rm -it \
        -p 8888:8888 \
        -v /Volumes/scidata256/data:/Volumes/scidata/data \
        -v $(pwd):/notebooks irfpy/aspera \
        bash -c "/opt/conda/bin/jupyter notebook --notebook-dir=/notebooks --ip=0.0.0.0 -

-port=8888 –no-browser –allow-root”

The prompt shows the token as follows. Connect to the server now.

http://127.0.0.1:8888/?token=8807e4ea827ec6183be8c9c609922b1aff9898aaf0be8f3e

Token is changed everytime.

Unit test

For the development image, the unittest can be run.

docker run --rm -it -v /Volumes/scidata/data:/Volumes/scidata/data irfpy/aspera-dev \
        bash -c "cd /tmp && /opt/conda/bin/nosetests -c .nose.cfg"