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

chore_release-7.2.1 merge --ff-only to release #14667

Merged
merged 9 commits into from
Mar 19, 2024
13 changes: 13 additions & 0 deletions api/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ log][]. For a list of currently known issues, please see the [Opentrons issue tr

---

## Opentrons Robot Software Changes in 7.2.1

Welcome to the v7.2.1 release of the Opentrons robot software!

### Bug Fixes

- Fixed an issue where OT-2 tip length calibrations created before v4.1.0 would cause a "missing calibration data" error that you could only resolve by resetting calibration.
- Fixed collision prediction being too conservative in certain conditions on Flex, leading to errors even when collisions wouldn't take place.
- Flex now properly homes after an instrument collision.
- `opentrons_simulate` now outputs entries for commands that drop tips in the default trash container in protocols that specify Python API version 2.16 or newer.

---

## Opentrons Robot Software Changes in 7.2.0

Welcome to the v7.2.0 release of the Opentrons robot software!
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/calibration_storage/ot2/deck_attitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_robot_deck_attitude() -> Optional[v1.DeckCalibrationModel]:
pass
except (json.JSONDecodeError, ValidationError):
log.warning(
"Deck calibration is malformed. Please factory reset your calibrations."
"Deck calibration is malformed. Please factory reset your calibrations.",
exc_info=True,
)
pass
return None
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def get_pipette_offset(
return None
except (json.JSONDecodeError, ValidationError):
log.warning(
f"Malformed calibrations for {pipette_id} on {mount}. Please factory reset your calibrations."
f"Malformed calibrations for {pipette_id} on {mount}. Please factory reset your calibrations.",
exc_info=True,
)
# TODO: Delete the bad calibration here maybe?
return None
Expand Down
49 changes: 32 additions & 17 deletions api/src/opentrons/calibration_storage/ot2/tip_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,43 @@ def _convert_tip_length_model_to_dict(
def tip_lengths_for_pipette(
pipette_id: str,
) -> typing.Dict[LabwareUri, v1.TipLengthModel]:
tip_lengths = {}
try:
tip_length_filepath = config.get_tip_length_cal_path() / f"{pipette_id}.json"
all_tip_lengths_for_pipette = io.read_cal_file(tip_length_filepath)
for tiprack_identifier, data in all_tip_lengths_for_pipette.items():
# We normally key these calibrations by their tip rack URI,
# but older software had them keyed by their tip rack hash.
# Migrate from the old format, if necessary.
if "/" not in tiprack_identifier:
data["definitionHash"] = tiprack_identifier
tiprack_identifier = data.pop("uri")
try:
tip_lengths[LabwareUri(tiprack_identifier)] = v1.TipLengthModel(**data)
except (json.JSONDecodeError, ValidationError):
log.warning(
f"Tip length calibration is malformed for {tiprack_identifier} on {pipette_id}"
)
pass
return tip_lengths
except FileNotFoundError:
log.debug(f"Tip length calibrations not found for {pipette_id}")
return tip_lengths
return {}
except json.JSONDecodeError:
log.warning(
f"Tip length calibration is malformed for {pipette_id}", exc_info=True
)
return {}

tip_lengths: typing.Dict[LabwareUri, v1.TipLengthModel] = {}

for tiprack_identifier, data in all_tip_lengths_for_pipette.items():
# We normally key these calibrations by their tip rack URI,
# but older software had them keyed by their tip rack hash.
# Migrate from the old format, if necessary.
tiprack_identifier_is_uri = "/" in tiprack_identifier
if not tiprack_identifier_is_uri:
data["definitionHash"] = tiprack_identifier
uri = data.pop("uri", None)
if uri is None:
# We don't have a way to migrate old records without a URI,
# so skip over them.
continue
else:
tiprack_identifier = uri

try:
tip_lengths[LabwareUri(tiprack_identifier)] = v1.TipLengthModel(**data)
except ValidationError:
log.warning(
f"Tip length calibration is malformed for {tiprack_identifier} on {pipette_id}",
exc_info=True,
)
return tip_lengths


def load_tip_length_calibration(
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/calibration_storage/ot3/deck_attitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_robot_belt_attitude() -> Optional[v1.BeltCalibrationModel]:
pass
except (json.JSONDecodeError, ValidationError):
log.warning(
"Belt calibration is malformed. Please factory reset your calibrations."
"Belt calibration is malformed. Please factory reset your calibrations.",
exc_info=True,
)
pass
return None
6 changes: 4 additions & 2 deletions api/src/opentrons/calibration_storage/ot3/module_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def get_module_offset(
return None
except (json.JSONDecodeError, ValidationError):
log.warning(
f"Malformed calibrations for {module_id} on slot {slot}. Please factory reset your calibrations."
f"Malformed calibrations for {module_id} on slot {slot}. Please factory reset your calibrations.",
exc_info=True,
)
return None

Expand All @@ -130,7 +131,8 @@ def load_all_module_offsets() -> List[v1.ModuleOffsetModel]:
)
except (json.JSONDecodeError, ValidationError):
log.warning(
f"Malformed module calibrations for {file}. Please factory reset your calibrations."
f"Malformed module calibrations for {file}. Please factory reset your calibrations.",
exc_info=True,
)
continue
return calibrations
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def get_pipette_offset(
return None
except (json.JSONDecodeError, ValidationError):
log.warning(
f"Malformed calibrations for {pipette_id} on {mount}. Please factory reset your calibrations."
f"Malformed calibrations for {pipette_id} on {mount}. Please factory reset your calibrations.",
exc_info=True,
)
return None
2 changes: 1 addition & 1 deletion api/src/opentrons/config/robot_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _load_json(filename: Union[str, Path]) -> Dict[str, Any]:
log.warning("{0} not found. Loading defaults".format(filename))
res = {}
except json.decoder.JSONDecodeError:
log.warning("{0} is corrupt. Loading defaults".format(filename))
log.warning("{0} is corrupt. Loading defaults".format(filename), exc_info=True)
res = {}
return cast(Dict[str, Any], res)

Expand Down
22 changes: 6 additions & 16 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
pipette_load_name_conversions as pipette_load_name,
)
from opentrons_shared_data.robot.dev_types import RobotType
from opentrons_shared_data.errors.exceptions import (
StallOrCollisionDetectedError,
)

from opentrons import types as top_types
from opentrons.config import robot_configs
Expand Down Expand Up @@ -1531,19 +1528,12 @@ async def _home_axis(self, axis: Axis) -> None:
axis_home_dist = 20.0
if origin[axis] - target_pos[axis] > axis_home_dist:
target_pos[axis] += axis_home_dist
try:
await self._backend.move(
origin,
target_pos,
speed=400,
stop_condition=HWStopCondition.none,
)
except StallOrCollisionDetectedError:
self._log.warning(
f"Stall on {axis} during fast home, encoder may have missed an overflow"
)
await self.refresh_positions()

await self._backend.move(
origin,
target_pos,
speed=400,
stop_condition=HWStopCondition.none,
)
await self._backend.home([axis], self.gantry_load)
else:
# both stepper and encoder positions are invalid, must home
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ def __init__(self, message: str) -> None:
x=A12_column_back_right_bound.x - _NOZZLE_PITCH * 11, y=506.2
)

# Arbitrary safety margin in z-direction
Z_SAFETY_MARGIN = 10

_FLEX_TC_LID_BACK_LEFT_PT = Point(
x=FLEX_TC_LID_COLLISION_ZONE["back_left"]["x"],
y=FLEX_TC_LID_COLLISION_ZONE["back_left"]["y"],
Expand Down Expand Up @@ -333,7 +330,7 @@ def _slot_has_potential_colliding_object(
slot_highest_z = engine_state.geometry.get_highest_z_in_slot(
StagingSlotLocation(slotName=surrounding_slot)
)
return slot_highest_z + Z_SAFETY_MARGIN > pipette_bounds[0].z
return slot_highest_z >= pipette_bounds[0].z
return False


Expand Down
15 changes: 12 additions & 3 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,16 @@ def drop_tip(
if isinstance(trash_container, labware.Labware):
well = trash_container.wells()[0]
else: # implicit drop tip in disposal location, not well
self._core.drop_tip_in_disposal_location(
trash_container, home_after=home_after
)
with publisher.publish_context(
broker=self.broker,
command=cmds.drop_tip_in_disposal_location(
instrument=self, location=trash_container
),
):
self._core.drop_tip_in_disposal_location(
trash_container,
home_after=home_after,
)
self._last_tip_picked_up_from = None
return self

Expand Down Expand Up @@ -1103,6 +1110,7 @@ def home_plunger(self) -> InstrumentContext:
self._core.home_plunger()
return self

# TODO (spp, 2024-03-08): verify if ok to & change source & dest types to AdvancedLiquidHandling
@publisher.publish(command=cmds.distribute)
@requires_version(2, 0)
def distribute(
Expand Down Expand Up @@ -1142,6 +1150,7 @@ def distribute(

return self.transfer(volume, source, dest, **kwargs)

# TODO (spp, 2024-03-08): verify if ok to & change source & dest types to AdvancedLiquidHandling
@publisher.publish(command=cmds.consolidate)
@requires_version(2, 0)
def consolidate(
Expand Down
28 changes: 28 additions & 0 deletions api/tests/opentrons/calibration_storage/test_tip_length_ot2.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,31 @@ def test_delete_all_tip_calibration(starting_calibration_data: Any) -> None:
clear_tip_length_calibration()
assert tip_lengths_for_pipette("pip1") == {}
assert tip_lengths_for_pipette("pip2") == {}


def test_uriless_calibrations_are_dropped(ot_config_tempdir: object) -> None:
"""Legacy records without a `uri` field should be silently ignored."""

data = {
"ed323db6ca1ddf197aeb20667c1a7a91c89cfb2f931f45079d483928da056812": {
"tipLength": 123,
"lastModified": "2021-01-11T00:34:29.291073+00:00",
"source": "user",
"status": {"markedBad": False},
},
"130e17bb7b2f0c0472dcc01c1ff6f600ca1a6f9f86a90982df56c4bf43776824": {
"tipLength": 456,
"lastModified": "2021-05-12T22:16:14.249567+00:00",
"source": "user",
"status": {"markedBad": False},
"uri": "opentrons/opentrons_96_filtertiprack_200ul/1",
},
}

io.save_to_file(config.get_tip_length_cal_path(), "pipette1234", data)
result = tip_lengths_for_pipette("pipette1234")
assert len(result) == 1
assert (
result[LabwareUri("opentrons/opentrons_96_filtertiprack_200ul/1")].tipLength
== 456
)
11 changes: 11 additions & 0 deletions api/tests/opentrons/data/ot2_drop_tip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from opentrons import protocol_api

requirements = {"robotType": "OT-2", "apiLevel": "2.16"}


def run(ctx: protocol_api.ProtocolContext) -> None:
tipracks = [ctx.load_labware("opentrons_96_tiprack_300ul", "5")]
m300 = ctx.load_instrument("p300_multi_gen2", "right", tipracks)

m300.pick_up_tip()
m300.drop_tip()
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,36 @@ def test_deck_conflicts_for_96_ch_a12_column_configuration() -> None:
instrument.dispense(50, accessible_plate.wells_by_name()["A1"])


@pytest.mark.ot3_only
def test_close_shave_deck_conflicts_for_96_ch_a12_column_configuration() -> None:
"""Shouldn't raise errors for "almost collision"s."""
protocol_context = simulate.get_protocol_api(version="2.16", robot_type="Flex")
res12 = protocol_context.load_labware("nest_12_reservoir_15ml", "C3")

# Mag block and tiprack adapter are very close to the destination reservoir labware
protocol_context.load_module("magneticBlockV1", "D2")
protocol_context.load_labware(
"opentrons_flex_96_tiprack_200ul",
"B3",
adapter="opentrons_flex_96_tiprack_adapter",
)
tiprack_8 = protocol_context.load_labware("opentrons_flex_96_tiprack_200ul", "B2")
hs = protocol_context.load_module("heaterShakerModuleV1", "D1")
hs_adapter = hs.load_adapter("opentrons_96_deep_well_adapter")
deepwell = hs_adapter.load_labware("nest_96_wellplate_2ml_deep")
protocol_context.load_trash_bin("A3")
p1000_96 = protocol_context.load_instrument("flex_96channel_1000")
p1000_96.configure_nozzle_layout(style=COLUMN, start="A12", tip_racks=[tiprack_8])

hs.close_labware_latch() # type: ignore[union-attr]
p1000_96.distribute(
15,
res12.wells()[0],
deepwell.rows()[0],
disposal_vol=0,
)


@pytest.mark.ot3_only
def test_deck_conflicts_for_96_ch_a1_column_configuration() -> None:
"""It should raise errors for expected deck conflicts."""
Expand Down
7 changes: 7 additions & 0 deletions api/tests/opentrons/test_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def test_simulate_without_filename(protocol: Protocol, protocol_file: str) -> No
"Dropping tip into H12 of Opentrons OT-2 96 Tip Rack 1000 µL on slot 1",
],
),
(
"ot2_drop_tip.py",
[
"Picking up tip from A1 of Opentrons OT-2 96 Tip Rack 300 µL on slot 5",
"Dropping tip into Trash Bin on slot 12",
],
),
],
)
def test_simulate_function_apiv2_run_log(
Expand Down
10 changes: 10 additions & 0 deletions app-shell/build/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ log][]. For a list of currently known issues, please see the [Opentrons issue tr

---

## Opentrons App Changes in 7.2.1

Welcome to the v7.2.1 release of the Opentrons App!

### Bug Fixes

- Fixed a memory leak that could cause the app to crash.

---

## Opentrons App Changes in 7.2.0

Welcome to the v7.2.0 release of the Opentrons App!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
gripperData,
runId,
}: SetupGripperCalibrationItemProps): JSX.Element | null {
const { t } = useTranslation('protocol_setup')
const { t, i18n } = useTranslation('protocol_setup')

Check warning on line 29 in app/src/organisms/Devices/ProtocolRun/SetupGripperCalibrationItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Devices/ProtocolRun/SetupGripperCalibrationItem.tsx#L29

Added line #L29 was not covered by tests
const [
openWizardFlowType,
setOpenWizardFlowType,
Expand All @@ -47,7 +47,7 @@
setOpenWizardFlowType(GRIPPER_FLOW_TYPES.ATTACH)
}}
>
{t('attach_gripper')}
{i18n.format(t('attach_gripper'), 'capitalize')}
</TertiaryButton>
</Flex>
)
Expand Down
Loading
Loading