Skip to content

Commit

Permalink
Add back in the aexit hook but start the server as an orphaned proces…
Browse files Browse the repository at this point in the history
…s instead so python releases everything before the server tries to lock it (#14010)
  • Loading branch information
ryanthecoder committed Nov 16, 2023
1 parent 5ec4cb3 commit 2c83a19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions hardware-testing/hardware_testing/opentrons_api/helpers_ot3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from datetime import datetime
from enum import Enum
from math import pi
from subprocess import run
from subprocess import run, Popen
from time import time
from typing import Callable, Coroutine, Dict, List, Optional, Tuple, Union

import atexit
from opentrons_hardware.drivers.can_bus import DriverSettings, build, CanMessenger
from opentrons_hardware.drivers.can_bus import settings as can_bus_settings
from opentrons_hardware.firmware_bindings.constants import SensorId
Expand Down Expand Up @@ -77,6 +77,15 @@ def stop_server_ot3() -> None:
"""Stop opentrons-robot-server on the OT3."""
print('Stopping "opentrons-robot-server"...')
run(["systemctl", "stop", "opentrons-robot-server"])
atexit.register(restart_server_ot3)


def restart_server_ot3() -> None:
"""Start opentrons-robot-server on the OT3."""
print('Starting "opentrons-robot-server"...')
Popen(
["systemctl", "restart", "opentrons-robot-server", "&"],
)


def start_server_ot3() -> None:
Expand Down

0 comments on commit 2c83a19

Please sign in to comment.