-
Notifications
You must be signed in to change notification settings - Fork 184
feat(api): add keep_last_tip argument to liquid class transfer methods #18693
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
Conversation
"""Resolve the liquid class transfer argument `keep_last_tip` | ||
If set to a boolean value, maintains that setting. Otherwise, default to | ||
`True` if tip policy is `NEVER`, otherwise default to `False` |
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.
You might want to mention what the return value of this function means -- i.e., if this function returns True
, we are really keeping the last tip.
False | ||
if is_last_step and new_tip == TransferTipPolicyV2.NEVER | ||
else True | ||
False if is_last_step and keep_last_tip else True |
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.
So this is saying we never want to end the whole transfer with an air gap in the tip?
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.
Yup, because we want the tip to be empty if we are keeping it
@@ -1205,6 +1205,7 @@ def transfer_with_liquid_class( # noqa: C901 | |||
starting_tip: Optional[WellCore], | |||
trash_location: Union[Location, TrashBin, WasteChute], | |||
return_tip: bool, | |||
keep_last_tip: bool, |
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 keep_last_tip
is after you've resolved it, right?
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.
Yes, at this point it will either reflect the default or the user's intentions
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.
Requesting some changes to docstrings (which are :meta private:
in this branch, but will become public by the release of 8.5).
Also, regarding docstrings and versioning: is this param retconned into API level 2.23 along with the various _with_liquid_classes
, or should we call it out as added in 2.24?
:param keep_last_tip: If set to ``True``, do not drop or return the last tip used in the transfer. If set to | ||
``False``, the last tip will be dropped or returned. If not set, default depends on tip policy chosen. A | ||
tip policy of ``"never"`` will default to ``True``, all other tip policies will default to ``False``. |
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.
Prose suggestions below. Highest priority change is to use the term new_tip
(the public parameter name) instead of "tip policy" (an internal implementation name).
:param keep_last_tip: If set to ``True``, do not drop or return the last tip used in the transfer. If set to | |
``False``, the last tip will be dropped or returned. If not set, default depends on tip policy chosen. A | |
tip policy of ``"never"`` will default to ``True``, all other tip policies will default to ``False``. | |
:param keep_last_tip: When ``True``, the pipette keeps the last tip used in the transfer attached. When | |
``False``, the last tip will be dropped or returned. If not set, behavior depends on the value of ``new_tip``. | |
``new_tip="never"`` keeps the tip, and all other values of ``new_tip`` drop or return the tip. |
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.
And replicate any changes here in the other two functions, modulo action name (transfer/consolidate/distribute).
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.
tested with a protocol I made in PD with 3 steps: transfer, consolidate, and distribute. each with a new_tip:"once"
and keep_last_tip=True
with drop_tip()
s in between and passed 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.
New param docstrings look good. Broader things (unhiding docstrings, choosing a version decorator) can be done elsewhere.
OK, implementation looks fine. The issue of the public state vs internal state not knowing that the tip is still attached is a separate bug that we can fix afterwards. |
Overview
Closes AUTH-1996.
This PR adds a new argument
keep_last_tip
to three liquid class transfer functions (transfer_with_liquid_class
,consolidate_with_liquid_class
, anddistribute_with_liquid_class
). If this is set toTrue
, the last (or only tip fornever
andonce
) will not be dropped at the end of the high level transfer/consolidate/distribute. Otherwise, the last tip will be dropped, even if the tip policy isnever
.In order to maintain existing behavior, this new argument will actually default to
None
to represent it not being set. If the value isNone
, we will default tokeep_last_tip=False
for all tip policies EXCEPTnever
, which will default toTrue
. This preserves existing behavior and ensures that if not set, it continues to work as expect and if set, works in a logical and orthogonal way.Test Plan and Hands on Testing
Unit tests and integration tests should cover for any regressions, and the following protocol should work as described in the comments
Changelog
keep_last_tip
totransfer_with_liquid_class
,consolidate_with_liquid_class
, anddistribute_with_liquid_class
to control whether the last (or only) tip used is dropped at the endReview requests
Mostly name and doc string related suggestions.
Risk assessment
Low-medium, theres changes to all three liquid class functions but the scope is pretty small and the changes overall do not complicate the code.