Skip to content
Snippets Groups Projects
Commit a3f998b6 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-470: Updated calls to boot using new command and attribute names

parent b8a7b4b2
No related branches found
No related tags found
1 merge request!176L2SS-470: Fix boot
%% Cell type:markdown id:e051e48d tags: %% Cell type:markdown id:e051e48d tags:
# Welcome to your LOFAR2.0 station! # Welcome to your LOFAR2.0 station!
The following interfaces are available to you, on the same host as this notebook, but on different ports: The following interfaces are available to you, on the same host as this notebook, but on different ports:
|Interface |Subsystem |Port|Credentials | |Interface |Subsystem |Port|Credentials |
|----------|----------|----|--------------| |----------|----------|----|--------------|
|Scripting |Jupyter |8888| | |Scripting |Jupyter |8888| |
|Monitoring|Grafana |3000|admin/admin | |Monitoring|Grafana |3000|admin/admin |
|Logs |Kibana |5601| | |Logs |Kibana |5601| |
|ReST |tango-rest|8080|tango-cs/tango| |ReST |tango-rest|8080|tango-cs/tango|
Below are codes to manage the station at high level. For more detailed status information, look in Grafana. Below are codes to manage the station at high level. For more detailed status information, look in Grafana.
%% Cell type:markdown id:32ae8bcf tags: %% Cell type:markdown id:32ae8bcf tags:
## (Re)boot station ## (Re)boot station
The code below is used to: The code below is used to:
* Reboot all station software * Reboot all station software
* Reset the hardware configuration * Reset the hardware configuration
%% Cell type:code id:38037a71 tags: %% Cell type:code id:38037a71 tags:
``` python ``` python
# Restart boot device itself # Restart boot device itself
boot.off() boot.off()
assert boot.state() == DevState.OFF, boot.state() assert boot.state() == DevState.OFF, boot.state()
boot.initialise() boot.initialise()
assert boot.state() == DevState.STANDBY, boot.state() assert boot.state() == DevState.STANDBY, boot.state()
boot.on() boot.on()
assert boot.state() == DevState.ON, boot.state() assert boot.state() == DevState.ON, boot.state()
``` ```
%% Cell type:code id:21aba361 tags: %% Cell type:code id:21aba361 tags:
``` python ``` python
# Request to reinitialise the station. # Request to reinitialise the station.
# #
# WARNING: This will reset settings across the station! # WARNING: This will reset settings across the station!
boot.initialise_station() boot.boot()
assert boot.state() != DevState.FAULT assert boot.state() != DevState.FAULT
``` ```
%% Cell type:code id:c00b465a tags: %% Cell type:code id:c00b465a tags:
``` python ``` python
import time import time
while boot.initialising_station_R: while boot.booting_R:
print(f"Still initialising station. {boot.initialisation_progress_R}% complete. State: {boot.initialisation_status_R}") print(f"Still initialising station. {boot.progress_R}% complete. State: {boot.status_R}")
time.sleep(1) time.sleep(1)
if boot.initialisation_progress_R == 100: if boot.progress_R == 100:
print("Done initialising station.") print("Done initialising station.")
else: else:
print(f"Failed to initialise station: {boot.initialisation_status_R}") print(f"Failed to initialise station: {boot.status_R}")
print(f"Initialised devices: {boot.initialised_devices_R}")
print(f"Uninitialised devices: {boot.uninitialised_devices_R}")
``` ```
%% Cell type:markdown id:b444b751 tags: %% Cell type:markdown id:b444b751 tags:
## Inspect Docker status ## Inspect Docker status
Docker containers that are not running will not provide any functionality, and are ignored when the station is rebooted. Docker containers that are not running will not provide any functionality, and are ignored when the station is rebooted.
%% Cell type:code id:8b09f9da tags: %% Cell type:code id:8b09f9da tags:
``` python ``` python
container_status = {attr_name: getattr(docker, attr_name) container_status = {attr_name: getattr(docker, attr_name)
for attr_name in docker.get_attribute_list() for attr_name in docker.get_attribute_list()
if attr_name.endswith("_R") if attr_name.endswith("_R")
and attr_name != 'version_R'} and attr_name != 'version_R'}
not_running_containers = [container for container, running in container_status.items() if running is False] not_running_containers = [container for container, running in container_status.items() if running is False]
if not not_running_containers: if not not_running_containers:
print("All docker containers are running") print("All docker containers are running")
else: else:
print(f"Docker containers that are NOT running: {not_running_containers}") print(f"Docker containers that are NOT running: {not_running_containers}")
``` ```
%% Cell type:markdown id:55f3981d tags: %% Cell type:markdown id:55f3981d tags:
## Inspect Device status ## Inspect Device status
Check whether all software devices are indeed up and running. Check whether all software devices are indeed up and running.
%% Cell type:code id:637e6e22 tags: %% Cell type:code id:637e6e22 tags:
``` python ``` python
for d in devices: for d in devices:
try: try:
print(f"Device {d.dev_name()} is in state {d.state()}") print(f"Device {d.dev_name()} is in state {d.state()}")
except ConnectionFailed as e: except ConnectionFailed as e:
print(f"Device {d.dev_name()} is in state DOWN: {e.args[0].desc}") print(f"Device {d.dev_name()} is in state DOWN: {e.args[0].desc}")
``` ```
%% Cell type:code id:23008885 tags: %% Cell type:code id:23008885 tags:
``` python ``` python
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment