Skip to content
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

Simulated AreaDetector still in Acquire state after collection when yield from trigger_and_read(detector, *devices) #713

Open
DiamondJoseph opened this issue Dec 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@DiamondJoseph
Copy link
Contributor

Stacktrace:
bar.txt

When calling trigger_and_read rapidly on the SimulatedAreaDetector, backed by the containerised IOC

ophyd-async --version
0.9.0a1

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a plan that loops over trigger_and_read with a the ADsim
  2. Observe that it occasionally (~0.5% of the time?) is still in the Acquire state

Acceptance Criteria

  • The ADSim can reliably be used on scans that collection many, many points without failure.
@DiamondJoseph DiamondJoseph added the bug Something isn't working label Dec 19, 2024
@DiamondJoseph
Copy link
Contributor Author

This was observed by @DiamondRC who can provide the plan if behaviour cannot be replicated

@coretl
Copy link
Collaborator

coretl commented Dec 20, 2024

This looks like a race condition we fixed in Malcolm, but didn't apply here.
Malcolm:
https://github.com/DiamondLightSource/pymalcolm/blob/264ec4a319092a545853f41f89ddf1d21da56504/malcolm/modules/ca/parts/caactionpart.py#L98-L122
Ophyd-async:

await status
state = await driver.detector_state.get_value()
if state not in good_states:
raise ValueError(
f"Final detector state {state.value} not in valid end "
f"states: {good_states}"
)

So if we changed to:

await status
state = None
try:
    async for state in observe_value(driver.detector_state, done_timeout=STATUS_TIMEOUT):
        if state in good_states:
            return
except asyncio.TimeoutError:
    raise ValueError(
        f"Final detector state {state.value} not in valid end "
        f"states: {good_states}"
    )

or something similar that should fix it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants