Skip to content

orchestrator

borealis.orchestrator

Orchestrator()

Session orchestrator, keeps track of components and manages communication between them.

Source code in borealis/orchestrator.py
14
15
16
17
def __init__(self):
    self.sensors = []
    self.controllers = []
    self.data_managers = []

add_controller_component(component)

Adds a component to the mediator.

Source code in borealis/orchestrator.py
24
25
26
27
28
29
30
def add_controller_component(self, component):
    """Adds a component to the mediator."""
    LOGGER.debug('Adding controller component %s', component)

    self._ensure_unique_alias(component)
    self._validate_device_info(component)
    self.controllers.append(component)

add_data_component(component)

Adds a component to the mediator.

Source code in borealis/orchestrator.py
19
20
21
22
def add_data_component(self, component):
    """Adds a component to the mediator."""
    LOGGER.debug('Adding data manager %s', component)
    self.data_managers.append(component)

add_sensor_component(component)

Adds a component to the mediator.

Source code in borealis/orchestrator.py
32
33
34
35
36
37
38
def add_sensor_component(self, component):
    """Adds a component to the mediator."""
    LOGGER.debug('Adding sensor component %s', component)

    self._ensure_unique_alias(component)
    self._validate_device_info(component)
    self.sensors.append(component)

notify(sender, message, **kwargs)

Notifies all components with the message.

Source code in borealis/orchestrator.py
66
67
68
69
70
71
72
73
74
75
76
def notify(self, sender, message, **kwargs):
    """Notifies all components with the message."""
    match message:
        case 'Scan':
            try:
                scan_points = kwargs['scan_points']
                acq_times = kwargs['acq_times']
            except KeyError:
                raise AttributeError(f'No scan point or acquisition times is specified')

            self.scan(sender, scan_points, acq_times)