package require programstatusclient ProgramClient name ?option value...? set info [name status]
Provides a REST client for the /Programs domain of the manager REST server. This client allows applications to learn about the status of both containers and programs that are activated/run under the control of the DAQ manager.
Options are used to guide service discovery. The manager advertises a service with its host's NSCLDAQ Port manager. Services are qualified by the username. Therefore, to discover the service port used by the manager, it's necesary to know the service name, the host the manager is running in and the user that started the manager.
The service name defaults to DAQManager and is
stored in clientutils::DAQManager
. Each REST request
does service discovery, connects to the server, makes the request and
disconnects from the server. As such, the service name, the user
and host are dynamic. The host and user are ProgramClient
options that can be provided at construction time and/or set using an
instance's configure
method:
-host
Host in which the server is running.
-user
Username of the account that started the server.
Instances of ProgramClient
have only one method:
status
. This method takes no parameters and
returns a dict. The dict has two keys containers
and programs.
The containers Key. This key contains a list of dicts. Each dict describes a container configured into the server. The container dicts have the following key/value pairs.
Contains the name given to the container.
The container image file. This path is, of course, in the host system.
A list of file system bindings between the host filesystem and
the containerized filesystem. Each binding is a string given
in the form expected by the
singularity command's
--bind
option.
List of hosts in which the container is currently active.
The programs Key. The programs key contains a list of dicts that describe programs configured into the server, and their status. Each dict describes one such program and has the following key/value pairs:
Name of the program.
Path to the program image or script file. If the program is run containerized, this is expressed in the filesystem as seen within the container.
Textual program type. This will be one of Transitory, Persistent or Critical.
Host in which the program will be run.
If not an empty string, the name of the container the program will be run in.
Boolean that, if true, indicates the program is currently active.