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

fix(api): allow volume 0 commands in engine #14211

Merged
merged 7 commits into from
Dec 18, 2023

Conversation

DerekMaggio
Copy link
Contributor

@DerekMaggio DerekMaggio commented Dec 15, 2023

A previous PR (12a630b / #13989 ) changed the python protocol api in version 2.16 to allow commanding 0ul liquid handling commands like aspirate, mix, and dispense. This is useful in programmatic protocols that read out volumes to handle; they can now handle 0 volume properly. In 2.15 and previous, specifying 0 would lead to those commands doing the most volume they could (i.e. aspirate the full tip volume, dispense whatever's currently in the pipette, mix at full volume) and this likely was an unintentional side effect because of python truthiness.

However, that change only touched the python protocol API; that API would emit commands to the engine that specified 0 volume, and those were not allowed: the pydantic models for the commands and responses required strictly greater than 0 volume.

This PR

  • changes the pydantic models and updates the schema to allow 0ul commands
  • adds a python protocol to be an integration test
  • adds unit tests for the python protocol api aspirate and dispense commands

@DerekMaggio DerekMaggio changed the base branch from edge to chore_release-7.1.0 December 15, 2023 14:39
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #14211 (222a496) into chore_release-7.1.0 (a7d1187) will decrease coverage by 0.07%.
Report is 15 commits behind head on chore_release-7.1.0.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           chore_release-7.1.0   #14211      +/-   ##
=======================================================
- Coverage                70.42%   70.35%   -0.07%     
=======================================================
  Files                     2512     1636     -876     
  Lines                    71296    54547   -16749     
  Branches                  9006     4050    -4956     
=======================================================
- Hits                     50212    38379   -11833     
+ Misses                   18879    15469    -3410     
+ Partials                  2205      699    -1506     
Flag Coverage Δ
app 37.88% <ø> (-29.74%) ⬇️
g-code-testing 96.44% <ø> (ø)
notify-server 89.13% <ø> (ø)
protocol-designer 44.97% <ø> (-0.04%) ⬇️
shared-data 75.04% <ø> (ø)
step-generation 86.84% <ø> (ø)

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

Files Coverage Δ
...trons/protocol_engine/commands/pipetting_common.py 100.00% <ø> (ø)

... and 878 files with indirect coverage changes

@sfoster1 sfoster1 marked this pull request as ready for review December 18, 2023 16:08
@sfoster1 sfoster1 requested review from a team as code owners December 18, 2023 16:08
@sfoster1 sfoster1 changed the title Fix volume 0 commands fix(api): allow volume 0 commands in engine Dec 18, 2023
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.

Tested with this protocol. Works as expected. Thank you!

requirements = {"apiLevel": "2.16", "robotType": "Flex"}


def run(protocol):
    tip_rack = protocol.load_labware("opentrons_flex_96_tiprack_1000ul", "D1")
    well_plate_1 = protocol.load_labware(
        "opentrons_96_wellplate_200ul_pcr_full_skirt", "D2"
    )
    well_plate_2 = protocol.load_labware(
        "opentrons_96_wellplate_200ul_pcr_full_skirt", "C2"
    )
    pipette = protocol.load_instrument(
        "flex_1channel_1000", "left", tip_racks=[tip_rack]
    )

    pipette.pick_up_tip()

    protocol.comment(str(well_plate_1.wells()))

    for source, dest in zip(well_plate_1.wells(), well_plate_2.wells()):
        pipette.aspirate(0, source)
        pipette.dispense(0, dest)

    pipette.return_tip()

@sfoster1 sfoster1 merged commit 5a939ea into chore_release-7.1.0 Dec 18, 2023
60 checks passed
@sfoster1 sfoster1 deleted the fix-volume-0-commands branch December 18, 2023 17:22
ncdiehl11 pushed a commit that referenced this pull request Dec 20, 2023
A previous PR (12a630b / #13989 ) changed the python protocol api in version 2.16 to allow commanding 0ul liquid handling commands like aspirate, mix, and dispense. This is useful in programmatic protocols that read out volumes to handle; they can now handle 0 volume properly. In 2.15 and previous, specifying 0 would lead to those commands doing the most volume they could (i.e. aspirate the full tip volume, dispense whatever's currently in the pipette, mix at full volume) and this likely was an unintentional side effect because of python truthiness.

However, that change only touched the python protocol API; that API would emit commands to the engine that specified 0 volume, and those were not allowed: the pydantic models for the commands and responses required strictly greater than 0 volume.

This PR

- changes the pydantic models and updates the schema to allow 0ul commands
- adds a python protocol to be an integration test
- adds unit tests for the python protocol api aspirate and dispense commands



---------

Co-authored-by: Seth Foster <[email protected]>
Co-authored-by: Max Marrone <[email protected]>
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.

3 participants