Skip to main content

SIP Execution Control Configuration Database library.

Project description

SIP Configuration Service

Introduction

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

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, 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:

pip install -U skasip-config-db

Usage

Example usage:

import config_db

sdp_state = config_db.SDPState()
print(sdp_state.current_state)

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

sbi_config = config_db.generate_sbi_config(register_workflows=True)
sbi = config_db.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.

skasip_config_db_register_workflows [workflow path]

Add an SBI to the database

Adds an SBI to the database.

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

Generate an SBI JSON configuration

Generate an SBI JSON configuration.

skasip_config_db_sbi_json

Update the current state

Updates the current state of SDP or a specified service.

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

List workflow definitions

List known workflow definitions.

skasip_config_db_workflow_definitions

Running tests

Unit tests are run automatically the SIP CI/CD service. 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)

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 instance (useful for debugging) issue the following command:

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

Once finished, to clean up.

docker stack rm [stack name]

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

redis-server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skasip_config_db-1.0.21.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

skasip_config_db-1.0.21-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

Details for the file skasip_config_db-1.0.21.tar.gz.

File metadata

  • Download URL: skasip_config_db-1.0.21.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for skasip_config_db-1.0.21.tar.gz
Algorithm Hash digest
SHA256 3f02bfe290e2f417bb084b2d6981dca0fdee89c5759d3eff0725303d7db9b9af
MD5 2eee418c6b8a4e459ae224d08195b220
BLAKE2b-256 f098b13443c74dd0f85e001ed170e53596242d0b96ec47ffc3bd4fd16aab1c16

See more details on using hashes here.

File details

Details for the file skasip_config_db-1.0.21-py3-none-any.whl.

File metadata

  • Download URL: skasip_config_db-1.0.21-py3-none-any.whl
  • Upload date:
  • Size: 64.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for skasip_config_db-1.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 d47725f01313bf6e4c546b445761a2d96eff79d366905a0f1e1cf07c783c1833
MD5 1a122fd9afbfa6bc48dc4054ba646c90
BLAKE2b-256 3bd158e7a406d7a36010af9653d370a4a5ec2e1a38848585dce46f1ebf13c89c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page