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-designer): load_trash_bin and load_waste_chute for Flex #17632

Merged
merged 4 commits into from
Mar 3, 2025

Conversation

jerader
Copy link
Collaborator

@jerader jerader commented Mar 3, 2025

closes AUTH-1510

Overview

1st, this PR creates the pythonName for trash bins and waste chutes in the additional equipment entities when they're created from create_deck_fixture redux action and the reducer

2nd, this PR emits load_trash_bin and load_waste_chute for exporting python for Flex protocols (since OT-2 has fixed trash always available - see https://docs.opentrons.com/v2/new_protocol_api.html?highlight=waste#opentrons.protocol_api.ProtocolContext.fixed_trash)

NOTE: this already supports multiple trash bins even though we do not support selecting multiple trash bins in the UI yet.

Test Plan and Hands on Testing

Test creating a trash bin and waste chute for a flex and observe the python protocol generated, should include the load commands for trash bin and waste chute. then test creating an ot-2 protocol and see that there is no trash bin command generated

Changelog

  • create getLoadTrashBin and getLoadWasteChute and wire up for flex protocols, generate based off of trash bin and waste chute entities created

Risk assessment

low, behind ff

@jerader jerader requested a review from a team as a code owner March 3, 2025 16:59
@jerader jerader requested a review from ddcc4 March 3, 2025 17:00
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 30 lines in your changes missing coverage. Please review.

Project coverage is 25.71%. Comparing base (7d35e6f) to head (5ff2d8d).
Report is 7 commits behind head on edge.

Files with missing lines Patch % Lines
protocol-designer/src/step-forms/reducers/index.ts 0.00% 22 Missing ⚠️
protocol-designer/src/utils/index.ts 12.50% 7 Missing ⚠️
...col-designer/src/file-data/selectors/pythonFile.ts 97.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #17632      +/-   ##
==========================================
+ Coverage   25.68%   25.71%   +0.03%     
==========================================
  Files        2850     2850              
  Lines      219210   219387     +177     
  Branches    17955    18045      +90     
==========================================
+ Hits        56300    56412     +112     
- Misses     162895   162960      +65     
  Partials       15       15              
Flag Coverage Δ
protocol-designer 18.98% <58.33%> (+0.04%) ⬆️
step-generation 4.38% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...ol-designer/src/file-data/selectors/fileCreator.ts 84.27% <100.00%> (+0.06%) ⬆️
step-generation/src/types.ts 100.00% <ø> (ø)
...col-designer/src/file-data/selectors/pythonFile.ts 99.37% <97.50%> (-0.63%) ⬇️
protocol-designer/src/utils/index.ts 49.35% <12.50%> (-1.32%) ⬇️
protocol-designer/src/step-forms/reducers/index.ts 55.37% <0.00%> (-0.64%) ⬇️

... and 6 files with indirect coverage changes

Copy link
Contributor

@ddcc4 ddcc4 left a comment

Choose a reason for hiding this comment

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

Thanks! Some small comments:

trashBin.location != null
? formatPyStr(getCutoutDisplayName(trashBin.location as CutoutId))
: 'unknown trash location' // note: should never hit unknown trash location since location is always defined for trashBin entity
return `${trashBin.pythonName} = ${PROTOCOL_CONTEXT_NAME}.load_trash_bin(location = ${location})`
Copy link
Contributor

@ddcc4 ddcc4 Mar 3, 2025

Choose a reason for hiding this comment

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

Nit: close up the space around location = . Python style guides don't put a space for named function call arguments.

getLoadTrashBins(additionalEquipmentEntities),
getLoadWasteChute(additionalEquipmentEntities),
]
: []),
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 move this above the load_liquid block of code to group this with the other hardware-loading commands?

trashBin.location != null
? formatPyStr(getCutoutDisplayName(trashBin.location as CutoutId))
: 'unknown trash location' // note: should never hit unknown trash location since location is always defined for trashBin entity
return `${trashBin.pythonName} = ${PROTOCOL_CONTEXT_NAME}.load_trash_bin(location = ${location})`
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, you can just take out the location = altogether. The convention I've been following is, if the Python argument is mandatory and there's no ambiguity on what it means, leave out the argument name. If it's optional, then include the argument name. This makes the code a bit cleaner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops yes, i forgot. i remember you mentioned this on a previous pr. sorry, will fix this!

Copy link
Contributor

@ddcc4 ddcc4 left a comment

Choose a reason for hiding this comment

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

Cool. I tried it in a branch, and this looks good.

@jerader jerader merged commit dc4a61c into edge Mar 3, 2025
17 checks passed
@jerader jerader deleted the pd_generate-trash-waste branch March 3, 2025 19:40
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