-
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
feat(api): implement pipetting restrictions around heater-shaker #11218
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #11218 +/- ##
=======================================
Coverage 73.81% 73.81%
=======================================
Files 2086 2086
Lines 57677 57677
Branches 5845 5845
=======================================
Hits 42574 42574
Misses 13826 13826
Partials 1277 1277
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Code looks mostly good, just a couple organizational thoughts. I'm good to 🚢 as longs as we've tested this on hardware
@@ -0,0 +1,47 @@ | |||
"""Getters for different types of adjacent slots.""" |
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 usually treat anything named util
as a yellow flag. In my experience, you usually end up with a weird grab-bag of unrelated stuff that becomes difficult to find, test, and/or mock.
For example, looking at what's in opentrons.util
right now, we have a four different things (plug an entirely empty file) that have nothing to do with each other:
- Labware definition fetching plumbing
- Datetime functions
- Linear algebra functions
- Logging config
Could we put these functions in opentrons.motion_planning
instead? I think that's a way more descriptive home
return location - 1 | ||
|
||
|
||
def get_east_west_locations(location: int) -> List[int]: |
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.
While we're moving things around, location
is a bit of an overloaded term for us. Should we shift this interface/language to something like get_east_west_slots(slot: int) -> List[int]
?
@@ -156,6 +161,7 @@ def fake_plan_move( | |||
# Once we have a location cache, that should be our from_loc | |||
right.move_to(lw.wells()[1].top()) | |||
assert test_args[0].labware.as_well() == lw.wells()[0] # type: ignore[index] | |||
print(f"#### Well Location= {lw.wells()[1].top()} ####") |
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.
Remove debugging 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.
woops
# TODO (spp. 2022-07-20): use the ctx fixture once h/s ff is removed | ||
ctx = papi.ProtocolContext( | ||
implementation=ProtocolContextImplementation(sync_hardware=hardware.sync), | ||
) |
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.
Is this necessary? IIRC the flag doesn't have to be on when the context is created, just when the load_module
is issued
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.
Good call
Tested this python protocol on a dev app and it raised errors correctly during analysis.
|
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.
Nice! Left some review suggestions.
Also:
The method that checks for unsafe moves in the api is almost the same as that implemented in PE. Do we want to create a common, pure data 'restrictions checker' that can be used in both PAPI & PE to avoid having two sources of truth?
I would definitely prefer that, but that doesn't have to happen here if you've already done things the other way.
""" | ||
Raise an error if attempting to perform a move that's deemed unsafe due to | ||
the presence of the heater-shaker. | ||
""" |
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.
This is not intended to be part of the public Python Protocol API, right?
Let's hide it from docs.opentrons.com:
""" | |
Raise an error if attempting to perform a move that's deemed unsafe due to | |
the presence of the heater-shaker. | |
""" | |
""" | |
Raise an error if attempting to perform a move that's deemed unsafe due to | |
the presence of the heater-shaker. | |
For Opentrons internal use only. | |
:meta private: | |
""" |
"Cannot determine pipette movement safety." | ||
) | ||
|
||
cast(HeaterShakerGeometry, self.geometry).flag_unsafe_move( |
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 we can easily avoid this cast
by changing this in the superclass:
def geometry(self) -> ModuleGeometry: |
To this:
def geometry(self) -> GeometryType:
(GeometryType
is a TypeVar
defined in that file.)
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.
Added a TODO for this
@pytest.fixture | ||
def mock_heater_shaker_geometry() -> mock.MagicMock: | ||
return mock.MagicMock() | ||
|
||
|
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.
Is this used for anything? Cmd+F isn't finding anything.
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.
Woops. Leftover from deleted code
Co-authored-by: Max Marrone <[email protected]>
Overview
Closes #9915
Adds pipetting restrictions to PAPIv2 as specified in the ticket.
Changelog
flag_unsafe_move
method toHeaterShakerContext
andHeaterShakerGeometry
../protocols/geometry/deck_conflict
and intoopentrons/utils
since it's now being used by both PAPIv2 & PE. Tests for those functions upcoming.Review requests
Location
vsLabwareLike
vsLabware
in the API can be confusing. Please make sure I have't mis-converted any types.Risk assessment
Medium. Affects pipetting ability.