Skip to content

orchestrator

borealis.orchestrator

Orchestrator()

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

Source code in borealis/orchestrator.py
12
13
14
15
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
17
18
19
20
21
22
23
24
25
def add_controller_component(self, component):
    """Adds a component to the mediator."""
    LOGGER.debug('Adding controller component %s', component)
    try:
        assert hasattr(component, 'get_device_info')
    except AssertionError:
        LOGGER.error('Component %s is missing a get_device_info method', component)
        raise AttributeError(f'Component {component} has no get_device_info method')
    self.controllers.append(component)

add_data_component(component)

Adds a component to the mediator.

Source code in borealis/orchestrator.py
37
38
39
40
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
27
28
29
30
31
32
33
34
35
def add_sensor_component(self, component):
    """Adds a component to the mediator."""
    LOGGER.debug('Adding sensor component %s', component)
    try:
        assert hasattr(component, 'get_device_info')
    except AssertionError:
        LOGGER.error('Component %s is missing a get_device_info method', component)
        raise AttributeError(f'Component {component} has no get_device_info method')
    self.sensors.append(component)

notify(sender, message, **kwargs)

Notifies all components with the message.

Source code in borealis/orchestrator.py
48
49
50
51
52
53
54
55
56
57
58
def notify(self, sender, message, **kwargs):
    """Notifies all components with the message."""
    match message:
        case 'Scan':
            try:
                scan_points = kwargs['scan_points']
                acq_time = kwargs['acq_time']
            except KeyError:
                raise AttributeError(f'No scan point or acquisition time is specified')

            self.scan(sender, scan_points, acq_time)