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, shared-data): raise error when using gripper in ot2 protocols #13208

Conversation

sanni-t
Copy link
Member

@sanni-t sanni-t commented Aug 1, 2023

Overview

Closes RSS-297

Test Plan

Check if an OT2 protocol fails analysis when there's a move_labware step using gripper.

Changelog

  • added new NotSupportedOnRobotType error
  • added the robot type check

Review requests

  • usual

Risk assessment

None.

@sanni-t sanni-t requested a review from a team as a code owner August 1, 2023 16:40
@sanni-t sanni-t requested review from ecormany and jbleon95 August 1, 2023 16:40
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.

Looks good to me!

@@ -120,6 +120,10 @@ async def execute(self, params: MoveLabwareParams) -> MoveLabwareResult:
)

if params.strategy == LabwareMovementStrategy.USING_GRIPPER:
if self._state_view.config.robot_type == "OT-2 Standard":
raise NotSupportedOnRobotType(
Copy link
Member

Choose a reason for hiding this comment

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

maybe add like "action": "gripper-move-labware" or something to details?

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between that and putting "Labware movement using a gripper is not supported on the OT2" in message?

Copy link
Member

Choose a reason for hiding this comment

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

nothing :) it's just nice to have both

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.

Can't use the estop error code for this, let's make a new one for hardware not supported

wrapping: Optional[Sequence[EnumeratedError]] = None,
) -> None:
"""Build a NotSupportedOnRobotType exception."""
super().__init__(ErrorCodes.E_STOP_ACTIVATED, message, details, wrapping)
Copy link
Member

Choose a reason for hiding this comment

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

Wait no this is not the right code for this. Let's add a 4000 series "not supported on hardware" error code in shared-data/errors/definitions/1.json, a python binding for the code, and maybe an exception in shared-data (don't necessarily need it if you're building a protocol engine exception instead) for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦🏻‍♀️ you can tell where I copy pasted that from.
Will make the changes

@sanni-t sanni-t requested a review from a team as a code owner August 1, 2023 19:21
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #13208 (9a00df6) into internal-release_0.14.0 (30c54da) will increase coverage by 0.45%.
Report is 2 commits behind head on internal-release_0.14.0.
The diff coverage is 100.00%.

Impacted file tree graph

@@                     Coverage Diff                     @@
##           internal-release_0.14.0   #13208      +/-   ##
===========================================================
+ Coverage                    72.14%   72.59%   +0.45%     
===========================================================
  Files                         1571     2391     +820     
  Lines                        51948    65968   +14020     
  Branches                      3281     7321    +4040     
===========================================================
+ Hits                         37476    47892   +10416     
- Misses                       13956    16328    +2372     
- Partials                       516     1748    +1232     
Flag Coverage Δ
app 71.31% <ø> (+27.46%) ⬆️
g-code-testing 96.44% <ø> (ø)
notify-server 89.13% <ø> (ø)
protocol-designer 47.30% <ø> (ø)
shared-data 78.92% <100.00%> (-0.10%) ⬇️
step-generation 87.18% <ø> (ø)

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

Files Changed Coverage Δ
...i/src/opentrons/protocol_engine/errors/__init__.py 100.00% <ø> (ø)
...src/opentrons/protocol_engine/errors/exceptions.py 100.00% <ø> (ø)
...-data/python/opentrons_shared_data/errors/codes.py 92.06% <100.00%> (+0.12%) ⬆️

... and 836 files with indirect coverage changes

@sanni-t sanni-t changed the title fix(api): raise error when using gripper in ot2 protocols fix(api, shared-data): raise error when using gripper in ot2 protocols Aug 1, 2023
Comment on lines +796 to +797
class NotSupportedOnRobotType(ProtocolEngineError):
"""Raised when attempting to perform an action that is not supported for the given robot type."""
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between HardwareNotSupportedError and NotSupportedOnRobotType?

Copy link
Member Author

Choose a reason for hiding this comment

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

HardwareNotSupportedError is raised after checking the specific hardware API type and will only be able to be checked when running on an actual robot (or emulator), while NotSupportedOnRobotType checks only the robot type specified for the particular protocol/ engine. Subtle difference but an analysis saying 'not supported on hardware' sounds kinda misleading.

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.

Great! Thank you!

@@ -120,6 +120,10 @@ async def execute(self, params: MoveLabwareParams) -> MoveLabwareResult:
)

if params.strategy == LabwareMovementStrategy.USING_GRIPPER:
if self._state_view.config.robot_type == "OT-2 Standard":
raise NotSupportedOnRobotType(
Copy link
Member

Choose a reason for hiding this comment

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

nothing :) it's just nice to have both

@sanni-t sanni-t merged commit 914c567 into internal-release_0.14.0 Aug 1, 2023
@sanni-t sanni-t deleted the RSS-297-raise-error-for-gripper-use-in-ot2-protocols branch July 30, 2024 16:21
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