Skip to content

Commit f2d096a

Browse files
Merge pull request #309 from ISISComputingGroup/ophyd_async_0.15
Migrate to `ophyd-async v0.15` (breaking changes for user-defined devices)
2 parents df24fd9 + b46cf25 commit f2d096a

File tree

16 files changed

+40
-40
lines changed

16 files changed

+40
-40
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
intersphinx_mapping = {
9090
"python": ("https://docs.python.org/3", None),
9191
"bluesky": ("https://blueskyproject.io/bluesky/main/", None),
92-
"ophyd_async": ("https://blueskyproject.io/ophyd-async/v0.14.0/", None),
92+
"ophyd_async": ("https://blueskyproject.io/ophyd-async/v0.15/", None),
9393
"event_model": ("https://blueskyproject.io/event-model/main/", None),
9494
"scipp": ("https://scipp.github.io/", None),
9595
"scippneutron": ("https://scipp.github.io/scippneutron/", None),

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ classifiers = [
4242
dependencies = [
4343
"bluesky", # Bluesky framework
4444
"confluent-kafka", # Kafka producer
45-
"ophyd-async[ca] == 0.14.2", # Device abstraction. When changing, also change in doc/conf.py
45+
"ophyd-async[ca] == 0.15.0", # Device abstraction. When changing, also change in doc/conf.py
4646
"lmfit", # Fitting
4747
"matplotlib", # Plotting
4848
"msgpack-numpy", # Encoding kafka messages

src/ibex_bluesky_core/devices/block.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,15 @@ def plan():
249249
be set to empty string to read and write to exactly the same PV.
250250
251251
"""
252+
self._write_config: BlockWriteConfig[T] = write_config or BlockWriteConfig()
253+
252254
self.setpoint: SignalRW[T] = epics_signal_rw(
253-
datatype, f"{prefix}CS:SB:{block_name}{sp_suffix}"
255+
datatype,
256+
f"{prefix}CS:SB:{block_name}{sp_suffix}",
257+
wait=self._write_config.use_completion_callback,
254258
)
255259
"""The setpoint for this block."""
256260

257-
self._write_config: BlockWriteConfig[T] = write_config or BlockWriteConfig()
258-
259261
if self._write_config.use_global_moving_flag:
260262
# Misleading PV name... says it's a str but it's really a bi record.
261263
# Only link to this if we need to (i.e. if use_global_moving_flag was requested)
@@ -283,9 +285,7 @@ def my_plan():
283285

284286
async def do_set(setpoint: T) -> None:
285287
logger.info("Setting Block %s to %s", self.name, setpoint)
286-
await self.setpoint.set(
287-
setpoint, wait=self._write_config.use_completion_callback, timeout=None
288-
)
288+
await self.setpoint.set(setpoint, timeout=None)
289289
logger.info("Got completion callback from setting block %s to %s", self.name, setpoint)
290290

291291
if self._write_config.use_global_moving_flag:

src/ibex_bluesky_core/devices/dae/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def set(self, value: T) -> None:
108108
OSError: If the signal failed to be set to the specified value.
109109
110110
"""
111-
await self.signal.set(value, wait=True, timeout=None)
111+
await self.signal.set(value, timeout=None)
112112
actual_value = await self.signal.get_value()
113113
if value != actual_value:
114114
raise OSError(
@@ -252,7 +252,7 @@ async def _trigger_and_get_raw_specdata(self) -> npt.NDArray[np.int32]:
252252
time channels (including the "junk" time-channel 0).
253253
"""
254254
await self.controls.update_run.trigger()
255-
await self.raw_spec_data_proc.set(1, wait=True)
255+
await self.raw_spec_data_proc.set(1)
256256
(raw_data, nord) = await asyncio.gather(
257257
self.raw_spec_data.get_value(),
258258
self.raw_spec_data_nord.get_value(),

src/ibex_bluesky_core/devices/dae/_controls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ async def set(self, value: BeginRunExBits) -> None:
9898
9999
"""
100100
logger.info("starting run with options %s", value)
101-
await self._raw_begin_run_ex.set(value, wait=True, timeout=None)
101+
await self._raw_begin_run_ex.set(value, timeout=None)
102102
logger.info("start run complete")

src/ibex_bluesky_core/devices/dae/_period_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ async def set(self, value: DaePeriodSettingsData) -> None:
180180
current_xml = await self._raw_period_settings.get_value()
181181
to_write = _convert_period_settings_to_xml(current_xml, value)
182182
logger.info("set period settings: %s", to_write)
183-
await self._raw_period_settings.set(to_write, wait=True, timeout=None)
183+
await self._raw_period_settings.set(to_write, timeout=None)

src/ibex_bluesky_core/devices/dae/_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,4 @@ async def set(self, value: DaeSettingsData) -> None:
277277
current_xml = await self._raw_dae_settings.get_value()
278278
to_write = _convert_dae_settings_to_xml(current_xml, value)
279279
logger.info("set dae settings: %s", to_write)
280-
await self._raw_dae_settings.set(to_write, wait=True, timeout=None)
280+
await self._raw_dae_settings.set(to_write, timeout=None)

src/ibex_bluesky_core/devices/dae/_tcb_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@ async def set(self, value: DaeTCBSettingsData) -> None:
199199
xml = _convert_tcb_settings_to_xml(current_xml_dehexed, value)
200200
the_value_to_write = compress_and_hex(xml).decode()
201201
logger.info("set tcb settings: %s", the_value_to_write)
202-
await self._raw_tcb_settings.set(the_value_to_write, wait=True, timeout=None)
202+
await self._raw_tcb_settings.set(the_value_to_write, timeout=None)

src/ibex_bluesky_core/devices/reflectometry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def set(self, value: float) -> None:
7878
indicate it has finished.
7979
"""
8080
logger.info("setting %s to %s", self.setpoint.source, value)
81-
await self.setpoint.set(value, wait=True, timeout=None)
81+
await self.setpoint.set(value, timeout=None)
8282
await asyncio.sleep(0.1)
8383
logger.info("waiting for %s", self.changing.source)
8484
async for chg in observe_value(self.changing, done_timeout=self.changing_timeout):
@@ -118,7 +118,7 @@ async def set(self, value: float) -> None:
118118
if in_manager_mode != NoYesChoice.YES:
119119
raise ValueError(f"Cannot redefine {self.define_pos_sp.source} as not in manager mode.")
120120
logger.info("setting %s to %s", self.define_pos_sp.source, value)
121-
await self.define_pos_sp.set(value, wait=True, timeout=None)
121+
await self.define_pos_sp.set(value, timeout=None)
122122
logger.info("waiting for 1s for redefine to finish")
123123
# The Reflectometry server has a CHANGED PV for a redefine, but it doesn't actually
124124
# give a monitor update, so just wait an arbitrary length of time for it to be done.

src/ibex_bluesky_core/devices/simpledae/_controllers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
async def _end_or_abort_run(dae: Dae, save: bool) -> None:
1919
if save:
2020
logger.info("ending run")
21-
await dae.controls.end_run.trigger(wait=True, timeout=None)
21+
await dae.controls.end_run.trigger(timeout=None)
2222
logger.info("run ended")
2323
else:
2424
logger.info("aborting run")
25-
await dae.controls.abort_run.trigger(wait=True, timeout=None)
25+
await dae.controls.abort_run.trigger(timeout=None)
2626
logger.info("run aborted")
2727

2828

@@ -65,7 +65,7 @@ async def start_counting(self, dae: Dae) -> None:
6565
"""
6666
logger.info("start counting")
6767
self._current_period += 1
68-
await dae.period_num.set(self._current_period, wait=True, timeout=None)
68+
await dae.period_num.set(self._current_period, timeout=None)
6969

7070
# Error if the period change didn't work (e.g. we have exceeded max periods)
7171
await wait_for_value(
@@ -80,7 +80,7 @@ async def start_counting(self, dae: Dae) -> None:
8080
await wait_for_value(dae.period.raw_frames, 0, timeout=10)
8181

8282
logger.info("resuming run")
83-
await dae.controls.resume_run.trigger(wait=True, timeout=None)
83+
await dae.controls.resume_run.trigger(timeout=None)
8484
await wait_for_value(
8585
dae.run_state,
8686
lambda v: v in {RunstateEnum.RUNNING, RunstateEnum.WAITING, RunstateEnum.VETOING},
@@ -90,7 +90,7 @@ async def start_counting(self, dae: Dae) -> None:
9090
async def stop_counting(self, dae: Dae) -> None:
9191
"""Stop counting a scan point, by pausing the run."""
9292
logger.info("stop counting")
93-
await dae.controls.pause_run.trigger(wait=True, timeout=None)
93+
await dae.controls.pause_run.trigger(timeout=None)
9494
await wait_for_value(dae.run_state, RunstateEnum.PAUSED, timeout=10)
9595

9696
async def teardown(self, dae: Dae) -> None:
@@ -133,7 +133,7 @@ def __init__(self, save_run: bool) -> None:
133133
async def start_counting(self, dae: Dae) -> None:
134134
"""Start counting a scan point, by starting a DAE run."""
135135
logger.info("start counting")
136-
await dae.controls.begin_run.trigger(wait=True, timeout=None)
136+
await dae.controls.begin_run.trigger(timeout=None)
137137
await wait_for_value(
138138
dae.run_state,
139139
lambda v: v in {RunstateEnum.RUNNING, RunstateEnum.WAITING, RunstateEnum.VETOING},

0 commit comments

Comments
 (0)