Skip to content

Commit

Permalink
fix(api): use motion lock when updating firmware (#14431)
Browse files Browse the repository at this point in the history
* motion lock update firmware
  • Loading branch information
ahiuchingau committed Feb 6, 2024
1 parent 52090d2 commit be6a405
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,19 +490,22 @@ async def update_firmware(
"""Start the firmware update for one or more subsystems and return update progress iterator."""
subsystems = subsystems or set()
# start the updates and yield the progress
try:
async for update_status in self._backend.update_firmware(subsystems, force):
yield update_status
except SubsystemUpdating as e:
raise UpdateOngoingError(e.msg) from e
except EnumeratedError:
raise
except BaseException as e:
mod_log.exception("Firmware update failed")
raise FirmwareUpdateFailedError(
message="Update failed because of uncaught error",
wrapping=[PythonException(e)],
) from e
async with self._motion_lock:
try:
async for update_status in self._backend.update_firmware(
subsystems, force
):
yield update_status
except SubsystemUpdating as e:
raise UpdateOngoingError(e.msg) from e
except EnumeratedError:
raise
except BaseException as e:
mod_log.exception("Firmware update failed")
raise FirmwareUpdateFailedError(
message="Update failed because of uncaught error",
wrapping=[PythonException(e)],
) from e

# Incidentals (i.e. not motion) API

Expand Down

0 comments on commit be6a405

Please sign in to comment.