-
Notifications
You must be signed in to change notification settings - Fork 179
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
fix(api): Error instead of infinite-looping when disposal_volume is too high to make progress #6754
Changes from all commits
a4d8384
91f300a
b83572f
ff19cd3
09a427a
79d3603
4900539
3cc63eb
fde3cd4
f00b9d6
44ed13e
fd7787c
3e9c3ca
35568d5
f9e6831
04259e1
364b00f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,6 +364,9 @@ def __init__(self, | |
volume, | ||
sources, | ||
dests, | ||
# todo(mm, 2021-03-10): | ||
# Refactor to not need an InstrumentContext, so we can more | ||
# easily test this class's logic on its own. | ||
instr: 'InstrumentContext', | ||
max_volume: float, | ||
api_version: APIVersion, | ||
|
@@ -554,6 +557,8 @@ def _plan_distribute(self): | |
# the other maintains consistency in default behaviors of all functions | ||
plan_iter = self._expand_for_volume_constraints( | ||
self._volumes, self._dests, | ||
# todo(mm, 2021-03-09): Is this a bug? | ||
# Should this be the *working volume*? | ||
self._instr.max_volume | ||
- self._strategy.disposal_volume | ||
- self._strategy.air_gap) | ||
|
@@ -600,6 +605,11 @@ def _expand_for_volume_constraints( | |
""" Split a sequence of proposed transfers if necessary to keep each | ||
transfer under the given max volume. | ||
""" | ||
|
||
if max_volume <= 0: | ||
raise ValueError( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we take this opportunity to define a more specific error type for transfer build errors? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'm thinking about this too. If you think just swapping the type of I'm also trying to figure out how to get more user-friendly errors for people using the outer protocol API, like:
As opposed to either of these:
The tension is:
|
||
f"max_volume must be greater than 0. (Got {max_volume}.)") | ||
|
||
for volume, target in zip(volumes, targets): | ||
while volume > max_volume * 2: | ||
yield max_volume, target | ||
|
@@ -648,6 +658,8 @@ def _plan_consolidate(self): | |
.. Aspirate -> .....* | ||
""" | ||
plan_iter = self._expand_for_volume_constraints( | ||
# todo(mm, 2021-03-09): Is this right? Why don't we account for | ||
# disposal volume? | ||
self._volumes, self._sources, self._instr.max_volume) | ||
current_xfer = next(plan_iter) | ||
if self._strategy.new_tip == types.TransferTipPolicy.ALWAYS: | ||
|
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 think this might make our future rework a little bit harder, but it's probably worth guarding this in an
apiVersion
check, right?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.
The original hope was that this PR would be narrowly scoped to just the variants of this bug whose fixes wouldn't need an
apiVersion
check. See "Risk assessment" in my OP.Maybe that's an exercise in futility. Maybe we should expand the scope of this PR to fix more variants of the bug, and wrap them all in an
apiVersion
check?