Skip to content

Commit 4887a71

Browse files
authored
fix(api): Default values for thermocycler max block volume when well volume is out of bounds (#20056)
# Overview Add a default value for the thermocycler max block volume when the found well volume is out of bounds ## Test Plan and Hands on Testing Simulated protocol `/Users/rhyannclarke/opentrons/abr-testing/abr_testing/protocols/active_protocols/4_Illumina DNA Enrichment.py` with apiLevel to 2.27 and received this error: `ProtocolCommandFailedError [line 299]: Error 4000 GENERAL_ERROR (ProtocolCommandFailedError): InvalidBlockVolumeError: Thermocycler max block volume must be between 0 and 100, but got 150.0.` After the change was made, the protocol simulated successfully with `start_set_block_temperature()` and `set_block_temperature()` ## Changelog - Added default block temperatures based on if it was higher than the max or lower than the min ## Risk assessment low Closes RQA-4820
1 parent 4ed1529 commit 4887a71

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

api/src/opentrons/protocol_api/module_contexts.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from .labware import Labware
4545
from . import validation
4646
from . import Task
47-
47+
from opentrons.drivers.thermocycler.driver import BLOCK_VOL_MIN, BLOCK_VOL_MAX
4848

4949
_MAGNETIC_MODULE_HEIGHT_PARAM_REMOVED_IN = APIVersion(2, 14)
5050

@@ -981,6 +981,10 @@ def _get_current_labware_max_vol(self) -> Optional[float]:
981981
# ignore simulated probe results
982982
if isinstance(well_vol, float):
983983
max_vol = max(max_vol, well_vol)
984+
if max_vol > BLOCK_VOL_MAX:
985+
max_vol = BLOCK_VOL_MAX
986+
elif max_vol < BLOCK_VOL_MIN:
987+
max_vol = BLOCK_VOL_MIN
984988
return max_vol
985989

986990

api/tests/opentrons/protocol_api/test_thermocycler_context.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,29 @@ def test_set_block_temperature(
379379
)
380380

381381

382+
def test_get_current_labware_max_volume(
383+
decoy: Decoy,
384+
mock_core: ThermocyclerCore,
385+
mock_labware: Labware,
386+
mock_well: Well,
387+
subject: ThermocyclerContext,
388+
) -> None:
389+
"""It should return a max block volume within bounds."""
390+
mock_labware_core = decoy.mock(cls=LabwareCore)
391+
decoy.when(mock_well.has_tracked_liquid()).then_return(True)
392+
decoy.when(mock_well.current_liquid_volume()).then_return(125.0)
393+
decoy.when(mock_labware.wells()).then_return([mock_well])
394+
decoy.when(subject._protocol_core.get_labware_on_module(mock_core)).then_return(
395+
mock_labware_core
396+
)
397+
decoy.when(subject._core_map.get(mock_labware_core)).then_return(mock_labware)
398+
result = subject._get_current_labware_max_vol()
399+
assert result == 100.0
400+
decoy.when(mock_well.current_liquid_volume()).then_return(-10.0)
401+
result = subject._get_current_labware_max_vol()
402+
assert result == 0.0
403+
404+
382405
def test_set_block_temperature_with_liquid_tracking(
383406
decoy: Decoy,
384407
mock_core: ThermocyclerCore,

0 commit comments

Comments
 (0)