wip
This commit is contained in:
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 257 KiB |
0
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file → Executable file
0
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
0
selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc
Normal file → Executable file
0
selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc
Normal file → Executable file
@@ -27,26 +27,42 @@ def nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str) -> None
|
||||
with open(log_path, 'a') as log_file:
|
||||
os.chdir(cwd)
|
||||
proc = subprocess.Popen(pargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True)
|
||||
log_file.write("Started "+name)
|
||||
for line in proc.stdout:
|
||||
print(line, end='')
|
||||
log_file.write(line)
|
||||
proc.wait()
|
||||
|
||||
def launcher(proc: str, name: str, log_path: str) -> None:
|
||||
try:
|
||||
mod = importlib.import_module(proc)
|
||||
setproctitle(proc)
|
||||
messaging.context = messaging.Context()
|
||||
cloudlog.bind(daemon=name)
|
||||
sentry.set_tag("daemon", name)
|
||||
with open(log_path, 'a') as log_file, subprocess.Popen(['python', '-m', proc], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc:
|
||||
for line in proc.stdout:
|
||||
print(line, end='')
|
||||
log_file.write(line)
|
||||
proc.wait()
|
||||
except Exception:
|
||||
sentry.capture_exception()
|
||||
raise
|
||||
while True:
|
||||
try:
|
||||
# Initialize the module and setup the process title and logging
|
||||
mod = importlib.import_module(proc)
|
||||
setproctitle(name)
|
||||
messaging.context = messaging.Context()
|
||||
cloudlog.bind(daemon=name)
|
||||
sentry.set_tag("daemon", name)
|
||||
|
||||
# Command to run the process
|
||||
command = ['python', '-m', proc]
|
||||
|
||||
# Open the log file and start the subprocess
|
||||
with open(log_path, 'a') as log_file, subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc_instance:
|
||||
log_file.write(f"Started {name}\n")
|
||||
|
||||
# Process the output from the subprocess
|
||||
for line in iter(proc_instance.stdout.readline, ''):
|
||||
print(line, end='')
|
||||
log_file.write(line)
|
||||
|
||||
# Wait for the subprocess to terminate
|
||||
proc_instance.wait()
|
||||
|
||||
except Exception as e:
|
||||
# Log the error and restart the process after logging the exception
|
||||
print(f"Fatal: {name}")
|
||||
print(e)
|
||||
sentry.capture_exception()
|
||||
|
||||
def join_process(process: Process, timeout: float) -> None:
|
||||
t = time.monotonic()
|
||||
@@ -215,14 +231,13 @@ class DaemonProcess(ManagerProcess):
|
||||
except OSError:
|
||||
pass # Process not running, continue to start it
|
||||
|
||||
log_file_path = os.path.join(log_path, f"{self.name}.log")
|
||||
self.params.put(self.param_name, str(self.proc.pid))
|
||||
cloudlog.info(f"starting daemon {self.name}")
|
||||
self.proc = subprocess.Popen(['python', '-m', self.module],
|
||||
stdin=open('/dev/null'),
|
||||
stdout=open(log_file_path, 'a'),
|
||||
stdout=open(log_path, 'a'),
|
||||
stderr=subprocess.STDOUT,
|
||||
preexec_fn=os.setpgrp)
|
||||
self.params.put(self.param_name, str(self.proc.pid))
|
||||
|
||||
def stop(self, retry=True, block=True, sig=None) -> None:
|
||||
pass
|
||||
@@ -237,7 +252,7 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None
|
||||
running = []
|
||||
for p in procs:
|
||||
if p.enabled and p.name not in not_run and p.should_run(started, params, CP):
|
||||
if p.proc is None or p.proc.exitcode is not None:
|
||||
if p.proc is None or (hasattr(p.proc, 'exitcode') and p.proc.exitcode is not None):
|
||||
p.start()
|
||||
running.append(p)
|
||||
else:
|
||||
@@ -245,4 +260,4 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None
|
||||
|
||||
p.check_watchdog(started)
|
||||
|
||||
return running
|
||||
return running
|
||||
|
||||
Reference in New Issue
Block a user