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(protocol-engine): Add tryLiquidProbe to complement liquidProbe #15667

Merged
merged 10 commits into from
Jul 17, 2024

Conversation

SyntaxColoring
Copy link
Contributor

@SyntaxColoring SyntaxColoring commented Jul 15, 2024

Overview

This goes towards EXEC-598. See that ticket for background on the problem.

In v8.0.0, we think the only place this problem can happen is the liquidProbe command. InstrumentContext.detect_liquid_presence() wants to catch liquidProbe errors and turn them into False returns.

Instead of making that kind of try/except possible in general, we're solving it here specifically for liquidProbe commands by just having a second liquidProbe variant, tryLiquidProbe, that returns a result with z_position=null instead of returning an error. In other words, it's a variant of liquidProbe where liquidNotFound errors do not enter recovery mode. This is consistent with the verifyTipPresence/getTipPresence approach, and it's potentially useful for JSON protocols.

Test plan

Just unit tests, so far. Follow-up work will wire this up to opentrons.protocol_api and then we can test it through that.

Changelog

Add a tryLiquidProbe command, as described above.

To do:

Review requests

See inline notes.

Risk assessment

To do.

To do

@SyntaxColoring SyntaxColoring changed the title Second probe command feat(protocol-engine): Add tryLiquidProbe to complement liquidProbe Jul 15, 2024
@SyntaxColoring SyntaxColoring marked this pull request as ready for review July 15, 2024 21:13
@SyntaxColoring SyntaxColoring requested review from a team as code owners July 15, 2024 21:13
@SyntaxColoring SyntaxColoring requested review from a team July 15, 2024 21:14
Merging for analysis snapshot test updates.
@Opentrons Opentrons deleted a comment from github-actions bot Jul 15, 2024
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.

TWO commands??? in the same file???

Comment on lines 37 to +38
LiquidProbeCommandType = Literal["liquidProbe"]
TryLiquidProbeCommandType = Literal["tryLiquidProbe"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The names liquidProbe/tryLiquidProbe are inconsistent with verifyTipPresence/getTipPresence. I really don't know what to do about this at this point, since it seems like it'd be annoying to rename liquidProbe, but I'm open to ideas.

Copy link
Member

Choose a reason for hiding this comment

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

Would it be annoying? I don't think anybody uses it right now. I think we could do either

  • VerifyLiquidPresence/GetLiquidPresence, if we want to add a distinct command for get liquid height
  • If we don't want to change LiquidProbe, VerifyLiquidPresence seems like a good standalone command name honestly. Probably would want its own file though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm updating schema 8 in-place because I guess we've been doing that. But I think officially, we're supposed to be doing new stuff in a new schema 9.

One purpose of putting new stuff in new schemas is that the server can reject JSON protocols that are too new for it, efficiently and with a helpful error message, like we do for Python protocols. But that only works if we remember to put new stuff in new schemas, and I guess we haven't remembered, oops.

I'm happy to do whatever here. I'm uncertain whether we want to keep trying the separate-schema thing or just give up on it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. I'm honestly not sure.

I think we hoped to put new commands or at least new patterns of command params in new schemas; so far we definitely haven't. I think it would be nice to start doing it again but I also think on some level we want to avoid having weird update races... I'm interested in @jerader 's opinion here.

@sfoster1
Copy link
Member

Re: state updates - this is implemented right now as essentially stateless, if I understand what you're getting at. We're not tracking anything from this and don't really need to until phase 2. I think whether we should do it right now or not really depends on your outlook about state: is it for inputs for future commands, or is it for outside inspection? Nothing really looks at a possible liquid-verified state, so does it need to exist?

@SyntaxColoring
Copy link
Contributor Author

SyntaxColoring commented Jul 16, 2024

Re: state updates

Sorry, I was totally unclear about this. I'm thinking of the "current well" state used for path planning. These commands might leave the pipette in a new well and I think they need to update state to reflect that.

Resolve conflicts in:
* api/src/opentrons/protocol_engine/commands/liquid_probe.py
* api/tests/opentrons/protocol_engine/commands/test_liquid_probe.py
This is necessary because PAPI, for convenience, maps param types to command requests and expects that mapping to be 1:1. Hoisted by my own petard. :(
@SyntaxColoring SyntaxColoring merged commit 8c1f5ed into edge Jul 17, 2024
55 checks passed
@SyntaxColoring SyntaxColoring deleted the second_probe_command branch July 17, 2024 15:24
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.

2 participants