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

feat(api): Implement define_liquid and load_liquid in PAPI #11920

Merged
merged 70 commits into from
Jan 27, 2023

Conversation

TamarZanzouri
Copy link
Contributor

@TamarZanzouri TamarZanzouri commented Dec 21, 2022

Overview

closes https://opentrons.atlassian.net/browse/RLIQ-7.
Add a define_liquid and load_liquid in PAPI.

Test Plan

  • Test against an OT-2\OT-3 with core ff on.
  • Upload a python protocol to test against PAPI.
from opentrons import protocol_api, types

metadata = {
    "apiLevel": "2.13",
}

def run(ctx: protocol_api.ProtocolContext) -> None:
    labware = ctx.load_labware("nest_96_wellplate_100ul_pcr_full_skirt", 5)
    liquid = ctx.define_liquid(name="water", description="", display_color="#fff")
    well = labware.wells()[0]
    well.load_liquid(liquid=liquid, volume=20.0)
  • Make sure the robot analysis passes.
  • Test with ff off. Make sure you are getting an unsupported exception.

Changelog

  • added define_liquid to protocol_context and to protocol core's implementation.
  • added load_liquid to well_context and to well core's implementation.
  • added load_liquid to sync_client.
  • added add_liquid to sync_client.

Review requests

  1. did I miss anything?
  2. are test sufficient?

Risk assessment

Low. added a new end points in the PAPI to define_liquid and load_liquid.

@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #11920 (3194f3a) into edge (7d7839c) will not change coverage.
The diff coverage is 80.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             edge   #11920   +/-   ##
=======================================
  Coverage   74.00%   74.00%           
=======================================
  Files        2193     2193           
  Lines       60665    60665           
  Branches     6418     6418           
=======================================
  Hits        44894    44894           
  Misses      14236    14236           
  Partials     1535     1535           
Flag Coverage Δ
notify-server 89.13% <ø> (ø)

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

Impacted Files Coverage Δ
api/src/opentrons/protocol_api/__init__.py 100.00% <ø> (ø)
api/src/opentrons/protocol_api/protocol_context.py 91.37% <62.50%> (ø)
api/src/opentrons/protocol_api/labware.py 90.60% <66.66%> (ø)
...c/opentrons/protocol_engine/clients/sync_client.py 100.00% <100.00%> (ø)
...i/src/opentrons/protocol_engine/protocol_engine.py 100.00% <100.00%> (ø)
...i/src/opentrons/protocol_runner/protocol_runner.py 100.00% <100.00%> (ø)
... and 1 more

@TamarZanzouri TamarZanzouri added the robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience). label Jan 13, 2023
@TamarZanzouri TamarZanzouri changed the title Rliq 7 papi load liquid feature(api): Implement add_liquid and load_liquid in PAPI Jan 13, 2023
@mcous mcous changed the title feature(api): Implement add_liquid and load_liquid in PAPI feat(api): Implement add_liquid and load_liquid in PAPI Jan 13, 2023
@TamarZanzouri
Copy link
Contributor Author

Tested on OT-2 with core ff on. tested json/python protocols. works as expected.

Copy link
Contributor

@ecormany ecormany left a comment

Choose a reason for hiding this comment

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

Couple comments on docstrings including 1 typo.

api/src/opentrons/protocol_api/labware.py Outdated Show resolved Hide resolved
Comment on lines 298 to 316
def add_liquid(
self,
name: str,
color: Optional[str] = None,
description: str = "",
id: Optional[str] = None,
) -> Liquid:
"""Add a liquid to the state for subsequent liquid loads."""
self._action_dispatcher.dispatch(AddLiquidAction(liquid=liquid))
if id is None:
id = self._model_utils.generate_id()
self._action_dispatcher.dispatch(
AddLiquidAction(id=id, name=name, color=color, description=description)
)
return Liquid(
id=id,
displayName=name,
description=description,
displayColor=HexColor(__root__=color) if color else None,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain this change?

It looks like we're constructing a Liquid in the exact same way here, in LiquidStore, and in ProtocolRunner. Why shouldn't AddLiquidAction continue to take an already-constructed Liquid?

Copy link
Contributor

@ecormany ecormany left a comment

Choose a reason for hiding this comment

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

Just a couple docstring typos.

api/src/opentrons/protocol_api/_liquid.py Outdated Show resolved Hide resolved
api/src/opentrons/protocol_api/protocol_context.py Outdated Show resolved Hide resolved
@ecormany ecormany dismissed their stale review January 26, 2023 16:14

Docstrings all fixed now!

@mcous mcous changed the title feat(api): Implement add_liquid and load_liquid in PAPI feat(api): Implement define_liquid and load_liquid in PAPI Jan 27, 2023
@TamarZanzouri
Copy link
Contributor Author

Tested on dev server with core ff on, python protocols and json protocols. works as expected!

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants