The EnvironmentMonitor Class¶
The EnvironmentMonitor class provides the interface between the Mayall MED system and the ICS/DOS operations database.
Version History:
-
class
EnvironmentMonitor.EnvironmentMonitor.
EnvironmentMonitor
(device_mode=False, noSVE=None, **extra_args)¶ The EnvironmentMonitor class provides the interface between the Mayall MED system and the ICS/DOS operations database. It operates in device mode on desi-14 as a system service. It is controlled with the emctl (start/stop/restart/status) script emlogs (-f) shows the log messages
Shared Variables: The EnvironmentMonitor class publishes the following shared variables
- ENVIRONMENTMONITOR_INFOE - old style summary (obsolete)
- ENVIRONMENTMONITOR_TELESCOPE - Mayall TCS status and telemetry
- ENVIRONMENTMONITOR_DOME - Mayall Dome environmental data
- ENVIRONMENTMONITOR_WEATHER - Mayall weather station
- ENVIRONMENTMONITOR_UPS - Mayal UPS system status and telemetry
- ENVIRONMENTMONITOR_COMPUTER - Mayal Computer Room telemetry
Defaults:
‘redis_host’: ‘desi-14.kpno.noao.edu’,‘redis_port’: 6379,‘controller_type’ : ‘SIMULATOR’,‘poll_delay’ : 5.0,‘auto_start’ : True-
init
()¶ Initialize the EnvironmentMonitor application. Sets up variables, discovery and connects to the MED redis database as well as the ICS operations database. The MED redis DB is polled periodically
Parameters: None – Keyword Arguments: None – Raises: RunTimeError (if configure fails in device mode) Returns: SUCCESS (str)
-
configure
(*args, **kwargs)¶ Restore the system to its base state. Application status is set to READY at the end of this routine.
Parameters: None – Keyword Arguments: None – Raises: RuntimeError
– Problems connecting to the redis databaseReturns: SUCCESS (str)
-
get
(what)¶ Retrieve runtime information about the EnvironmentMonitor application. The allowed values include: status, poll_delay, polling, infoe, ups, computer, telescope, dome, tower, any parameter in self.config
Parameters: what (str) – variable name or attribute to return Raises: RuntimeError
– Invalid argument, unexpected resultsReturns: The value of the requested variable or attribute
-
set
(**options)¶ Set variables and attributes at runtime. Allowed options (keys) include: redis_port, redis_host, poll_delay
Parameters: options (dict) – key/value pairs for variables/attributes to set. Raises: RuntimeError
– Invalid parametersReturns: SUCCESS (str)
-
stop
()¶ Stop polling for environmental data
Parameters: None – Raises: RuntimeError
– if EnvironmentMonitor application is in the wrong stateReturns: SUCCESS (str)
-
start
()¶ Start (or restart) polling for environmental data
Parameters: None – Raises: RuntimeError
– EnvironmentMonitor application is in the wrong stateReturns: SUCCESS (str)
-
main
()¶ main is the run-loop for DOS applications. Monitors the shutdown flag and runs the polling loop for the MED redis database. When main exits, the EnvironmentMonitor application exits. No parameters, no return, no exceptions
-
about_to_connect_to_instance
(*args, **kwargs)¶ Instance management helper function Internal use only unless overloaded
-
did_connect_to_instance
(*args, **kwargs)¶ Instance management helper function Internal use only unless overloaded
-
about_to_disconnect_from_instance
(*args, **kwargs)¶ Instance management helper function Internal use only unless overloaded
-
did_disconnect_from_instance
(*args, **kwargs)¶ Instance management helper function Internal use only unless overloaded