Skip to content

Commit 782b2d0

Browse files
committed
Merge remote-tracking branch 'origin/chore_release-pd-8.5.0' into HEAD
2 parents 893aa2e + 01bbf7c commit 782b2d0

File tree

8 files changed

+66
-32
lines changed

8 files changed

+66
-32
lines changed

protocol-designer/src/file-data/__tests__/createFile.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ def run(protocol: protocol_api.ProtocolContext) -> None:
166166
location="1",
167167
label="Opentrons 96 Tip Rack 10 µL",
168168
namespace="opentrons",
169+
version=1,
169170
)
170171
mock_python_name_3 = protocol.load_labware(
171172
"fixture_96_plate",
172173
location="7",
173174
label="NEST 96 Well Plate 100 µL PCR Full Skirt",
174175
namespace="opentrons",
176+
version=1,
175177
)
176178
177179
# Load Pipettes:

protocol-designer/src/load-file/migration/utils/getMigrationPositionFromTop.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ export const getMigratedPositionFromTop = (
88
labware: Labware,
99
type: MoveLiquidPrefixType
1010
): number => {
11-
const labwareDefUri = labware[formLabwareId].labwareDefURI
12-
13-
if (labwareDefUri == null) {
14-
console.error(
15-
`unable to find matching labware def uri from form labware id ${formLabwareId}`
16-
)
17-
}
11+
const labwareDefUri = labware[formLabwareId]?.labwareDefURI
1812

1913
// early exit for dispense_labware equaling trashBin or wasteChute
2014
if (labwareDefsByURI[labwareDefUri] == null) {

protocol-designer/src/pages/Designer/utils.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,23 @@ const getLabwareInfo = (
250250
nicknamesById: Record<string, string>,
251251
activeDeckSetup: AllTemporalPropertiesForTimelineFrame,
252252
labwareId: string,
253-
robotType: RobotType
253+
robotType: RobotType,
254+
t: any
254255
): { nickName: string; latestSlot: string } => {
255-
const { modules, labware } = activeDeckSetup
256-
const stack = labware[labwareId].stack
257-
const latestSlot = resolveSlotLocation(modules, stack, robotType)
258-
259-
return { nickName: nicknamesById[labwareId], latestSlot }
256+
const { modules } = activeDeckSetup
257+
const stack = activeDeckSetup.labware[labwareId]?.stack
258+
const latestSlot =
259+
stack != null
260+
? resolveSlotLocation(modules, stack, robotType)
261+
: 'unknown slot'
262+
const name = nicknamesById[labwareId]
263+
let nickName: string = name
264+
if (latestSlot != null && latestSlot !== 'offDeck') {
265+
nickName = t('labware_in_slot', { name, slot: latestSlot })
266+
} else if (latestSlot != null && latestSlot === 'offDeck') {
267+
nickName = t('labware_offdeck', { name })
268+
}
269+
return { nickName, latestSlot }
260270
}
261271

262272
export const useLabwareDropdownOptions = (
@@ -277,7 +287,9 @@ export const useLabwareDropdownOptions = (
277287
labwareId: string
278288
): DropdownOption[] => {
279289
const { def } = labwareEntity
280-
const deckSlot = getSlotInLocationStack(deckSetupLabware[labwareId].stack)
290+
const deckSlot = getSlotInLocationStack(
291+
deckSetupLabware[labwareId]?.stack
292+
)
281293
const fullStackFromLabwares = getFullStackFromLabwares(
282294
deckSetupLabware,
283295
deckSlot
@@ -306,7 +318,8 @@ export const useLabwareDropdownOptions = (
306318
nicknamesById,
307319
activeDeckSetup,
308320
labwareId,
309-
robotType
321+
robotType,
322+
t
310323
)
311324
const isTiprack = getIsTiprack(def)
312325
const isFilterOffDeck =

step-generation/src/__tests__/pythonFileUtils.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '@opentrons/shared-data'
2020

2121
import {
22+
formatChangeTipArg,
2223
getDefineLiquids,
2324
getLoadAdapters,
2425
getLoadLabware,
@@ -226,6 +227,7 @@ describe('getLoadAdapters', () => {
226227
adapter_1 = magnetic_block_1.load_adapter(
227228
"fixture_flex_96_tiprack_adapter",
228229
namespace="opentrons",
230+
version=1,
229231
)
230232
adapter_2 = protocol.load_adapter_from_definition(
231233
CUSTOM_LABWARE["fixture/fixture_flex_96_tiprack_adapter/1"],
@@ -252,10 +254,12 @@ well_plate_1 = adapter_2.load_labware(
252254
label="reagent plate",
253255
namespace="opentrons",
254256
lid="mock_lid",
257+
version=1,
255258
)
256259
well_plate_2 = magnetic_block_2.load_labware(
257260
"fixture_96_plate",
258261
namespace="opentrons",
262+
version=1,
259263
)
260264
well_plate_3 = protocol.load_labware_from_definition(
261265
CUSTOM_LABWARE["fixture/fixture_96_plate/1"],
@@ -288,6 +292,7 @@ well_plate_5 = protocol.load_labware(
288292
"fixture_96_plate",
289293
location=protocol_api.OFF_DECK,
290294
namespace="opentrons",
295+
version=1,
291296
)`.trimStart()
292297
)
293298
})
@@ -580,3 +585,15 @@ glycerol_50_base_class = protocol.get_liquid_class("glycerol_50")`.trimStart()
580585
)
581586
})
582587
})
588+
589+
describe('formatChangeTipArg', () => {
590+
it('should transform perSource into per source', () => {
591+
expect(formatChangeTipArg('perSource')).toBe('per source')
592+
})
593+
it('should transform perDest into per destination', () => {
594+
expect(formatChangeTipArg('perDest')).toBe('per destination')
595+
})
596+
it('should not alter never', () => {
597+
expect(formatChangeTipArg('never')).toBe('never')
598+
})
599+
})

step-generation/src/commandCreators/compound/consolidate.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
curryCommandCreator,
2323
curryWithoutPython,
2424
DEST_WELL_BLOWOUT_DESTINATION,
25+
formatChangeTipArg,
2526
formatPyStr,
2627
getIsRetractSafeForAirGap,
2728
getIsSafePipetteMovement,
@@ -373,9 +374,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
373374
`dest=${
374375
pythonDestWells != null ? `[${pythonDestWells}]` : destTrashPipetteName
375376
}`,
376-
// TODO: fix bug where new_tip api arg does not allow
377-
// changeTip: always but PD does
378-
`new_tip=${formatPyStr(changeTip)}`,
377+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
379378
`trash_location=${trashPipetteName}`,
380379
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
381380
`keep_last_tip=True`,

step-generation/src/commandCreators/compound/distribute.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
curryCommandCreator,
2424
curryWithoutPython,
2525
DEST_WELL_BLOWOUT_DESTINATION,
26+
formatChangeTipArg,
2627
formatPyStr,
2728
getIsRetractSafeForAirGap,
2829
getIsSafePipetteMovement,
@@ -405,9 +406,7 @@ export const distribute: CommandCreator<DistributeArgs> = (
405406
`volume=${volume}`,
406407
`source=[${pythonSourceWells}]`,
407408
`dest=[${pythonDestWells ?? destTrashPipetteName}]`,
408-
// TODO: fix bug where new_tip api arg does not allow
409-
// changeTip: always but PD does
410-
`new_tip=${formatPyStr(changeTip)}`,
409+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
411410
`trash_location=${trashPipetteName}`,
412411
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
413412
`keep_last_tip=True`,

step-generation/src/commandCreators/compound/transfer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
curryCommandCreator,
2020
curryWithoutPython,
2121
DEST_WELL_BLOWOUT_DESTINATION,
22+
formatChangeTipArg,
2223
formatPyStr,
2324
getIsRetractSafeForAirGap,
2425
getSlotInLocationStack,
@@ -376,7 +377,7 @@ export const transfer: CommandCreator<TransferArgs> = (
376377
`dest=${
377378
pythonDestWells != null ? `[${pythonDestWells}]` : destTrashPipetteName
378379
}`,
379-
`new_tip=${formatPyStr(changeTip)}`,
380+
`new_tip=${formatPyStr(formatChangeTipArg(changeTip))}`,
380381
`trash_location=${trashPipetteName}`,
381382
...(pipetteSpecs.channels > 1 ? [`group_wells=False`] : []),
382383
`keep_last_tip=True`,

step-generation/src/utils/pythonFileUtils.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424

2525
import type { CutoutId, ProtocolFile, RobotType } from '@opentrons/shared-data'
2626
import type {
27+
ChangeTipOptions,
2728
InvariantContext,
2829
LabwareEntities,
2930
LabwareEntity,
@@ -114,7 +115,7 @@ export function getLoadAdapters(
114115
const pythonAdapters = Object.values(adapterEntities)
115116
.map(adapter => {
116117
const { id, def, pythonName } = adapter
117-
const { parameters, namespace } = def
118+
const { parameters, namespace, version } = def
118119
// 2nd item in stack is the slot the adapter is on
119120
const adapterSlot = labwareRobotState[id].stack[1]
120121
const onModule = moduleEntities[adapterSlot] != null
@@ -136,10 +137,7 @@ export function getLoadAdapters(
136137
`${formatPyStr(parameters.loadName)}`,
137138
...(locationArg ? [locationArg] : []),
138139
`namespace=${formatPyStr(namespace)}`,
139-
// NOTE: temporarily removing version number
140-
// until PD migrated labware defs to the latest version
141-
// upon re-import
142-
// `version=${version}`,
140+
`version=${version}`,
143141
].join(',\n')
144142
return (
145143
`${pythonName} = ${parentName}.load_adapter(\n` +
@@ -181,7 +179,7 @@ export function getLoadLabware(
181179
const pythonLabware = Object.values(labwareEntities)
182180
.map(labware => {
183181
const { id, def, pythonName } = labware
184-
const { metadata, parameters, namespace } = def
182+
const { metadata, parameters, namespace, version } = def
185183
const lidEntity = Object.values(lidEntities).find(
186184
lid => labwareRobotState[lid.id].stack[1] === id
187185
)
@@ -219,10 +217,7 @@ export function getLoadLabware(
219217
...(lidEntity != null
220218
? [`lid=${formatPyStr(lidEntity.def.parameters.loadName)}`]
221219
: []),
222-
// NOTE: temporarily removing version number
223-
// until PD migrated labware defs to the latest version
224-
// upon re-import
225-
// `version=${version}`,
220+
`version=${version}`,
226221
].join(',\n')
227222
return (
228223
`${pythonName} = ${parentName}.load_labware(\n` +
@@ -528,3 +523,17 @@ export function pythonCustomLabwareDict(
528523
return ''
529524
}
530525
}
526+
527+
export const formatChangeTipArg = (changeTip: ChangeTipOptions): string => {
528+
switch (changeTip) {
529+
case 'perDest': {
530+
return 'per destination'
531+
}
532+
case 'perSource': {
533+
return 'per source'
534+
}
535+
default: {
536+
return changeTip
537+
}
538+
}
539+
}

0 commit comments

Comments
 (0)