Configuration Tool

The rtctkConfigTool is a command line tool used to inspect, retrieve and manipulate configuration data from the Persistent Configuration Repository and the Runtime Configuration Repository.

Metadata Initialisation

To use the Runtime Configuration Repository that is using the OLDB backend, the RTC Toolkit specific metadata instances need to be initialised in the CII configuration service, i.e. the type metadata for RtcInt32, RtcDouble, RtcMatrixDouble etc. This only needs to be done once for a new instance of the OLDB.

The init-metadata sub-command is available in the configuration tool to easily set this metadata up. One can run the command as follows:

$ rtctkConfigTool --rtr cii.oldb:///example/runtime_repo init-metadata

The command is idempotent and can be run multiple times without any change after the first initialisation. However, any RTC Toolkit metadata instance that is changed after this command was applied will be overwritten to their default values by running this command again.

Tool Setup

The rtctkConfigTool itself can be configured to make it more convenient to use. The tool also stores its own configuration information in the Persistent Configuration Repository as datapoints, which can either be backed by the CII central configuration service or local files. All these tool configuration datapoints are optional and can be overridden by command line options. Command line options take precedence over those given in the Persistent Configuration Repository. If a particular configuration value is not provided by any means then rtctkConfigTool simply uses internal default values in that case.

The location of the tool’s configuration can be provided as the command line option --config.

The following configuration datapoints for the tool are available:

/rtctk_config_tool/log_level

The logging level to use for the tool.

This can be overridden by the --log-level command line option.

/rtctk_config_tool/service_discovery_endpoint

Indicates the URI endpoint of the service discovery from which the runtime_repo_endpoint and persistent_repo_endpoint will be loaded.

This can be overridden by the --service-discovery-endpoint | --sde command line option.

/rtctk_config_tool/runtime_repo_endpoint

Explicitly sets the URI endpoint for the Runtime Configuration Repository.

This is an alternative to using /rtctk_config_tool/service_discovery_endpoint to find the endpoint in service discovery.

This can be overridden by the --runtime-repo-endpoint | --rtr command line option.

/rtctk_config_tool/persistent_repo_endpoint

Explicitly sets the URI endpoint for the Persistent Configuration Repository.

This is an alternative to using /rtctk_config_tool/service_discovery_endpoint to find the endpoint in service discovery.

This can be overridden by the --persistent-repo-endpoint | --psr command line option.

Operations

The rtctkConfigTool supports sub-commands on the command line that allows the following kinds of operations on a repository:

  • get

  • set

  • delete

  • list

  • read

  • write

  • populate

In all cases, a detailed listing of available command line arguments and options can be seen with the --help option.

Example

$ rtctkConfigTool --help

For options available for a specific sub-command, e.g. get, one would use the following:

$ rtctkConfigTool get --help

In most of the examples shown in the sub-sections below, it is assumed that the rtctkConfigTool is already configured to find the repositories as indicated in the Tool Setup section. If this is not the case, then one can simply explicitly add the extra options to indicate the repository locations, e.g. --rtr <uri>, to the examples shown in the sub-sections.

Example

$ rtctkConfigTool --rtr cii.oldb:///example/runtime_repo get runtime /data/my_data_point

Get

Get is used to retrieve the contents of a single datapoint. You have to specify the repository and the path to the datapoint you want to get.

Example

$ rtctkConfigTool get runtime /data/my_data_point

Get datapoint type

To get the type of a datapoint use the --type option.

Example

$ rtctkConfigTool get runtime /my_data_point --type

Get datapoint size

To get the size of a datapoint use the --type option. This will return the size in bytes for scalars, and the total number of elements for vectors and matrices.

Example

$ rtctkConfigTool get runtime /my_data_point --size

Set

Set is used to change or create a datapoint. If the datapoint does not exist it will be created with the type given by --type. Otherwise the type of the existing datapoint has to match what is given by --type. If the type is not given, it is inferred from the exiting datapoint or from parsing the value on the command line. For numeric values, 64-bit integer and floating-point types are used if the type must be implicitly inferred.

The value argument should use Python syntax for literals. Examples of this syntax are indicated below.

Example

Set a boolean:

