DiamondLightSource / blueapi

Apache License 2.0
3 stars 5 forks source link

Support parallel and lazy connect #440

Open coretl opened 4 months ago

coretl commented 4 months ago

https://github.com/DiamondLightSource/dodal/issues/415#issuecomment-2079651830 summarizes a discussion on Device connection. https://github.com/bluesky/ophyd-async/issues/265 will implement the ophyd-async supporting features of idempotent connect. https://github.com/DiamondLightSource/dodal/issues/483 will implement introspectable device factories.

The strategy we would like for blueapi is:

stan-dot commented 3 weeks ago

    def with_dodal_module(self, module: ModuleType, **kwargs) -> None:
        devices, exceptions = make_all_devices(module, **kwargs)

        for device in devices.values():
            self.device(device)

        # If exceptions have occurred, we log them but we do not make blueapi
        # fall over
        if len(exceptions) > 0:
            LOGGER.warning(
                f"{len(exceptions)} exceptions occurred while instantiating devices"
            )
            LOGGER.exception(NotConnected(exceptions))

change the call to make_all_devices inside context.py

stan-dot commented 3 weeks ago

not sure if we should support the old and new instantiation behaviour or make it behind a flag and go beamline-by-beamline

callumforrester commented 2 weeks ago

@stan-dot I would favour supporting both, deprecating one and making issues to migrate as-and-when. Migrating beamline-by-beamline is still ideal but not mandated.

stan-dot commented 2 weeks ago

same