Getting started
This page contains instructions for users who want to get started with usage and development of the TMC Resource Monitor.
Background
TMC is responsible for monitoring the current allocation of resources and overall resource allocation in the running telescope system, and making this status available to OSO. TMC collates or aggregates this information as a part of its monitoring.
To cater this requirement a separate TMC component Resource Monitor is introduced which will work in tandem with other sub-systems.
TMC Resource Monitor TANGO device, relies on information available in different attributes of subsystems for capturing and reporting the resource allocation status.
Further details are available here.
Detailed information on how the SKA Software development community works is available at the SKA software developer portal. There you will find guidelines, policies, standards and a range of other documentation.
Set up your development environment
This project is structured to use k8s for development and testing so that the build environment, test environment and test results are all completely reproducible and are independent of host environment. It uses make to provide a consistent UI (run make help for targets documentation).
Install minikube
You will need to install minikube or equivalent k8s installation in order to set up your test environment. You can follow the instruction here:
git clone git@gitlab.com:ska-telescope/sdi/deploy-minikube.git
cd deploy-minikube
make all
eval $(minikube docker-env)
Please note that the command `eval $(minikube docker-env)` will point your local docker client at the docker-in-docker for minikube. Use this only for building the docker image and another shell for other work.
How to Use
Clone this repo:
git clone https://gitlab.com/ska-telescope/ska-tmc/ska-tmc-resource-monitor.git
cd ska-tmc-resource-monitor
Install dependencies:
apt update
apt install -y curl git build-essential libboost-python-dev libtango-dev
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
source $HOME/.poetry/env
- Please note that:
the libtango-dev will install an old version of the TANGO-controls framework (9.2.5);
the best way to get the framework is compiling it (instructions can be found here);
the above script has been tested with Ubuntu 20.04.
During this step, `libtango-dev` instalation can ask for the Tango Server IP:PORT. Just accept the default proposed value.
Activate the poetry environment:
$ eval $(poetry env activate)
Install python requirements for linting and unit testing:
$ poetry install
Run python-test:
$ make python-test
PyTango 9.5.0 (9, 5, 0)
PyTango compiled with:
Python : 3.10.13
Numpy : 1.21.6
Tango : 9.5.0
Boost : 1.82.0
PyTango runtime is:
Python : 3.10.12
Numpy : 1.26.4
Tango : 9.5.0
PyTango running on:
uname_result(system='Linux', node='skancra007', release='6.8.0-84-generic', version='#84~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Sep 9 14:29:36 UTC 2', machine='x86_64')
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-5.4.3, py-1.10.0, pluggy-0.13.1 -- /home/
[....]
--------------------------------- JSON report ----------------------------------
JSON report written to: build/reports/report.json (165946 bytes)
----------- coverage: platform linux, python 3.8.5-final-0 -----------
Coverage HTML written to dir build/htmlcov
Coverage XML written to file build/reports/code-coverage.xml
======================== X passed, X deselected in X.Ys ========================
Formatting the code:
$ make python-format
isort --profile black --line-length 79 src tests/
black --exclude .+\.ipynb --line-length 79 src tests/
All done!
X files left unchanged.
Python linting:
$ make python-lint
[...]
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)