This commit is contained in:
concordia
2024-06-15 20:33:14 -05:00
parent 51561d3393
commit 3ae97fe0e5

View File

@@ -20,7 +20,7 @@ from openpilot.common.swaglog import cloudlog
WATCHDOG_FN = "/dev/shm/wd_"
ENABLE_WATCHDOG = os.getenv("NO_WATCHDOG") is None
def modified_nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str) -> None:
def nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str) -> None:
os.environ['MANAGER_DAEMON'] = name
log_file_path = os.path.join(log_path, f"{name}.log")
with open(log_file_path, 'a') as log_file:
@@ -31,7 +31,7 @@ def modified_nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str
log_file.write(line)
proc.wait()
def modified_launcher(proc: str, name: str, log_path: str) -> None:
def launcher(proc: str, name: str, log_path: str) -> None:
try:
mod = importlib.import_module(proc)
setproctitle(proc)
@@ -170,7 +170,7 @@ class NativeProcess(ManagerProcess):
self.enabled = enabled
self.sigkill = sigkill
self.watchdog_max_dt = watchdog_max_dt
self.launcher = modified_nativelauncher
self.launcher = nativelauncher
self.always_watchdog = always_watchdog
def prepare(self) -> None:
@@ -179,7 +179,7 @@ class NativeProcess(ManagerProcess):
def start(self, log_path: str) -> None:
if self.shutting_down or self.proc is not None:
return
self.proc = Process(target=modified_nativelauncher, args=(self.cmdline, os.path.join(BASEDIR, self.cwd), self.name, log_path))
self.proc = Process(target=nativelauncher, args=(self.cmdline, os.path.join(BASEDIR, self.cwd), self.name, log_path))
self.proc.start()
class PythonProcess(ManagerProcess):
@@ -200,7 +200,7 @@ class PythonProcess(ManagerProcess):
def start(self, log_path: str) -> None:
if self.shutting_down or self.proc is not None:
return
self.proc = Process(name=self.name, target=modified_launcher, args=(self.module, self.name, log_path))
self.proc = Process(name=self.name, target=launcher, args=(self.module, self.name, log_path))
self.proc.start()
self.watchdog_seen = False
self.shutting_down = False