-
Notifications
You must be signed in to change notification settings - Fork 178
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): enable deck conflict checker for the flex #13189
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #13189 +/- ##
==========================================
+ Coverage 72.18% 72.42% +0.23%
==========================================
Files 1567 2393 +826
Lines 51763 66292 +14529
Branches 3268 7364 +4096
==========================================
+ Hits 37366 48010 +10644
- Misses 13881 16515 +2634
- Partials 516 1767 +1251
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -184,10 +191,13 @@ def check( | |||
DeckConflictError: Adding this item should not be allowed. | |||
""" | |||
restrictions: List[_DeckRestriction] = [_FixedTrashOnly()] | |||
|
|||
if robot_type == "OT-2 Standard": |
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.
hate this
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.
Initial comments, but overall looks pretty good to me. Agree w/ Max that you should not be using Unions here though.
) | ||
) | ||
|
||
elif isinstance(item, (HeaterShakerModule, TemperatureModule)): |
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.
Are these restrictions still valid? The spacing between slots is very different on the flex.
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.
Confirmed with Chris that this is still mandatory. also PD still has restrictions.
new_item: DeckItem, | ||
new_location: int, | ||
new_location: Union[int, str], | ||
robot_type: str = "OT-2 Standard", |
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 is totally reasonable to do, but if you really hate it you could create a enum and/or bitfield in which you can specify what items you want to check for collisions and push up the robot type check higher.
restrictions: List[_DeckRestriction] = [] | ||
|
||
if isinstance(item, ThermocyclerModule): | ||
for covered_location in _flex_slots_covered_by_thermocycler(): |
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 thought the TC could be in multiple slots, is this not the case?
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.
its no slot 7,10. I am setting both slots as occupied if we are in the TC case
…ition in engine core
if module_type == ModuleType.THERMOCYCLER: | ||
deck_slot = ( | ||
DeckSlotName.SLOT_7 | ||
if self._engine_client.state.config.robot_type == "OT-2 Standard" |
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.
can also use deck robot property but this feels the same. comparing a string.
@@ -167,7 +167,8 @@ | |||
"magneticModuleType", | |||
"temperatureModuleType", | |||
"thermocyclerModuleType", | |||
"heaterShakerModuleType" | |||
"heaterShakerModuleType", | |||
"magneticBlockType" |
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.
what do we think about this?
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'm OK with it. We treat it as a module essentially anyways.
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 great. Have some small comments that you can ignore.
source_item=item, | ||
source_location=location, | ||
) | ||
) | ||
|
||
for covered_location in get_east_west_slots(location): | ||
for hs_covered_location in get_east_west_slots(location.as_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.
Should these functions also take in DeckSlotNames
and perform the check on that type?
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 tired doing it but its tied to much to the legacy implementation and we are already parsing this as int in other places so might as well leave it
@@ -167,7 +167,8 @@ | |||
"magneticModuleType", | |||
"temperatureModuleType", | |||
"thermocyclerModuleType", | |||
"heaterShakerModuleType" | |||
"heaterShakerModuleType", | |||
"magneticBlockType" |
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'm OK with it. We treat it as a module essentially anyways.
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 looks great! One question about the fixed trash, and a few other minor suggestions.
robot-server/tests/integration/protocols/deck_coordinate_load_fail.py
Outdated
Show resolved
Hide resolved
robot-server/tests/integration/http_api/protocols/test_deck_coordinate_load_fail.tavern.yaml
Outdated
Show resolved
Hide resolved
…fail.py Co-authored-by: Max Marrone <[email protected]>
…ordinate_load_fail.tavern.yaml Co-authored-by: Max Marrone <[email protected]>
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 good to me. Thanks!
) -> None: | ||
"""Check a deck layout for conflicts. | ||
|
||
Args: | ||
existing_items: Existing items on the deck, assumed to be valid. | ||
new_item: New item to add to the deck. | ||
new_location: Location where the new item will be added. | ||
robot_type: Robot deck definition. |
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 a nitpick and I think we should merge this now anyway, but for future reference, the RobotType
is not exactly the deck definition.
The OT-2 has one RobotType
("OT-2 Standard"
), but two possible deck definitions (ot2_standard
and ot2_short_trash
). The names are very confusing.
Tested ot OT-3: Smoke tested OT-2 as well. Works as expected! |
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.
Ah, yep. Fix makes sense to me. Nice catch.
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.
LGTM! 🙌
Overview
closes https://opentrons.atlassian.net/browse/RSS-294 -> enable
deck_conflict
checker for the flex..closes https://opentrons.atlassian.net/browse/RSS-273 -> fixes bug when loading a thermocycler in slots that are not allowed.
closes https://opentrons.atlassian.net/browse/RQA-993 -> does not allow loading mag deck's on an OT-3. just mag blocks.
Test Plan
Changelog
deck_conflict.check
to get DeckSlotName for the new location and and existing location instead of int.robot_type
arg inorder to know what restrictions to load.Review requests
Changes make sense? Did I forget anything?
Risk assessment
Medium. need to smoke test OT-2 protocols both json on python for all version (We care about) to make sure loading labware/modules on deck has been affected. need to test OT-3 protocols and to make sure
load_module
is raising an exception for the restrictions in the ticket.