-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api, robot-server): use runtime parameter files set in protocols…
… and runs to set in-protocol values (#15855) # Overview Closes AUTH-419. This PR hooks up the setting of runtime parameter files in the POST `/runs`, `/protocols` and `/protocols/{protocolId}/analyses` to the actual `CSVParameter` object used in the protocol context. This file is sent via a dictionary of parameter name and file-id, so we resolve the file-id into a `Path` by using the `data_files_directory` and `data_files_store`. This is then passed to the `ParameterContext` and used to open up a temporary file that contains the contents of the actual file stored on the robot. ## Test Plan and Hands on Testing Tested end to end via the following protocol and two CSV files ``` metadata = { 'protocolName': 'CSV End to End Test', } requirements = { "robotType": "Flex", "apiLevel": "2.18" } def add_parameters(parameters): parameters.add_str( display_name="Pipette Name", variable_name="pipette", choices=[ {"display_name": "Single channel 50µL", "value": "flex_1channel_50"}, {"display_name": "Single channel 1000µL", "value": "flex_1channel_1000"}, {"display_name": "Eight Channel 50µL", "value": "flex_8channel_50"}, {"display_name": "Eight Channel 1000µL", "value": "flex_8channel_1000"}, ], default="flex_1channel_50", description="What pipette to use during the protocol.", ) parameters.add_csv_file( display_name="CSV Data", variable_name="csv_data", description="CSV file containing labware and volume information." ) def run(context): PIPETTE_NAME = context.params.pipette trash_bin = context.load_trash_bin('A3') tip_rack = context.load_labware('opentrons_flex_96_tiprack_50ul', 'D2') pipette = context.load_instrument(PIPETTE_NAME, mount="left", tip_racks=[tip_rack]) csv_file_data = context.params.csv_data.parse_as_csv() labware_name = csv_file_data[1][0].strip() location = csv_file_data[1][1].strip() volume = float(csv_file_data[1][2]) labware = context.load_labware(labware_name, location) pipette.pick_up_tip() pipette.aspirate(volume, labware.wells()[0].top()) pipette.dispense(volume, labware.wells()[1].top()) pipette.drop_tip() ``` ``` Labware Name, Location, Volume opentrons_96_wellplate_200ul_pcr_full_skirt, C1, 20 ``` ``` Labware Name, Location, Volume nest_96_wellplate_100ul_pcr_full_skirt, C2, 30 ``` ## Changelog - Resolve `runTimeParameterFiles` into a dictionary of `Paths` - pass the `run_time_param_paths` all the way to the `ParameterContext` where they can be opened as temporary file handlers - close the file handlers upon protocol end - Allow importing of `CSVParameter` from the `protocol_api` namespace. ## Review requests ## Risk assessment Medium. --------- Co-authored-by: Sanniti <[email protected]>
- Loading branch information
Showing
28 changed files
with
363 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.