Tango control subpackage (ska_tangoctl.tango_control)
Read and display Tango stuff.
- class ska_tangoctl.tango_control.TangoControl(logger: Logger, cfg_data: Any, ns_name: str | None = None)[source]
Connect to Tango environment and retrieve information.
- __init__(logger: Logger, cfg_data: Any, ns_name: str | None = None)[source]
Get the show on the road.
- Parameters:
logger – logging handle
cfg_data – configuration in JSON format
ns_name – K8S namespace
- __weakref__
list of weak references to the object (if defined)
- check_tango(tango_host: str, quiet_mode: bool, tango_port: int = 10000) int [source]
Check Tango host address.
- Parameters:
tango_host – fully qualified domain name
quiet_mode – flag to suppress extra output
tango_port – port number
- Returns:
error condition
- get_tango_classes(fmt: str, evrythng: bool, quiet_mode: bool, tgo_name: str | None, reverse: bool) dict [source]
Read tango classes.
- Parameters:
fmt – output format
evrythng – get commands and attributes regadrless of state
quiet_mode – flag for displaying progress bars
tgo_name – device name
reverse – sort in reverse order
- Returns:
dictionary with devices
- list_classes(fmt: str, evrythng: bool, quiet_mode: bool, reverse: bool, tgo_name: str | None) int [source]
Get device classes.
- Parameters:
fmt – output format
evrythng – get commands and attributes regadrless of state
quiet_mode – flag for displaying progress bars
reverse – sort in reverse order
tgo_name – device name
- Returns:
error condition
- list_devices(file_name: str | None, fmt: str, evrythng: bool, uniq_cls: bool, quiet_mode: bool, reverse: bool, tgo_name: str | None) int [source]
List Tango devices.
- Parameters:
file_name – output file name
fmt – output format
evrythng – get commands and attributes regadrless of state
uniq_cls – only show one device per class
quiet_mode – flag for displaying progress bars
reverse – sort in reverse order
tgo_name – device name
- Returns:
error condition
- read_input_file(input_file: str | None, tgo_name: str | None, dry_run: bool) None [source]
Read instructions from JSON file.
- Parameters:
input_file – input file name
tgo_name – device name
dry_run – flag for dry run
- read_input_files(json_dir: str, quiet_mode: bool = True) int [source]
Read info from JSON script files.
- Parameters:
json_dir – directory with script files
quiet_mode – turn off progress bar
- Returns:
error condition
- run_info(uniq_cls: bool, file_name: str | None, fmt: str, evrythng: bool, quiet_mode: bool, reverse: bool, disp_action: int, tgo_name: str | None, tgo_attrib: str | None, tgo_cmd: str | None, tgo_prop: str | None, tango_port: int) int [source]
Read information on Tango devices.
- Parameters:
uniq_cls – only read one device per class
file_name – output file name
fmt – output format
evrythng – get commands and attributes regadrless of state
quiet_mode – flag for displaying progress bars
reverse – sort in reverse order
disp_action – flag for output format
tgo_name – device name
tgo_attrib – attribute name
tgo_cmd – filter command name
tgo_prop – filter property name
tango_port – device port
- Returns:
error condition
- set_value(tgo_name: str, quiet_mode: bool, reverse: bool, tgo_attrib: str, tgo_value: str) int [source]
Set value for a Tango device.
- Parameters:
tgo_name – device name
quiet_mode – flag for displaying progress bar
reverse – sort in reverse order
tgo_attrib – attribute name
tgo_value – attribute value
- Returns:
error condition
- class ska_tangoctl.tango_control.TangoJsonReader(logger: Logger, quiet_mode: bool, kube_namespace: str | None, devsdict: dict, file_name: str | None = None)[source]
Read JSON and print as markdown or text.
- __init__(logger: Logger, quiet_mode: bool, kube_namespace: str | None, devsdict: dict, file_name: str | None = None)[source]
Rock and roll.
- Parameters:
logger – logging handle
quiet_mode – flag for displaying progress bar
kube_namespace – Kubernetes namespace
devsdict – dictionary with device data
file_name – output file name
- __weakref__
list of weak references to the object (if defined)
- print_html_all(html_body: bool) None [source]
Print the whole thing.
- Parameters:
html_body – print HTML header and footer
- class ska_tangoctl.tango_control.TangoScript(logger: Logger, input_file: int | str | bytes | PathLike[str] | PathLike[bytes], device_name: str | None, dry_run: bool)[source]
The classy Tango.
- __init__(logger: Logger, input_file: int | str | bytes | PathLike[str] | PathLike[bytes], device_name: str | None, dry_run: bool)[source]
Read actions from file.
- Raises:
Exception – error condition
- Parameters:
logger – logging handle
input_file – input file
device_name – device name
dry_run – flag for dry run
- __weakref__
list of weak references to the object (if defined)
- class ska_tangoctl.tango_control.TangoctlDevice(logger: Logger, quiet_mode: bool, reverse: bool, device: str, list_items: dict, tgo_attrib: str | None, tgo_cmd: str | None, tgo_prop: str | None)[source]
Compile a dictionary for a Tango device.
- __init__(logger: Logger, quiet_mode: bool, reverse: bool, device: str, list_items: dict, tgo_attrib: str | None, tgo_cmd: str | None, tgo_prop: str | None)[source]
Iniltialise the thing.
- Parameters:
logger – logging handle
quiet_mode – flag for displaying progress bars
reverse – sort in reverse order
device – device name
list_items – attributes, commands or properties in list output
tgo_attrib – attribute filter
tgo_cmd – command filter
tgo_prop – property filter
- check_for_attribute(tgo_attrib: str | None) list [source]
Filter by attribute name.
- Parameters:
tgo_attrib – attribute name
- Returns:
list of device names matched
- check_for_command(tgo_cmd: str | None) list [source]
Filter by command name.
- Parameters:
tgo_cmd – command name
- Returns:
list of device names matched
- check_for_property(tgo_prop: str | None) list [source]
Filter by command name.
- Parameters:
tgo_prop – property name
- Returns:
list of device names matched
- make_json(delimiter: str = ',') dict [source]
Convert internal values to JSON.
- Parameters:
delimiter – field are seperated by this
- Returns:
dictionary
- print_html_all(html_body: bool) None [source]
Print full HTML report.
- Parameters:
html_body – Flag to print HTML header and footer
- print_html_quick(html_body: bool) None [source]
Print shortened HTML report.
- Parameters:
html_body – Flag to print HTML header and footer
- print_list_attribute(lwid: int) None [source]
Print list of devices with attribute.
- Parameters:
lwid – line width
- print_list_command(lwid: int) None [source]
Print list of devices with command.
- Parameters:
lwid – line width
- print_list_property(lwid: int) None [source]
Print list of devices with property.
- Parameters:
lwid – line width
- class ska_tangoctl.tango_control.TangoctlDeviceBasic(logger: Logger, device: str, reverse: bool, list_items: dict = {}, timeout_millis: float = 500)[source]
Compile a basic dictionary for a Tango device.
- __init__(logger: Logger, device: str, reverse: bool, list_items: dict = {}, timeout_millis: float = 500)[source]
Iniltialise the thing.
- Parameters:
logger – logging handle
device – device name
reverse – sort in reverse order
list_items – dictionary with values to process
timeout_millis – timeout in milliseconds
- Raises:
Exception – error condition
- __weakref__
list of weak references to the object (if defined)
- class ska_tangoctl.tango_control.TangoctlDeviceConfig(logger: Logger, quiet_mode: bool, reverse: bool, device: str)[source]
Read all the configuration on offer.
- class ska_tangoctl.tango_control.TangoctlDevices(logger: Logger, uniq_cls: bool, quiet_mode: bool, reverse: bool, evrythng: bool, cfg_data: dict, tgo_name: str | None, tgo_attrib: str | None, tgo_cmd: str | None, tgo_prop: str | None, output_file: str | None, fmt: str = 'json', nodb: bool = False)[source]
Compile a dictionary of available Tango devices.
- __init__(logger: Logger, uniq_cls: bool, quiet_mode: bool, reverse: bool, evrythng: bool, cfg_data: dict, tgo_name: str | None, tgo_attrib: str | None, tgo_cmd: str | None, tgo_prop: str | None, output_file: str | None, fmt: str = 'json', nodb: bool = False)[source]
Get a dict of devices.
- Parameters:
logger – logging handle
uniq_cls – only read one device per class
cfg_data – configuration data in JSON format
quiet_mode – flag for displaying progress bars
reverse – sort in reverse order
evrythng – get commands and attributes regadrless of state
tgo_name – filter device name
tgo_attrib – filter attribute name
tgo_cmd – filter command name
tgo_prop – filter property name
output_file – output file name
fmt – output format
nodb – flag to run without database
- Raises:
Exception – when database connect fails
- print_html(disp_action: int) None [source]
Print in HTML format.
- Parameters:
disp_action – display control flag
- print_json(disp_action: int) None [source]
Print in JSON format.
- Parameters:
disp_action – display control flag
- print_markdown(disp_action: int) None [source]
Print in JSON format.
- Parameters:
disp_action – display control flag
- print_txt(disp_action: int, heading: str | None = None) None [source]
Print in text format.
- Parameters:
disp_action – display control flag
heading – to be printed on the top
- print_txt_list(heading: str | None = None) None [source]
Print list of devices.
- Parameters:
heading – print at the top
- class ska_tangoctl.tango_control.TangoctlDevicesBasic(logger: Logger, uniq_cls: bool, quiet_mode: bool, reverse: bool, evrythng: bool, cfg_data: Any, tgo_name: str | None, fmt: str, ns_name: str | None = None)[source]
Compile a dictionary of available Tango devices.
- __init__(logger: Logger, uniq_cls: bool, quiet_mode: bool, reverse: bool, evrythng: bool, cfg_data: Any, tgo_name: str | None, fmt: str, ns_name: str | None = None)[source]
Read list of Tango devices.
- Parameters:
logger – logging handle
uniq_cls – only read one device per class
quiet_mode – flag for displaying progress bar
reverse – sort in reverse order
evrythng – read and display the whole thing
cfg_data – configuration data
fmt – output format
tgo_name – device name
ns_name – K8S namespace
- Raises:
Exception – database connect failed
- __weakref__
list of weak references to the object (if defined)
- get_classes(reverse: bool) OrderedDict[Any, Any] [source]
Get list of classes.
- Parameters:
reverse – sort in reverse order
- Returns:
dictionary of classes
- print_html(disp_action: int) None [source]
Print in HTML format.
- Parameters:
disp_action – display control flag
- print_json(disp_action: int) None [source]
Print in JSON format.
- Parameters:
disp_action – not used
- print_txt_heading(eol: str = '\n') int [source]
Print heading for list of devices.
- Parameters:
eol – printed at the end
- Returns:
width of characters printed
- print_txt_list(heading: str | None = None) None [source]
Print list of devices.
- Parameters:
heading – print at the top
- class ska_tangoctl.tango_control.TestTangoDevice(logger: Logger, device_name: str)[source]
Test a Tango device.
- __init__(logger: Logger, device_name: str)[source]
Get going.
- Parameters:
logger – logging handle
device_name – Tango device name
- __weakref__
list of weak references to the object (if defined)
- get_simulation_mode() int | None [source]
Read attribute for simulation mode.
- Returns:
attribute value
- run_test(dry_run: bool, dev_admin: int | None, dev_off: bool, dev_on: bool, dev_sim: int | None, dev_standby: bool, dev_status: bool, show_command: bool, show_attrib: bool, tgo_attrib: str | None, tgo_name: str | None, tango_port: int) int [source]
Run tests on Tango devices.
- Parameters:
dry_run – only show what will be done
dev_admin – check admin mode
dev_off – turn device on
dev_on – turn device off
dev_sim – simulation flag
dev_standby – place device in standby
dev_status – set device status
show_command – test device commands
show_attrib – test device attributes
tgo_attrib – name of attribute
tgo_name – device name
tango_port – device port
- Returns:
error condition
- set_admin_mode(admin_mode: int) int [source]
Change admin mode.
- Parameters:
admin_mode – new value
- Returns:
error condition
- set_simulation_mode(dev_sim: int | None) int | None [source]
Set attribute for simulation mode.
- Parameters:
dev_sim – attribute value
- Returns:
error condition
- show_device_attributes(show: bool = False) None [source]
Display number and names of attributes.
- Parameters:
show – flag to print names
- show_device_commands(show: bool = False) None [source]
Display number and names of commands.
- Parameters:
show – flag to print names
- test_admin_mode(dev_admin: int) int [source]
Test admin mode.
- Parameters:
dev_admin – new value
- Returns:
error condition
- test_all(show_attrib: bool) int [source]
Test everything that device can do.
- Parameters:
show_attrib – flag for attributes display.
- Returns:
error condition
- test_off(dev_sim: int | None) int [source]
Test that device can be turned off.
- Parameters:
dev_sim – flag for hardware simulation.
- Returns:
error condition
- test_on(dev_sim: int | None) int [source]
Test that device can be turned on.
- Parameters:
dev_sim – flag for hardware simulation.
- Returns:
error condition
- test_simulation_mode(dev_sim: int | None) int [source]
Test that device hardware simulation can be set.
- Parameters:
dev_sim – flag for hardware simulation.
- Returns:
error condition