wip
This commit is contained in:
@@ -20,7 +20,7 @@ from openpilot.common.swaglog import cloudlog
|
|||||||
WATCHDOG_FN = "/dev/shm/wd_"
|
WATCHDOG_FN = "/dev/shm/wd_"
|
||||||
ENABLE_WATCHDOG = os.getenv("NO_WATCHDOG") is None
|
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
|
os.environ['MANAGER_DAEMON'] = name
|
||||||
log_file_path = os.path.join(log_path, f"{name}.log")
|
log_file_path = os.path.join(log_path, f"{name}.log")
|
||||||
with open(log_file_path, 'a') as log_file:
|
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)
|
log_file.write(line)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
def modified_launcher(proc: str, name: str, log_path: str) -> None:
|
def launcher(proc: str, name: str, log_path: str) -> None:
|
||||||
try:
|
try:
|
||||||
mod = importlib.import_module(proc)
|
mod = importlib.import_module(proc)
|
||||||
setproctitle(proc)
|
setproctitle(proc)
|
||||||
@@ -170,7 +170,7 @@ class NativeProcess(ManagerProcess):
|
|||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
self.sigkill = sigkill
|
self.sigkill = sigkill
|
||||||
self.watchdog_max_dt = watchdog_max_dt
|
self.watchdog_max_dt = watchdog_max_dt
|
||||||
self.launcher = modified_nativelauncher
|
self.launcher = nativelauncher
|
||||||
self.always_watchdog = always_watchdog
|
self.always_watchdog = always_watchdog
|
||||||
|
|
||||||
def prepare(self) -> None:
|
def prepare(self) -> None:
|
||||||
@@ -179,7 +179,7 @@ class NativeProcess(ManagerProcess):
|
|||||||
def start(self, log_path: str) -> None:
|
def start(self, log_path: str) -> None:
|
||||||
if self.shutting_down or self.proc is not None:
|
if self.shutting_down or self.proc is not None:
|
||||||
return
|
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()
|
self.proc.start()
|
||||||
|
|
||||||
class PythonProcess(ManagerProcess):
|
class PythonProcess(ManagerProcess):
|
||||||
@@ -200,7 +200,7 @@ class PythonProcess(ManagerProcess):
|
|||||||
def start(self, log_path: str) -> None:
|
def start(self, log_path: str) -> None:
|
||||||
if self.shutting_down or self.proc is not None:
|
if self.shutting_down or self.proc is not None:
|
||||||
return
|
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.proc.start()
|
||||||
self.watchdog_seen = False
|
self.watchdog_seen = False
|
||||||
self.shutting_down = False
|
self.shutting_down = False
|
||||||
|
|||||||
Reference in New Issue
Block a user