From 117596fcf8bfa97198ca629ce2e4ebaf785d01ed Mon Sep 17 00:00:00 2001 From: tamarzanzouri Date: Tue, 1 Oct 2024 14:35:36 -0400 Subject: [PATCH] fixed confition to raise fixit commands --- .../opentrons/protocol_engine/state/commands.py | 13 +++++++++---- .../state/test_command_view_old.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/api/src/opentrons/protocol_engine/state/commands.py b/api/src/opentrons/protocol_engine/state/commands.py index 95f091caadd..55e0e32db1a 100644 --- a/api/src/opentrons/protocol_engine/state/commands.py +++ b/api/src/opentrons/protocol_engine/state/commands.py @@ -967,6 +967,8 @@ def validate_action_allowed( # noqa: C901 return action elif isinstance(action, QueueCommandAction): + print(self.get_status()) + print(action.request.commandType) if ( action.request.intent == CommandIntent.SETUP and self._state.queue_status != QueueStatus.SETUP @@ -975,14 +977,17 @@ def validate_action_allowed( # noqa: C901 "Setup commands are not allowed after run has started." ) elif action.request.intent == CommandIntent.FIXIT: - if ( - self._state.queue_status != QueueStatus.AWAITING_RECOVERY - or self.get_status() + allowed_while_door_open = ( + self.get_status() in ( EngineStatus.BLOCKED_BY_OPEN_DOOR, EngineStatus.AWAITING_RECOVERY_BLOCKED_BY_OPEN_DOOR, ) - and action.request.commandType != "unsafe/ungripLabware" + and action.request.commandType == "unsafe/ungripLabware" + ) + if ( + self._state.queue_status != QueueStatus.AWAITING_RECOVERY + and not allowed_while_door_open ): raise FixitCommandNotAllowedError( "Fixit commands are not allowed when the run is not in a recoverable state." diff --git a/api/tests/opentrons/protocol_engine/state/test_command_view_old.py b/api/tests/opentrons/protocol_engine/state/test_command_view_old.py index 48918eec6eb..08fcfa1cefe 100644 --- a/api/tests/opentrons/protocol_engine/state/test_command_view_old.py +++ b/api/tests/opentrons/protocol_engine/state/test_command_view_old.py @@ -595,6 +595,21 @@ class ActionAllowedSpec(NamedTuple): action=ResumeFromRecoveryAction(), expected_error=errors.ResumeFromRecoveryNotAllowedError, ), + ActionAllowedSpec( + subject=get_command_view( + queue_status=QueueStatus.PAUSED, is_door_blocking=True + ), + action=QueueCommandAction( + request=cmd.unsafe.UnsafeUngripLabwareCreate( + params=cmd.unsafe.UnsafeUngripLabwareParams(), + intent=cmd.CommandIntent.FIXIT, + ), + request_hash=None, + command_id="command-id", + created_at=datetime(year=2021, month=1, day=1), + ), + expected_error=None, + ), ]