Skip to content
Snippets Groups Projects
Commit 0432dc9b authored by Corné Lukken's avatar Corné Lukken
Browse files

Merge branch 'L2SS-499-import-tangostationcontrol' into 'master'

L2SS-499: Expose tangostationcontrol package to jupyter

Closes L2SS-499

See merge request !192
parents 5f34e990 9f8bde08
No related branches found
No related tags found
1 merge request!192L2SS-499: Expose tangostationcontrol package to jupyter
......@@ -2,6 +2,11 @@
# Serves as entrypoint script for docker containers
if [[ ! -d "/opt/lofar/tango" ]]; then
>&2 echo "/opt/lofar/tango volume does not exist!"
exit 1
fi
# Check required support file exists
if [[ ! -f "/usr/local/bin/wait-for-it.sh" ]]; then
>&2 echo "/usr/local/bin/wait-for-it.sh file does not exist!"
......@@ -14,6 +19,11 @@ if [[ ! $TANGO_HOST ]]; then
exit 1
fi
# Store directory so we can return to it after installation
CWD=$(pwd)
cd /opt/lofar/tango || exit 1
# Check if configured for specific version
if [[ $TANGOSTATIONCONTROL ]]; then
# TODO (Corne): Download version from artifacts or pypi.
......@@ -28,4 +38,8 @@ else
sudo pip install --force-reinstall "$(ls -Art /tmp/tangostationcontrol/*.whl | tail -n 1)"
fi
# Return to the stored the directory, this preserves the working_dir argument in
# docker-compose files.
cd "$CWD" || exit 1
/usr/local/bin/wait-for-it.sh "$TANGO_HOST" --timeout=30 --strict -- "$@"
......@@ -31,10 +31,6 @@ services:
user: ${CONTAINER_EXECUTION_UID}
working_dir: /jupyter-notebooks
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- /opt/lofar/tango/bin/start-ds.sh
- /usr/bin/tini -- /usr/local/bin/jupyter-notebook --port=8888 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token= --NotebookApp.password=
restart: unless-stopped
......@@ -10,23 +10,13 @@ ENV HOME=/home/user
RUN sudo mkdir -p ${HOME}
RUN sudo chown ${CONTAINER_EXECUTION_UID} -R ${HOME}
# ipython 7.28 is broken in combination with Jupyter, it causes connection errors with notebooks
RUN sudo pip3 install ipython==7.27.0
RUN sudo pip3 install jupyter
RUN sudo pip3 install ipykernel
RUN sudo pip3 install jupyter_bokeh
# Install matplotlib, jupyterplot
RUN sudo pip3 install matplotlib jupyterplot
# Allow Download as -> PDF via html
RUN sudo pip3 install nbconvert
RUN sudo pip3 install notebook-as-pdf
COPY requirements.txt ./
RUN sudo pip3 install -r requirements.txt
# see https://github.com/jupyter/nbconvert/issues/1434
RUN sudo bash -c "echo DEFAULT_ARGS += [\\\"--no-sandbox\\\"] >> /usr/local/lib/python3.7/dist-packages/pyppeteer/launcher.py"
RUN sudo apt-get update -y
RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libcairo-gobject2 libxinerama1 libgtk2.0-0 libpangoft2-1.0-0 libthai0 libpixman-1-0 libxcb-render0 libharfbuzz0b libdatrie1 libgraphite2-3 libgbm1
RUN sudo apt-get install -y git gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libcairo-gobject2 libxinerama1 libgtk2.0-0 libpangoft2-1.0-0 libthai0 libpixman-1-0 libxcb-render0 libharfbuzz0b libdatrie1 libgraphite2-3 libgbm1
# Allow Download as -> PDF via LaTeX
RUN sudo apt-get install -y texlive-xetex texlive-fonts-recommended texlive-latex-recommended
......@@ -43,15 +33,8 @@ RUN sudo chown ${CONTAINER_EXECUTION_UID} -R /opt/ipython-profiles
COPY jupyter-kernels /usr/local/share/jupyter/kernels/
# Install patched jupyter executable
RUN sudo pip3 install python-logstash-async
COPY jupyter-notebook /usr/local/bin/jupyter-notebook
#Install further python modules
RUN sudo pip3 install PyMySQL[rsa] sqlalchemy
# Packages to interface with testing hardware directly
RUN sudo pip3 install pyvisa pyvisa-py opcua
# Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes.
ENV TINI_VERSION v0.6.0
ENV JUPYTER_RUNTIME_DIR=/tmp
......
from tangostationcontrol import *
\ No newline at end of file
GitPython >= 3.1.24 # BSD
ipython >=7.27.0,!=7.28.0 # BSD
jupyter
ipykernel
jupyter_bokeh
matplotlib
jupyterplot
nbconvert
notebook-as-pdf
python-logstash-async
PyMySQL[rsa]
sqlalchemy
pyvisa
pyvisa-py
opcua
\ No newline at end of file
......@@ -63,7 +63,7 @@ Typically, ``N_ant == 192``, and ``N_blocks == 136``.
The metadata refers to the *blocks*, which are emitted by the FPGAs to represent the XSTs between 12 x 12 consecutive antennas. The following code converts block numbers to the indices of the first antenna pair in a block::
from common.baselines import baseline_from_index
from tangostationcontrol.common.baselines import baseline_from_index
def first_antenna_pair(block_nr: int) -> int:
coarse_a, coarse_b = baseline_from_index(block_nr)
......@@ -71,7 +71,7 @@ The metadata refers to the *blocks*, which are emitted by the FPGAs to represent
Conversely, to calculate the block index for an antenna pair ``(a,b)``, use::
from common.baselines import baseline_index
from tangostationcontrol.common.baselines import baseline_index
def block_nr(a: int, b: int) -> int:
return baseline_index(a // 12, b // 12)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment