From f36f095305c594ccf3fad6ad8a948d4bf6628d4b Mon Sep 17 00:00:00 2001 From: Mike Cousins Date: Tue, 3 Dec 2019 16:47:51 -0500 Subject: [PATCH] fix(rpc): ensure load name is attached to RPC "containers" --- api/src/opentrons/api/models.py | 5 ++++- api/src/opentrons/protocol_api/labware.py | 6 ++++++ app/src/robot/api-client/client.js | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/api/src/opentrons/api/models.py b/api/src/opentrons/api/models.py index 50ff3a86f74..a3b22d3db46 100755 --- a/api/src/opentrons/api/models.py +++ b/api/src/opentrons/api/models.py @@ -32,12 +32,15 @@ def __init__(self, container, instruments=None, context=None): self.is_legacy = container.properties.get( 'labware_hash') is None else: + # will be labware's load name or label self.name = container.name - self.type = container.name + # type must be load_name so client can load correct definition + self.type = container.load_name slot, position = _get_parent_slot_and_position(container) self.slot = slot self.position = position self.is_legacy = False + self.is_tiprack = container.is_tiprack self.instruments = [ Instrument(instrument) for instrument in instruments] diff --git a/api/src/opentrons/protocol_api/labware.py b/api/src/opentrons/protocol_api/labware.py index ebadbd59867..ae997b781d7 100644 --- a/api/src/opentrons/protocol_api/labware.py +++ b/api/src/opentrons/protocol_api/labware.py @@ -376,6 +376,12 @@ def name(self, new_name): """ Set the labware name""" self._name = new_name + @property # type: ignore + @requires_version(2, 0) + def load_name(self) -> str: + """ The API load name of the labware definition """ + return self._parameters['loadName'] + @property # type: ignore @requires_version(2, 0) def parameters(self) -> Dict[str, Any]: diff --git a/app/src/robot/api-client/client.js b/app/src/robot/api-client/client.js index 5413445ba08..1fb2451ae4c 100755 --- a/app/src/robot/api-client/client.js +++ b/app/src/robot/api-client/client.js @@ -23,7 +23,7 @@ import { getCustomLabwareDefinitions } from '../../custom-labware/selectors' const RUN_TIME_TICK_INTERVAL_MS = 1000 const NO_INTERVAL = -1 const RE_VOLUME = /.*?(\d+).*?/ -const RE_TIPRACK = /tiprack/i +const RE_TIPRACK = /tip ?rack/i const THIS_ROBOT_DOES_NOT_SUPPORT_BUNDLES = 'This robot does not support ZIP protocol bundles. Please update its software to the latest version and upload this protocol again' @@ -573,7 +573,11 @@ export default function client(dispatch) { position, is_legacy: isLegacy, } = apiContainer - const isTiprack = RE_TIPRACK.test(type) + const isTiprack = + apiContainer.is_tiprack != null + ? apiContainer.is_tiprack + : RE_TIPRACK.test(type) + const labware = { _id, name, slot, position, type, isTiprack, isLegacy } if (isTiprack && apiContainer.instruments.length > 0) {