From ae4e7d8c6be88a5f001d12f55f560c665aa40f93 Mon Sep 17 00:00:00 2001 From: Dominic Oram Date: Mon, 3 Mar 2025 18:21:34 +0000 Subject: [PATCH 1/3] Revert "Roll back bluesky version (#882)" This reverts commit 1cefe7033ca8e61e0235e58835229ac695015073. --- pyproject.toml | 5 +++-- src/mx_bluesky/beamlines/i04/thawing_plan.py | 22 ++++++++----------- .../extruder/i24ssx_Extruder_Collect_py3v2.py | 2 +- .../fixed_target/i24ssx_Chip_Manager_py3v1.py | 10 ++++----- .../serial/fixed_target/i24ssx_moveonclick.py | 2 +- .../serial/setup_beamline/setup_beamline.py | 2 +- .../serial/setup_beamline/setup_detector.py | 2 +- .../setup_beamline/setup_zebra_plans.py | 4 ++-- src/mx_bluesky/common/plans/do_fgs.py | 6 ++--- .../hyperion/device_setup_plans/setup_oav.py | 10 ++++----- .../device_setup_plans/setup_zebra.py | 4 ++-- .../hyperion/device_setup_plans/smargon.py | 12 +++++----- .../hyperion/device_setup_plans/utils.py | 4 ++-- .../device_setup_plans/xbpm_feedback.py | 8 +++---- .../change_aperture_then_move_plan.py | 6 +---- .../flyscan_xray_centre_plan.py | 8 +++---- .../oav_grid_detection_plan.py | 20 ++++++++--------- .../experiment_plans/oav_snapshot_plan.py | 8 +++---- .../experiment_plans/pin_tip_centring_plan.py | 4 ++-- .../robot_load_and_change_energy.py | 18 +++++++-------- .../experiment_plans/rotation_scan_plan.py | 2 +- .../experiment_plans/test_fgs_plan.py | 2 +- .../common/external_interaction/conftest.py | 6 ++--- tests/unit_tests/hyperion/conftest.py | 1 + .../device_setup_plans/test_setup_oav.py | 6 ++--- .../test_robot_load_ispyb_callback.py | 2 +- 26 files changed, 85 insertions(+), 91 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf87d26b3f..6784b9a852 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ # "annotated_types", "caproto", + "confluent-kafka==2.8.0", "fastapi[all]", "flask-restful", "ispyb", @@ -45,8 +46,8 @@ dependencies = [ "daq-config-server >= 0.1.1", "ophyd == 1.9.0", "ophyd-async >= 0.9.0a2", - "bluesky == 1.13", - "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@b119d38c70c67925a998f9bcfc09689db9043eaf", + "bluesky >= 1.13", + "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@27128737247487a5f5d3e98e7bfbdfd3990546cc", ] diff --git a/src/mx_bluesky/beamlines/i04/thawing_plan.py b/src/mx_bluesky/beamlines/i04/thawing_plan.py index 13f47a2a53..7fbf8c1564 100644 --- a/src/mx_bluesky/beamlines/i04/thawing_plan.py +++ b/src/mx_bluesky/beamlines/i04/thawing_plan.py @@ -24,21 +24,17 @@ def thaw_and_stream_to_redis( oav: OAV = inject("oav"), oav_to_redis_forwarder: OAVToRedisForwarder = inject("oav_to_redis_forwarder"), ) -> MsgGenerator: - zoom_percentage = yield from bps.rd(oav.zoom_controller.percentage) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + zoom_percentage = yield from bps.rd(oav.zoom_controller.percentage) sample_id = yield from bps.rd(robot.sample_id) sample_id = int(sample_id) - zoom_level_before_thawing = yield from bps.rd(oav.zoom_controller.level) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + zoom_level_before_thawing = yield from bps.rd(oav.zoom_controller.level) - yield from bps.mv(oav.zoom_controller.level, "1.0x") # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(oav.zoom_controller.level, "1.0x") def switch_forwarder_to_ROI() -> MsgGenerator: yield from bps.complete(oav_to_redis_forwarder, wait=True) - yield from bps.mv( - # See: https://github.com/bluesky/bluesky/issues/1809 - oav_to_redis_forwarder.selected_source, # type: ignore - Source.ROI.value, # type: ignore - ) + yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value) yield from bps.kickoff(oav_to_redis_forwarder, wait=True) microns_per_pixel_x = yield from bps.rd(oav.microns_per_pixel_x) @@ -59,10 +55,10 @@ def switch_forwarder_to_ROI() -> MsgGenerator: ) def _thaw_and_stream_to_redis(): yield from bps.mv( - oav_to_redis_forwarder.sample_id, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - sample_id, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - oav_to_redis_forwarder.selected_source, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - Source.FULL_SCREEN.value, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + oav_to_redis_forwarder.sample_id, + sample_id, + oav_to_redis_forwarder.selected_source, + Source.FULL_SCREEN.value, ) yield from bps.kickoff(oav_to_redis_forwarder, wait=True) @@ -74,7 +70,7 @@ def _thaw_and_stream_to_redis(): yield from bps.complete(oav_to_redis_forwarder) def cleanup(): - yield from bps.mv(oav.zoom_controller.level, zoom_level_before_thawing) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(oav.zoom_controller.level, zoom_level_before_thawing) yield from bpp.contingency_wrapper( _thaw_and_stream_to_redis(), diff --git a/src/mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py b/src/mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py index c5a262d4b7..1b80359bfb 100755 --- a/src/mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +++ b/src/mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py @@ -138,7 +138,7 @@ def enter_hutch( detector_stage: DetectorMotion = inject("detector_motion"), ) -> MsgGenerator: """Move the detector stage before entering hutch.""" - yield from bps.mv(detector_stage.z, SAFE_DET_Z) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(detector_stage.z, SAFE_DET_Z) SSX_LOGGER.debug("Detector moved.") diff --git a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py index aee8ce349e..ebf2a7847d 100755 --- a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +++ b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py @@ -548,11 +548,11 @@ def moveto(place: str = "origin", pmac: PMAC = inject("pmac")) -> MsgGenerator: chip_move = CHIP_MOVES[chip_type] if place == Fiducials.origin: - yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0) if place == Fiducials.fid1: - yield from bps.mv(pmac.x, chip_move, pmac.y, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(pmac.x, chip_move, pmac.y, 0.0) if place == Fiducials.fid2: - yield from bps.mv(pmac.x, 0.0, pmac.y, chip_move) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(pmac.x, 0.0, pmac.y, chip_move) @log_on_entry @@ -580,7 +580,7 @@ def moveto_preset( elif place == "collect_position": SSX_LOGGER.info("collect position") caput(pv.me14e_filter, 20) - yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0, pmac.z, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0, pmac.z, 0.0) yield from bps.abs_set( beamstop.pos_select, BeamstopPositions.DATA_COLLECTION, group=place ) @@ -589,7 +589,7 @@ def moveto_preset( elif place == "microdrop_position": SSX_LOGGER.info("microdrop align position") - yield from bps.mv(pmac.x, 6.0, pmac.y, -7.8, pmac.z, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(pmac.x, 6.0, pmac.y, -7.8, pmac.z, 0.0) @log_on_entry diff --git a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py index c2faa3ec2d..7f41fa6e38 100755 --- a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +++ b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py @@ -33,7 +33,7 @@ def _get_beam_centre(oav: OAV): def _calculate_zoom_calibrator(oav: OAV): """Set the scale for the zoom calibrator for the pmac moves.""" - currentzoom = yield from bps.rd(oav.zoom_controller.percentage) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + currentzoom = yield from bps.rd(oav.zoom_controller.percentage) zoomcalibrator = 1.547 - (0.03 * currentzoom) + (0.0001634 * currentzoom**2) return zoomcalibrator diff --git a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py index 0f642f2afc..f2323c2457 100644 --- a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +++ b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py @@ -84,7 +84,7 @@ def move_detector_stage_to_position_plan( SSX_LOGGER.debug( f"Waiting for detector move. Detector distance: {detector_distance} mm." ) - yield from bps.mv(detector_stage.z, detector_distance) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(detector_stage.z, detector_distance) def set_detector_beam_center_plan( diff --git a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py index 85fceb1da9..2f178ab7c4 100644 --- a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +++ b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py @@ -55,7 +55,7 @@ def get_detector_type(detector_stage: DetectorMotion) -> Generator[Msg, None, De def _move_detector_stage(detector_stage: DetectorMotion, target: float) -> MsgGenerator: SSX_LOGGER.info(f"Moving detector stage to target position: {target}.") - yield from bps.mv(detector_stage.y, target) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(detector_stage.y, target) # Workaround in case the PV value has been set to the detector name diff --git a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py index 8c1d1514d9..d75c448f9f 100644 --- a/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +++ b/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py @@ -55,12 +55,12 @@ def get_zebra_settings_for_extruder( def arm_zebra(zebra: Zebra): - yield from bps.abs_set(zebra.pc.arm, ArmDemand.ARM, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(zebra.pc.arm, ArmDemand.ARM, wait=True) SSX_LOGGER.info("Zebra armed.") def disarm_zebra(zebra: Zebra): - yield from bps.abs_set(zebra.pc.arm, ArmDemand.DISARM, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(zebra.pc.arm, ArmDemand.DISARM, wait=True) SSX_LOGGER.info("Zebra disarmed.") diff --git a/src/mx_bluesky/common/plans/do_fgs.py b/src/mx_bluesky/common/plans/do_fgs.py index b9a548b947..8b2353b8b3 100644 --- a/src/mx_bluesky/common/plans/do_fgs.py +++ b/src/mx_bluesky/common/plans/do_fgs.py @@ -28,7 +28,7 @@ def _wait_for_zocalo_to_stage_then_do_fgs( during_collection_plan: Callable[[], MsgGenerator] | None = None, ): expected_images = yield from bps.rd(grid_scan_device.expected_images) - exposure_sec_per_image = yield from bps.rd(detector.cam.acquire_time) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + exposure_sec_per_image = yield from bps.rd(detector.cam.acquire_time) # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855) LOGGER.info("waiting for topup if necessary...") yield from check_topup_and_wait_if_necessary( synchrotron, @@ -99,8 +99,8 @@ def kickoff_and_complete_gridscan( } ) @bpp.contingency_decorator( - except_plan=lambda e: (yield from bps.stop(detector)), # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - else_plan=lambda: (yield from bps.unstage(detector)), # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + except_plan=lambda e: (yield from bps.stop(detector)), # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855) + else_plan=lambda: (yield from bps.unstage(detector)), ) def _decorated_do_fgs(): yield from _wait_for_zocalo_to_stage_then_do_fgs( diff --git a/src/mx_bluesky/hyperion/device_setup_plans/setup_oav.py b/src/mx_bluesky/hyperion/device_setup_plans/setup_oav.py index ec59b4894c..3a6a5e01fb 100644 --- a/src/mx_bluesky/hyperion/device_setup_plans/setup_oav.py +++ b/src/mx_bluesky/hyperion/device_setup_plans/setup_oav.py @@ -55,14 +55,14 @@ def setup_pin_tip_detection_params( def setup_general_oav_params(oav: OAV, parameters: OAVParameters): - yield from set_using_group(oav.cam.color_mode, ColorMode.RGB1) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from set_using_group(oav.cam.acquire_period, parameters.acquire_period) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from set_using_group(oav.cam.acquire_time, parameters.exposure) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from set_using_group(oav.cam.gain, parameters.gain) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from set_using_group(oav.cam.color_mode, ColorMode.RGB1) + yield from set_using_group(oav.cam.acquire_period, parameters.acquire_period) + yield from set_using_group(oav.cam.acquire_time, parameters.exposure) + yield from set_using_group(oav.cam.gain, parameters.gain) zoom_level_str = f"{float(parameters.zoom)}x" yield from bps.abs_set( - oav.zoom_controller, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + oav.zoom_controller, zoom_level_str, wait=True, ) diff --git a/src/mx_bluesky/hyperion/device_setup_plans/setup_zebra.py b/src/mx_bluesky/hyperion/device_setup_plans/setup_zebra.py index aa23ee13c3..f4bf119503 100644 --- a/src/mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +++ b/src/mx_bluesky/hyperion/device_setup_plans/setup_zebra.py @@ -47,7 +47,7 @@ def log_and_retry(exception): def arm_zebra(zebra: Zebra): - yield from bps.abs_set(zebra.pc.arm, ArmDemand.ARM, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(zebra.pc.arm, ArmDemand.ARM, wait=True) def tidy_up_zebra_after_rotation_scan( @@ -56,7 +56,7 @@ def tidy_up_zebra_after_rotation_scan( group="tidy_up_zebra_after_rotation", wait=True, ): - yield from bps.abs_set(zebra.pc.arm, ArmDemand.DISARM, group=group) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(zebra.pc.arm, ArmDemand.DISARM, group=group) yield from bps.abs_set( zebra_shutter.control_mode, ZebraShutterControl.MANUAL, group=group ) diff --git a/src/mx_bluesky/hyperion/device_setup_plans/smargon.py b/src/mx_bluesky/hyperion/device_setup_plans/smargon.py index 3da4e706cf..0cf222cb5c 100644 --- a/src/mx_bluesky/hyperion/device_setup_plans/smargon.py +++ b/src/mx_bluesky/hyperion/device_setup_plans/smargon.py @@ -16,10 +16,10 @@ def move_smargon_warn_on_out_of_range( "Pin tip centring failed - pin too long/short/bent and out of range" ) yield from bps.mv( - smargon.x, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - position[0], # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.y, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - position[1], # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.z, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - position[2], # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + smargon.x, + position[0], + smargon.y, + position[1], + smargon.z, + position[2], ) diff --git a/src/mx_bluesky/hyperion/device_setup_plans/utils.py b/src/mx_bluesky/hyperion/device_setup_plans/utils.py index ea6d9ffdf8..2d2e6e0b05 100644 --- a/src/mx_bluesky/hyperion/device_setup_plans/utils.py +++ b/src/mx_bluesky/hyperion/device_setup_plans/utils.py @@ -44,7 +44,7 @@ def start_preparing_data_collection_then_do_plan( """ def wrapped_plan(): - yield from bps.abs_set(eiger.do_arm, 1, group=group) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(eiger.do_arm, 1, group=group) # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855) if detector_distance_mm: yield from set_detector_z_position( detector_motion, detector_distance_mm, group @@ -55,5 +55,5 @@ def wrapped_plan(): yield from check_beamstop(beamstop) yield from bpp.contingency_wrapper( wrapped_plan(), - except_plan=lambda e: (yield from bps.stop(eiger)), # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + except_plan=lambda e: (yield from bps.stop(eiger)), # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855) ) diff --git a/src/mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py b/src/mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py index 01aebc0177..f298d58d62 100644 --- a/src/mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +++ b/src/mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py @@ -25,14 +25,14 @@ def _check_and_pause_feedback( turning XBPM feedback off. """ - yield from bps.mv(attenuator, 1.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(attenuator, 1.0) LOGGER.info("Waiting for XBPM feedback to be stable") yield from bps.trigger(xbpm_feedback, wait=True) LOGGER.info( f"XPBM feedback in position, pausing and setting transmission to {desired_transmission_fraction}" ) - yield from bps.mv(xbpm_feedback.pause_feedback, Pause.PAUSE) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.mv(attenuator, desired_transmission_fraction) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(xbpm_feedback.pause_feedback, Pause.PAUSE) + yield from bps.mv(attenuator, desired_transmission_fraction) def _unpause_xbpm_feedback_and_set_transmission_to_1( @@ -46,7 +46,7 @@ def _unpause_xbpm_feedback_and_set_transmission_to_1( the beam in position attenuator (BinaryFilterAttenuator): The attenuator used to set transmission """ - yield from bps.mv(xbpm_feedback.pause_feedback, Pause.RUN, attenuator, 1.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(xbpm_feedback.pause_feedback, Pause.RUN, attenuator, 1.0) def transmission_and_xbpm_feedback_for_collection_wrapper( diff --git a/src/mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py b/src/mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py index 5d7829e42a..7fa7f9687f 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py @@ -43,11 +43,7 @@ def change_aperture_then_move_to_xtal( # https://github.com/DiamondLightSource/mx-bluesky/issues/552 if parameters and parameters.FGS_params.set_stub_offsets: LOGGER.info("Recentring smargon co-ordinate system to this point.") - yield from bps.mv( - # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.stub_offsets, # type: ignore - StubPosition.CURRENT_AS_CENTER, # type: ignore - ) + yield from bps.mv(smargon.stub_offsets, StubPosition.CURRENT_AS_CENTER) def set_aperture_for_bbox_mm( diff --git a/src/mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py b/src/mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py index a37ad4c918..1456aec9bd 100755 --- a/src/mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py @@ -211,7 +211,7 @@ def run_gridscan_and_fetch_results( finally: # Turn off dev/shm streaming to avoid filling disk, see https://github.com/DiamondLightSource/hyperion/issues/1395 LOGGER.info("Turning off Eiger dev/shm streaming") - yield from bps.abs_set(fgs_composite.eiger.odin.fan.dev_shm_enable, 0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(fgs_composite.eiger.odin.fan.dev_shm_enable, 0) # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855) # Wait on everything before returning to GDA (particularly apertures), can be removed # when we do not return to GDA here @@ -300,7 +300,7 @@ def run_gridscan( LOGGER.info("Waiting for arming to finish") yield from bps.wait(CONST.WAIT.GRID_READY_FOR_DC) - yield from bps.stage(fgs_composite.eiger) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.stage(fgs_composite.eiger) yield from kickoff_and_complete_gridscan( feature_controlled.fgs_motors, @@ -444,8 +444,8 @@ def _panda_triggering_setup( ) yield from bps.mv( - fgs_composite.panda_fast_grid_scan.time_between_x_steps_ms, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - time_between_x_steps_ms, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + fgs_composite.panda_fast_grid_scan.time_between_x_steps_ms, + time_between_x_steps_ms, ) directory_provider_root = Path(parameters.storage_directory) diff --git a/src/mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py b/src/mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py index 847685d2a4..fc9c4cc825 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py @@ -100,7 +100,7 @@ def grid_detection_plan( # The FGS uses -90 so we need to match it for angle in [0, -90]: - yield from bps.mv(smargon.omega, angle) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(smargon.omega, angle) # need to wait for the OAV image to update # See #673 for improvements yield from bps.sleep(CONST.HARDWARE.OAV_REFRESH_DELAY) @@ -152,20 +152,20 @@ def grid_detection_plan( upper_left = (tip_x_px, min_y) - yield from bps.abs_set(oav.grid_snapshot.top_left_x, upper_left[0]) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.abs_set(oav.grid_snapshot.top_left_y, upper_left[1]) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.abs_set(oav.grid_snapshot.box_width, box_size_x_pixels) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.abs_set(oav.grid_snapshot.num_boxes_x, x_steps) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.abs_set(oav.grid_snapshot.num_boxes_y, y_steps) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(oav.grid_snapshot.top_left_x, upper_left[0]) + yield from bps.abs_set(oav.grid_snapshot.top_left_y, upper_left[1]) + yield from bps.abs_set(oav.grid_snapshot.box_width, box_size_x_pixels) + yield from bps.abs_set(oav.grid_snapshot.num_boxes_x, x_steps) + yield from bps.abs_set(oav.grid_snapshot.num_boxes_y, y_steps) snapshot_filename = snapshot_template.format(angle=abs(angle)) - yield from bps.abs_set(oav.grid_snapshot.filename, snapshot_filename) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.abs_set(oav.grid_snapshot.directory, snapshot_dir) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - yield from bps.trigger(oav.grid_snapshot, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(oav.grid_snapshot.filename, snapshot_filename) + yield from bps.abs_set(oav.grid_snapshot.directory, snapshot_dir) + yield from bps.trigger(oav.grid_snapshot, wait=True) yield from bps.create(CONST.DESCRIPTORS.OAV_GRID_SNAPSHOT_TRIGGERED) - yield from bps.read(oav) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.read(oav) yield from bps.read(smargon) yield from bps.save() diff --git a/src/mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py b/src/mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py index f269ff0243..cbd165bd67 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py @@ -57,7 +57,7 @@ def _setup_oav( ): yield from setup_general_oav_params(composite.oav, oav_parameters) yield from bps.abs_set( - composite.oav.snapshot.directory, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + composite.oav.snapshot.directory, str(parameters.snapshot_directory), ) @@ -69,12 +69,12 @@ def _take_oav_snapshot(composite: OavSnapshotComposite, omega: float): time_now = datetime.now() filename = f"{time_now.strftime('%H%M%S')}_oav_snapshot_{omega:.0f}" yield from bps.abs_set( - composite.oav.snapshot.filename, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + composite.oav.snapshot.filename, filename, group=OAV_SNAPSHOT_SETUP_SHOT, ) yield from bps.wait(group=OAV_SNAPSHOT_SETUP_SHOT) - yield from bps.trigger(composite.oav.snapshot, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.trigger(composite.oav.snapshot, wait=True) yield from bps.create(DocDescriptorNames.OAV_ROTATION_SNAPSHOT_TRIGGERED) - yield from bps.read(composite.oav.snapshot) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.read(composite.oav.snapshot) yield from bps.save() diff --git a/src/mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py b/src/mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py index 786e913710..46e1ac4f4b 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py @@ -97,7 +97,7 @@ def pin_tip_valid(pin_xy: Tip): f"Pin tip is off screen, and moving {step_vector_mm}mm would cross limits, " f"moving to {move_within_limits} instead" ) - yield from bps.mv(smargon.x, move_within_limits) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(smargon.x, move_within_limits) # Some time for the view to settle after the move yield from bps.sleep(CONST.HARDWARE.OAV_REFRESH_DELAY) @@ -154,7 +154,7 @@ def offset_and_move(tip: Pixel): tip = yield from move_pin_into_view(pin_tip_detect, smargon) yield from offset_and_move(tip) - yield from bps.mvr(smargon.omega, 90) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mvr(smargon.omega, 90) # need to wait for the OAV image to update # See #673 for improvements diff --git a/src/mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py b/src/mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py index ddf5a17275..41cef509cd 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +++ b/src/mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py @@ -98,16 +98,16 @@ def prepare_for_robot_load( aperture_scatterguard, ApertureValue.OUT_OF_BEAM, group="prepare_robot_load" ) - yield from bps.mv(smargon.stub_offsets, StubPosition.RESET_TO_ROBOT_LOAD) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(smargon.stub_offsets, StubPosition.RESET_TO_ROBOT_LOAD) # fmt: off yield from bps.mv( - smargon.x, 0, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.y, 0, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.z, 0, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.omega, 0, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.chi, 0, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 - smargon.phi, 0 # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + smargon.x, 0, + smargon.y, 0, + smargon.z, 0, + smargon.omega, 0, + smargon.chi, 0, + smargon.phi, 0 ) # fmt: on @@ -131,7 +131,7 @@ def do_robot_load( yield from bps.wait("robot_load") yield from bps.abs_set( - composite.thawer.thaw_for_time_s, # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + composite.thawer.thaw_for_time_s, thawing_time, group="thawing_finished", ) @@ -193,7 +193,7 @@ def robot_load_and_snapshots( yield from bps.create(name=CONST.DESCRIPTORS.ROBOT_LOAD) yield from bps.read(composite.robot.barcode) - yield from bps.read(composite.oav.snapshot) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.read(composite.oav.snapshot) yield from bps.read(composite.webcam) yield from bps.save() diff --git a/src/mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py b/src/mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py index 1a0be583da..b46b38d45f 100644 --- a/src/mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +++ b/src/mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py @@ -406,7 +406,7 @@ def rotation_with_cleanup_and_stage(params: RotationScan): rotation_with_cleanup_and_stage(params), group=CONST.WAIT.ROTATION_READY_FOR_DC, ) - yield from bps.unstage(eiger) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.unstage(eiger) yield from rotation_scan_plan_with_stage_and_cleanup(parameters) diff --git a/tests/system_tests/hyperion/experiment_plans/test_fgs_plan.py b/tests/system_tests/hyperion/experiment_plans/test_fgs_plan.py index b313e3c897..8a6acb166c 100644 --- a/tests/system_tests/hyperion/experiment_plans/test_fgs_plan.py +++ b/tests/system_tests/hyperion/experiment_plans/test_fgs_plan.py @@ -64,7 +64,7 @@ def callbacks(params): def reset_positions(smargon: Smargon): - yield from bps.mv(smargon.x, -1, smargon.y, -1, smargon.z, -1) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.mv(smargon.x, -1, smargon.y, -1, smargon.z, -1) @pytest.fixture diff --git a/tests/unit_tests/common/external_interaction/conftest.py b/tests/unit_tests/common/external_interaction/conftest.py index d5e0187989..ae8fd3c64d 100644 --- a/tests/unit_tests/common/external_interaction/conftest.py +++ b/tests/unit_tests/common/external_interaction/conftest.py @@ -6,7 +6,7 @@ import bluesky.preprocessors as bpp import pytest from bluesky.run_engine import RunEngine -from ophyd.sim import SynAxis +from ophyd_async.sim import SimMotor from mx_bluesky.common.external_interaction.callbacks.common.plan_reactive_callback import ( PlanReactiveCallback, @@ -41,12 +41,12 @@ def RE_with_mock_callback(mocked_test_callback): def get_test_plan(callback_name): - s = SynAxis(name="fake_signal") + s = SimMotor(name="fake_signal") @bpp.run_decorator(md={"activate_callbacks": [callback_name]}) def test_plan(): yield from bps.create() - yield from bps.read(s) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.read(s) yield from bps.save() return test_plan, s diff --git a/tests/unit_tests/hyperion/conftest.py b/tests/unit_tests/hyperion/conftest.py index 492f8b3d22..6df0220164 100644 --- a/tests/unit_tests/hyperion/conftest.py +++ b/tests/unit_tests/hyperion/conftest.py @@ -21,6 +21,7 @@ def load_centre_collect_params(): @pytest.fixture(autouse=True) def patch_open_to_prevent_dls_reads_in_tests(): unpatched_open = open + assert __package__ project_folder = resources.files(__package__) assert isinstance(project_folder, Path) project_folder = project_folder.parent.parent.parent diff --git a/tests/unit_tests/hyperion/device_setup_plans/test_setup_oav.py b/tests/unit_tests/hyperion/device_setup_plans/test_setup_oav.py index 2a0a6e63ac..3c5fc709bd 100644 --- a/tests/unit_tests/hyperion/device_setup_plans/test_setup_oav.py +++ b/tests/unit_tests/hyperion/device_setup_plans/test_setup_oav.py @@ -6,8 +6,8 @@ from dodal.devices.oav.oav_detector import OAV from dodal.devices.oav.oav_parameters import OAVParameters from dodal.devices.oav.pin_image_recognition import PinTipDetection -from ophyd.signal import Signal from ophyd.status import Status +from ophyd_async.sim import SimMotor from mx_bluesky.hyperion.device_setup_plans.setup_oav import ( pre_centring_setup_oav, @@ -26,11 +26,11 @@ def test_when_set_up_oav_then_only_waits_on_oav_to_finish( ): """This test will hang if pre_centring_setup_oav waits too generally as my_waiting_device never finishes moving""" - my_waiting_device = Signal(name="") + my_waiting_device = SimMotor(name="") my_waiting_device.set = MagicMock(return_value=Status()) def my_plan(): - yield from bps.abs_set(my_waiting_device, 10, wait=False) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.abs_set(my_waiting_device, 10, wait=False) yield from pre_centring_setup_oav(oav, mock_parameters, ophyd_pin_tip_detection) RE = RunEngine() diff --git a/tests/unit_tests/hyperion/external_interaction/callbacks/robot_load/test_robot_load_ispyb_callback.py b/tests/unit_tests/hyperion/external_interaction/callbacks/robot_load/test_robot_load_ispyb_callback.py index 4b67d9b691..44526d07a0 100644 --- a/tests/unit_tests/hyperion/external_interaction/callbacks/robot_load/test_robot_load_ispyb_callback.py +++ b/tests/unit_tests/hyperion/external_interaction/callbacks/robot_load/test_robot_load_ispyb_callback.py @@ -106,7 +106,7 @@ def test_given_end_called_but_no_start_then_exception_raised(end_load): def successful_robot_load_plan(robot: BartRobot, oav: OAV, webcam: Webcam): yield from bps.create(name=CONST.DESCRIPTORS.ROBOT_LOAD) yield from bps.read(robot.barcode) - yield from bps.read(oav.snapshot) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809 + yield from bps.read(oav.snapshot) yield from bps.read(webcam) yield from bps.save() From 6fdec5eb3695b41a001cc049451e351a1f7b1e99 Mon Sep 17 00:00:00 2001 From: Dominic Oram Date: Mon, 3 Mar 2025 18:22:27 +0000 Subject: [PATCH 2/3] Pin dodal --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6784b9a852..04ca5f6f12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ dependencies = [ "ophyd == 1.9.0", "ophyd-async >= 0.9.0a2", "bluesky >= 1.13", - "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@27128737247487a5f5d3e98e7bfbdfd3990546cc", + "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@1a58fa6b342218eb04faaf74461e8a71f1573d35", ] From 434c9a6309bb467456148e2ce5bdca2da2f21c61 Mon Sep 17 00:00:00 2001 From: Dominic Oram Date: Mon, 3 Mar 2025 18:33:52 +0000 Subject: [PATCH 3/3] Unpin confluent-kafka as latest version is good --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 04ca5f6f12..cb0b437f7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ dependencies = [ # "annotated_types", "caproto", - "confluent-kafka==2.8.0", "fastapi[all]", "flask-restful", "ispyb",