-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add logic to stop waiting on pin if robot raises pin not found error #629
Conversation
@coretl and @callumforrester, I'm particularly interested in your thoughts on |
I think you've done this in the most concise way at present, but I think you're right about adding a helper to ease this, maybe something like: async def pin_mounted_or_no_pin_found(self):
async for signal, value in observe_signals_value(self.error_code, self.goinio_pin_sensor):
if signal is self.error_code and value == self.NO_PIN_ERROR_CODE:
# We didn't get a pin
raise RobotLoadFailed(self.NO_PIN_ERROR_CODE, "Pin was not detected")
elif signal is self.goinio_pin_sensor and value == PinMounted.PIN_MOUNTED:
# We did get a pin
break |
Thanks @coretl, that's exactly the sort of thing I was thinking. I've made bluesky/ophyd-async#402. I will leave this as is to maintain velocity on hyperion but will pull the |
|
||
with pytest.raises(RobotLoadFailed) as e: | ||
await device.set(SampleLocation(0, 0)) | ||
assert e.value.error_code == expected_error_code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These asserts are never called
await sleep(0.01) | ||
with pytest.raises(RobotLoadFailed): | ||
await status | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what these sleeps are for - you don't enter the coroutine until await
is called on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
Fixes DiamondLightSource/hyperion#1446 and fixes DiamondLightSource/hyperion#1450
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}