Skip to main content
# SKA SDP SIP Configuration Database library

## Introduction

This package contains a library providing specialised functions for
interfacing with data objects in the SKA SDP SIP Execution Control
Configuration Database service. The Configuration Database is a backing
service for use by SKA SDP SIP Execution Control and Tango Control components.

For a description of the Data Model used by this library see Sections 7.4.4
and 7.5.6 of the SIP Report.

This library provides modules for each of the data objects stored within
the EC configuration database. These are built on top of a simple low-level
wrapper to the [Python Redis API](https://redis-py.readthedocs.io/en/latest/),
which handles connections to the database and abstraction from the Python
Redis API.

## Installation

This library can be installed using `pip` with the following command:

```bash
pip install -U skasip-config-db
```

## Usage

Example usage:

```python
# coding: utf-8
"""Example usage."""
from sip_config_db.scheduling import Subarray, SchedulingBlockInstance
from sip_config_db.states import SDPState
from sip_config_db.utils.generate_sbi_config import generate_sbi_config

sdp_state = SDPState()
print(sdp_state.current_state)

subarray = Subarray(0)
subarray.activate()
print(subarray.active)

sbi_config = generate_sbi_config(register_workflows=True)
sbi = SchedulingBlockInstance.from_config(sbi_config)
print(sbi.id)
```

## Utility Scripts

The package installs a number of utility scripts, described below:

#### Initialise the database.

`skasip_config_db_init [--data-path=PATH]`

Can be used to initialise the configuration database. The optional
`--data-path=PATH` argument, can be used to defined a custom
path containing the initial set of SDP services and workflows used to
initialise the database. If specifying `--data-path`, and the specified `PATH`
does not exist a copy of the default data pat will be created at the specified
path.

#### Register workflows

Register workflows from the specified workflow path.

```bash
skasip_config_db_register_workflows [workflow path]
```

#### Add an SBI to the database

Adds an SBI to the database.

```bash
skasip_config_db_add_sbi [--subarray N] [--activate] [--help]
```

#### Generate an SBI JSON configuration

Generate an SBI JSON configuration.

```bash
skasip_config_db_sbi_json
```

#### Update the current state

Updates the current state of SDP or a specified service.

```bash
skasip_config_db_update_state [--service SUBSYSTEM.NAME.VERSION] [--help] new_state
```

#### List workflow definitions

List known workflow definitions.

```bash
skasip_config_db_workflow_definitions
```

## Running tests

Unit tests are run automatically the
[SIP CI/CD service](https://travis-ci.com/SKA-ScienceDataProcessor/integration-prototype).
It is also possible to run them manually with the following commands from the
root SIP:

***Note**: a Redis db container must be started first in order for most of
these tests to pass (See below)*

```bash
virtualenv -p python3 venv
source venv/bin/activate
pip install -r testing_requirements.txt
pip install -r sip/execution_control/configuration_db/requirements.txt
python3 -m pytest --pylint --codestyle --docstyle -s -v \
--pylint-rcfile=.pylintrc --rootdir=. \
sip/execution_control/configuration_db
```

## Starting Configuration Database Redis containers.

To start Docker containers for a Redis Db instance (with a persistent volume)
as well as a [Redis Commander](https://github.com/joeferner/redis-commander)
instance (useful for debugging) issue the following command:

```bash
docker stack deploy -c docker-compose.yml [stack name]
```

Once finished, to clean up.

```bash
docker stack rm [stack name]
```

It is also possible to run redis server natively (without Docker) with:

```bash
redis-server
```



Metadata

Release files for skasip-config-db 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for skasip-config-db 1.3.0
File Size Uploaded Provenance Actions
skasip_config_db-1.3.0.tar.gz 27.4 kB Without provenance Details for skasip_config_db-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for skasip-config-db 1.3.0
File Interpreter ABI Platform Actions
skasip_config_db-1.3.0-py3-none-any.whl Python 3 none any Details for skasip_config_db-1.3.0-py3-none-any.whl

Total release size: 81.3 kB

Release files / skasip_config_db-1.3.0.tar.gz

Download URL skasip_config_db-1.3.0.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fca3c26ab304e2a8de09ac7cb9ac39d1bae7ef8e9e45241235eff8dab9ed975c
BLAKE2b-256 checksum
How to use checksums
532bbf4f4912ab44e036853a8dc16d2f616934a7786b63a39048e7682a153999
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release files / skasip_config_db-1.3.0-py3-none-any.whl

Download URL skasip_config_db-1.3.0-py3-none-any.whl
Size 54.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
890f5c5107f495a3c2bc42c0c7a21573aa0e002d849a006fc21f0676abb78af3
BLAKE2b-256 checksum
How to use checksums
32a33b8a1d4161607d0995295195f2a559226fef1f659e7ca2231626b6eb5aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Security for skasip-config-db 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page