$ rtctkConfigTool set runtime /data/my_data_point True
$ rtctkConfigTool set runtime /data/my_data_point False

Set an integer (the first two examples are equivalent):

$ rtctkConfigTool set runtime /data/my_data_point 42
$ rtctkConfigTool set runtime /data/my_data_point --type RtcInt64 42

$ rtctkConfigTool set persistent /data/my_data_point --type RtcInt32 -42

Set a floating-point number (the first two examples are equivalent):

$ rtctkConfigTool set runtime /data/my_data_point 1.23
$ rtctkConfigTool set runtime /data/my_data_point --type RtcDouble 1.23

$ rtctkConfigTool set persistent /data/my_data_point --type RtcFloat -1.23

Set a string (the two examples are equivalent):

$ rtctkConfigTool set runtime /data/my_data_point --type RtcString abc
$ rtctkConfigTool set runtime /data/my_data_point "'abc'"

Set a binary blob (the two examples are equivalent):

$ rtctkConfigTool set runtime /data/my_data_point --type RtcBinary a2bc
$ rtctkConfigTool set runtime /data/my_data_point "b'a\x32bc'"

Set a vector:

$ rtctkConfigTool set runtime /data/my_data_point --type RtcVectorBool "[True, False]"
$ rtctkConfigTool set runtime /data/my_data_point --type RtcVectorInt32 "[1, 2]"
$ rtctkConfigTool set runtime /data/my_data_point --type RtcVectorDouble "[3.5, 7.25]"
$ rtctkConfigTool set runtime /data/my_data_point --type RtcVectorString "['abc', 'xyz']"
$ rtctkConfigTool set runtime /data/empty_data_point --type RtcVectorInt64 "[]"

Set a matrix:

$ rtctkConfigTool set runtime /data/my_data_point \
                  --type RtcMatrixBool "[[True, False], [True, False]]"
$ rtctkConfigTool set runtime /data/my_data_point \
                  --type RtcMatrixInt32 "[[1, -2], [3, -4]]"
$ rtctkConfigTool set runtime /data/my_data_point \
                  --type RtcMatrixDouble "[[1.2, 2.3], [3.4, 4.5]]"
$ rtctkConfigTool set runtime /data/my_data_point \
                  --type RtcMatrixString "[['a', 'b'], ['c', 'd']]"
$ rtctkConfigTool set runtime /data/empty_data_point --type RtcMatrixInt64 "[[]]"

Delete

Delete removes a datapoint.

Example

$ rtctkConfigTool delete runtime /data/my_data_point

List

Shows the sub-paths and datapoints within a given path.

Example

$ rtctkConfigTool list runtime /data/
Data Points:
RtcInt32: /data/my_data_point

Sub Paths:

Read

Read can be used to write the contents of a datapoint to a FITS file.

Example

$ rtctkConfigTool read runtime /my_data_point data_dump.fits

Write

Write can be used to write the contents of a FITS file into a datapoint.

Example

$ rtctkConfigTool write runtime /my_data_point my_new_data_point_data.fits

Populate

Populates the Runtime Configuration Repository with the deployment information stored in the Persistent Configuration Repository. The logic to populate the repository is the same as is used during the initialisation stage of the RTC Supervisor. This provides a mechanism to manually trigger the population logic rather than performing it automatically by RTC Supervisor. See also Configuration Layout for a detailed description of the configuration layout for Deployment Sets.

Example

Populating cii.oldb:///example/runtime_repo from file:/example/persistent_repo.

$ rtctkConfigTool --psr file:/example/persistent_repo \
                  --rtr cii.oldb:///example/runtime_repo populate

Interactive Shell

For more advanced interactive usage it is possible to enter a Python shell and interact with the repository via Python commands.

Example

$ rtctkConfigTool shell

Within the shell one has access to the repository through the repository variable. By default the repository variable is setup to use the Runtime Configuration Repository. To select the Persistent Configuration Repository instead, use the --repo option.

Example

$ rtctkConfigTool shell --repo persistent

Limitations

  • The current release only has the command line interface implemented. The GUI is still missing.

  • Only the cii.config://local/ and file URI schemes are supported for the Persistent Configuration Repository.