ocd.orchestrator – Orchestrate OCD

This module orchestrates OCD.

This are initialised:

  • storage classes
  • state machines
  • the decision maker

Then it starts listening for TSC events and send them to the machines and finally to the decision maker.

class ocd.orchestrator.Orchestrator(event_listener, conf)[source]

Bases: object

This class is the pulsing heart of OCD.

Parameters:
event_listener : tcs_lib.tcs_event.TCSEvent instance

the event_listener.next() listen for events return them one at a time as a two tuple (header, event)

conf : pyhetdex.tools.configuration.ConfigParser

configuration object

_handle_event(self, header, event)[source]

Handle the input event.

Parameters:
header : string

tcs event header

event : dict

tcs event payload

_init_states(self)[source]

Initialize the states and save them into _metrology_state, _run_shot_state, _hetdex_allowed_state and _meta_state.

Returns:
list

topics used by the state

_init_vaults(self)[source]

Initialize the vaults and save them into _metrology_vault and _azimuth_vault.

Returns:
list

topics used by the vaults

_log_event(self, header, event)[source]

If log_events in the [general] section is true, send a DEBUG log message, otherwise do nothing.

Parameters:
header : string

tcs event header

event : dict

tcs event payload

run(self)[source]

Run OCD

update_config(self, conf)[source]

Update the local copy of the configuration file and _do_log_events.

Parameters:
conf : pyhetdex.tools.configuration.ConfigParser

new configuration object

Returns:
string

message to report back