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

refactor(api): Save full nozzle map configuration and update state store accordingly #14529

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

Laura-Danielle
Copy link
Contributor

Overview

To make a few operations easier in protocol engine, we will keep the nozzle map in state always. I will think about this further in RSS-443, but for now it should unblock other partial tip work.

Test Plan

General sanity check that partial tip still works and regular protocols operate as normal.

Changelog

  • Pull in full nozzle map from the pipette dict
  • Remove the back left/right values on the LoadedStaticPipetteData

Review requests

Check that I didn't miss anything to update.

Risk assessment

Low/medium. Currently not using this information anywhere aside from back left/right values which will remain the same. Tests only updated due to new helper function pulling in mock data.

@Laura-Danielle Laura-Danielle requested a review from a team as a code owner February 20, 2024 20:10
Copy link

codecov bot commented Feb 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (818292c) 67.78% compared to head (76d6846) 67.78%.
Report is 23 commits behind head on edge.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             edge   #14529   +/-   ##
=======================================
  Coverage   67.78%   67.78%           
=======================================
  Files        2517     2517           
  Lines       72043    72043           
  Branches     9274     9274           
=======================================
  Hits        48837    48837           
  Misses      20991    20991           
  Partials     2215     2215           
Flag Coverage Δ
g-code-testing 92.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...c/opentrons/protocol_engine/execution/equipment.py 100.00% <ø> (ø)
...pi/src/opentrons/protocol_engine/state/pipettes.py 100.00% <ø> (ø)

Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good as long as it has the right serializability - will this get persisted?

Comment on lines +175 to +177
self._state.nozzle_configuration_by_id[
private_result.pipette_id
] = config.nozzle_map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make nozzle_configuration_by_id values non-Optional now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @Laura-Danielle. We'll defer this change. Might want to leave a # TODO explaining what needs to happen, though.

@SyntaxColoring
Copy link
Contributor

This looks good as long as it has the right serializability - will this get persisted?

I think we're good. I'm not seeing any modification of Pydantic BaseModels here, so it doesn't look like any of this will be stored in the database.

Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet. Thanks!

We won't have a chance to test this on any robots for a bit. Your call whether you want to merge this before then. I'm not sure how much other stuff is blocked behind this.

Comment on lines +175 to +177
self._state.nozzle_configuration_by_id[
private_result.pipette_id
] = config.nozzle_map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @Laura-Danielle. We'll defer this change. Might want to leave a # TODO explaining what needs to happen, though.

Copy link
Member

@sanni-t sanni-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just the comment about better test assertions

Comment on lines 78 to +80
tip_configuration_lookup_table=result1.tip_configuration_lookup_table,
nominal_tip_overlap=result1.nominal_tip_overlap,
back_left_nozzle_offset=Point(x=-8.0, y=-22.0, z=-259.15),
front_right_nozzle_offset=Point(x=-8.0, y=-22.0, z=-259.15),
nozzle_map=result1.nozzle_map,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, just realizing these aren't great asserts. They're just comparing an item with itself; like result1.nozzle_map == result1.nozzle_map. We should check it against the actual expected nozzle map.

@@ -105,8 +100,7 @@ def test_configure_virtual_pipette_for_volume(
),
tip_configuration_lookup_table=result2.tip_configuration_lookup_table,
nominal_tip_overlap=result2.nominal_tip_overlap,
back_left_nozzle_offset=Point(x=-8.0, y=-22.0, z=-259.15),
front_right_nozzle_offset=Point(x=-8.0, y=-22.0, z=-259.15),
nozzle_map=result2.nozzle_map,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@Laura-Danielle Laura-Danielle merged commit c58db57 into edge Feb 22, 2024
22 checks passed
@Laura-Danielle Laura-Danielle deleted the RSS-441-update-nozzle-map-loadpip branch February 22, 2024 21:24
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
…ore accordingly (#14529)

To make a few operations easier in protocol engine, we will keep the
nozzle map in state always. I will think about this further in RSS-443,
but for now it should unblock other partial tip work.
Carlos-fernandez pushed a commit that referenced this pull request Jun 3, 2024
…ore accordingly (#14529)

To make a few operations easier in protocol engine, we will keep the
nozzle map in state always. I will think about this further in RSS-443,
but for now it should unblock other partial tip work.
SyntaxColoring added a commit that referenced this pull request Oct 10, 2024
`nozzle_map` cannot be `None` since #14529.
SyntaxColoring added a commit that referenced this pull request Oct 11, 2024
`nozzle_map` cannot be `None` since #14529.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants