OET Scripts¶
Overview¶
This project contains library code that is useful when creating observing scripts and engineering tests. It provides the user with simple Python objects that can be used to control SKA telescope Tango devices. The primary use case for this module is to support the execution of Scheduling Blocks (SBs). Hence, much of the code is concerned with translating Scheduling Blocks into the equivalent set of scan configuration and execution instructions, and with the issuing of these instructions to TMC devices at the appropriate times.
OET Scripts project modules ska.scripting.domain and ska.scripting.observingtasks are used for
Creating Observing Scripts
High-level control of Tango devices through use of domain objects, for example in Jupyter Notebooks or SKAMPI BDD tests
The observing scripts can be managed and executed by using Observation Execution Tool (OET). For documentation on how to use OET REST client and server to manage observing scripts, see the Observation Execution Tool project documentation
Quickstart¶
This project is structured to use Docker containers 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 (see Makefile targets).
Build a new Docker image for the OET with:
make build
Execute the test suite and lint the project with:
make test && make lint
Launch an interactive shell inside a container, with your workspace visible inside the container:
make interactive
Makefile targets¶
This project contains a Makefile which acts as a UI for building Docker images, testing images, and for launching interactive developer environments. The following make targets are defined:
Makefile target |
Description |
---|---|
build |
Build a new application image containing REST server and scripts |
build_extras |
Build SSH and Jupyter images |
test |
Test the application image |
lint |
Lint the application image |
interactive |
Launch a terminal session, mounting the source directory from the host machine inside the container |
push |
Push the application image to the Docker registry |
push_extras |
Push SSH and Jupyter images to the Docker registry |
rest |
start the OET REST server |
prune |
Delete stale Docker images originating from this project |
help |
show a summary of the makefile targets above |
Creating a new application image¶
make build
target creates a new Docker image for the application based
on the ‘ska-python-runtime’ image. To optimise final image size and to support
the inclusion of C extension Python libraries such as pytango, the application
is built inside an intermediate Docker image which includes compilers and
cached eggs and wheels for commonly-used Python libraries
(‘ska-python-builder’). The resulting Python environment from this
intermediate stage is copied into a final image which extends a minimal SKA
Python runtime environment (‘ska-python-runtime’), to give the final Docker
image for this application.
Interactive development using containers¶
make interactive
launches an interactive session using the application
image, mounting the project source directory at /app inside the container.
This allows the container to run code from the local workspace. Any changes
made to the project source code will immediately be seen inside the container.
Test execution¶
make test
runs the application test procedure defined in
test-harness/Makefile in a temporary container. The Makefile example for
this project runs ‘python setup.py test’ and copies the resulting output and
test artefacts out of the container and into a ‘build’ directory, ready for
inclusion in the CI server’s downloadable artefacts.