-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support parallel connect #440
Comments
The device connection is now handled by device_instantiation in dodal. This function also provides the option on whether to wait for connection, so it is not needed here too. Additionally it can lead to undefined (currently) behaviour if the device is initially created with fake_with_ophyd_sim = True but then later connected again by blueapi with fake_with_ophyd_sim = False. This also leaves the sim property on BlueskyContext redundant so that is removed too. For full customisation and flexibility of lazy connect we need #440. Fixes #461.
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 |
not sure if we should support the old and new instantiation behaviour or make it behind a flag and go beamline-by-beamline |
@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. |
same |
@callumforrester now that |
In general I am against lazy connection unless it is needed for performance reasons. If a device isn't available, the earlier you know the better! |
ok but we still want the parallel connection, right? |
We do, also |
tracking the location of the desired change # context.py:115
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)) and after device registration step presumably |
DiamondLightSource/dodal#415 (comment) summarizes a discussion on Device connection.
bluesky/ophyd-async#265 will implement the ophyd-async supporting features of idempotent connect.
DiamondLightSource/dodal#483 will implement introspectable device factories.
The strategy we would like for blueapi is:
dodal.beamlines.<bl>
moduledodal.beamlines.beamline_utils.get_device_factories()
to get all the device factories and whether they are lazy or notophyd_async.plan_stubs.ensure_connected(*devices)
on all plan args and default args that are devicesThe text was updated successfully, but these errors were encountered: