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

feat(api): Attach error recovery debug notes to commands #16608

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9383,7 +9383,14 @@
},
"id": "UUID",
"key": "08e16a2cac011d4bef561f8b0854d19e",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"displayName": "4 custom tubes",
"loadName": "cpx_4_tuberack_100ul",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9383,7 +9383,14 @@
},
"id": "UUID",
"key": "08e16a2cac011d4bef561f8b0854d19e",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"displayName": "4 custom tubes",
"loadName": "cpx_4_tuberack_100ul",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7895,7 +7895,14 @@
},
"id": "UUID",
"key": "675eb8be-6c85-4204-9c87-d7fdd522f580",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"moduleId": "UUID"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4341,7 +4341,14 @@
},
"id": "UUID",
"key": "bccdb28e967f574dfbe472004101d7f9",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"displayName": "Index Anchors",
"loadName": "eppendorf_96_wellplate_150ul",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12587,7 +12587,14 @@
},
"id": "UUID",
"key": "702caca4-12c8-4f26-a68e-138134723f09",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"labwareId": "UUID",
"newLocation": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,14 @@
},
"id": "UUID",
"key": "c2e4fa67-3c04-4d22-b3fa-5d61e956c488",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"flowRate": 3.78,
"labwareId": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3035,7 +3035,14 @@
},
"id": "UUID",
"key": "0bd3f36a944ee534e422ee69360a9501",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"flowRate": 7.56,
"labwareId": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
},
"id": "UUID",
"key": "8511b05ba5565bf0e6dcccd800e2ee23",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"location": {
"slotName": "C1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,14 @@
},
"id": "UUID",
"key": "2c37ad797da7df791b57a7843a203e88",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"configurationParams": {
"backLeftNozzle": "A1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,14 @@
},
"id": "UUID",
"key": "bd403a1c851a75b4b68ce34796d713fa",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"liquidPresenceDetection": false,
"mount": "left",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@
},
"id": "UUID",
"key": "a3a7eed460d8d94a91747f23820a180d",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"location": {
"slotName": "C3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,14 @@
},
"id": "UUID",
"key": "4b1d27a6f17f312dd76668f0c48ed406",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"configurationParams": {
"backLeftNozzle": "G12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,14 @@
},
"id": "UUID",
"key": "4cca9753dc59d176eee1522349363a75",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"labwareId": "UUID",
"newLocation": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15103,7 +15103,14 @@
},
"id": "UUID",
"key": "c3eacf39e9a35058cac9f69100549344",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"forceDirect": false,
"labwareId": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,14 @@
},
"id": "UUID",
"key": "4b1d27a6f17f312dd76668f0c48ed406",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"configurationParams": {
"backLeftNozzle": "A1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4341,7 +4341,14 @@
},
"id": "UUID",
"key": "bccdb28e967f574dfbe472004101d7f9",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"displayName": "Index Anchors",
"loadName": "eppendorf_96_wellplate_150ul",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,14 @@
},
"id": "UUID",
"key": "2c37ad797da7df791b57a7843a203e88",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"configurationParams": {
"backLeftNozzle": "G12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39047,7 +39047,14 @@
},
"id": "UUID",
"key": "f524340032354f66bf69110d530e98ad",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"labwareId": "UUID",
"newLocation": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
},
"id": "UUID",
"key": "8511b05ba5565bf0e6dcccd800e2ee23",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"location": {
"slotName": "C2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17824,7 +17824,14 @@
},
"id": "UUID",
"key": "7e96139ed2163fa7f870805d0b3d14b6",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"forceDirect": false,
"labwareId": "UUID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,14 @@
},
"id": "UUID",
"key": "c55807b45b6b1d4ea04e12b0ee553f78",
"notes": [],
"notes": [
{
"longMessage": "Handling this command failure with FAIL_RUN.",
"noteKind": "debugErrorRecovery",
"shortMessage": "Handling this command failure with FAIL_RUN.",
"source": "execution"
}
],
"params": {
"location": {
"slotName": "D3"
Expand Down
25 changes: 15 additions & 10 deletions api/src/opentrons/protocol_engine/execution/command_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)

from opentrons.protocol_engine.commands.command import SuccessData
from opentrons.protocol_engine.notes import make_error_recovery_debug_note

from ..state.state import StateStore
from ..resources import ModelUtils, FileProvider
Expand Down Expand Up @@ -161,6 +162,12 @@ async def execute(self, command_id: str) -> None:
elif not isinstance(error, EnumeratedError):
error = PythonException(error)

error_recovery_type = error_recovery_policy(
self._state_store.config,
running_command,
None,
)
note_tracker(make_error_recovery_debug_note(error_recovery_type))
self._action_dispatcher.dispatch(
FailCommandAction(
error=error,
Expand All @@ -169,11 +176,7 @@ async def execute(self, command_id: str) -> None:
error_id=self._model_utils.generate_id(),
failed_at=self._model_utils.get_timestamp(),
notes=note_tracker.get_notes(),
type=error_recovery_policy(
self._state_store.config,
running_command,
None,
),
type=error_recovery_type,
)
)

Expand All @@ -195,6 +198,12 @@ async def execute(self, command_id: str) -> None:
)
else:
# The command encountered a defined error.
error_recovery_type = error_recovery_policy(
self._state_store.config,
running_command,
result,
)
note_tracker(make_error_recovery_debug_note(error_recovery_type))
self._action_dispatcher.dispatch(
FailCommandAction(
error=result,
Expand All @@ -203,10 +212,6 @@ async def execute(self, command_id: str) -> None:
error_id=result.public.id,
failed_at=result.public.createdAt,
notes=note_tracker.get_notes(),
type=error_recovery_policy(
self._state_store.config,
running_command,
result,
),
type=error_recovery_type,
)
)
Loading
Loading