Skip to content

Commit

Permalink
respond to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Oct 15, 2024
1 parent 7553a97 commit c28c7c4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/dodal/beamlines/i22.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from dodal.utils import get_beamline_name

BL = get_beamline_name("i22")
CONTROLLED_COLLETION = True
set_log_beamline(BL)
set_utils_beamline(BL)

Expand Down
7 changes: 0 additions & 7 deletions src/dodal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ophyd_async.core import NotConnected

from dodal.beamlines import all_beamline_names, module_name_for_beamline
from dodal.common.beamlines.controller_utils import make_all_controlled_devices
from dodal.utils import make_all_devices

from . import __version__
Expand Down Expand Up @@ -59,12 +58,6 @@ def connect(beamline: str, all: bool, sim_backend: bool) -> None:
include_skipped=all,
fake_with_ophyd_sim=sim_backend,
)
if beamline == "i22":
device_factory_devices, device_factory_exceptions = make_all_controlled_devices(
full_module_path
)
devices = {**devices, **device_factory_devices}
exceptions = {**exceptions, **device_factory_exceptions}
sim_statement = " (sim mode)" if sim_backend else ""

print(f"{len(devices)} devices connected{sim_statement}:")
Expand Down
3 changes: 3 additions & 0 deletions src/dodal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import dodal.log
from dodal.aliases import AnyDevice, AnyDeviceFactory, V1DeviceFactory, V2DeviceFactory
from dodal.common.beamlines.controller_utils import make_all_controlled_devices
from dodal.common.beamlines.device_factory import DeviceInitializationController

#: Protocols defining interface to hardware
Expand Down Expand Up @@ -110,6 +111,8 @@ def make_all_devices(
"""
if isinstance(module, str) or module is None:
module = import_module(module or __name__)
if module.CONTROLLED_COLLECTION:
return make_all_controlled_devices(module, include_skipped, **kwargs)
factories = collect_factories(module, include_skipped)
devices: tuple[dict[str, AnyDevice], dict[str, Exception]] = invoke_factories(
factories, **kwargs
Expand Down
13 changes: 13 additions & 0 deletions tests/beamlines/unit_tests/test_i22.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,18 @@ def test_device_creation(RE, module_and_devices_for_beamline_device_factory):
"synchrotron",
"vfm",
"hfm",
# "saxs",
# "waxs",
# "i0", # todo it is missing the driver for now
# "it", # todo it is missing the driver for now
# "dcm",
# "undulator",
# "fswitch",
# "panda1",
# "panda2",
# "panda3",
# "panda4",
# "oav",
# "linkam",
]
assert all(key in devices for key in expected_keys)

0 comments on commit c28c7c4

Please sign in to comment.