cloudlog: add daemon name to context for python daemons (#23225)
* python * manager is a daemon too * Update selfdrive/manager/process.py Co-authored-by: Comma Device <device@comma.ai>pull/23024/head
parent
fa62b9d3f9
commit
b27a19e9d1
|
@ -117,6 +117,7 @@ def manager_cleanup():
|
|||
|
||||
|
||||
def manager_thread():
|
||||
cloudlog.bind(daemon="manager")
|
||||
cloudlog.info("manager start")
|
||||
cloudlog.info({"environ": os.environ})
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ WATCHDOG_FN = "/dev/shm/wd_"
|
|||
ENABLE_WATCHDOG = os.getenv("NO_WATCHDOG") is None
|
||||
|
||||
|
||||
def launcher(proc):
|
||||
def launcher(proc, name):
|
||||
try:
|
||||
# import the process
|
||||
mod = importlib.import_module(proc)
|
||||
|
@ -33,6 +33,9 @@ def launcher(proc):
|
|||
# create new context since we forked
|
||||
messaging.context = messaging.Context()
|
||||
|
||||
# add daemon name to cloudlog ctx
|
||||
cloudlog.bind(daemon=name)
|
||||
|
||||
# exec the process
|
||||
mod.main()
|
||||
except KeyboardInterrupt:
|
||||
|
@ -223,7 +226,7 @@ class PythonProcess(ManagerProcess):
|
|||
return
|
||||
|
||||
cloudlog.info("starting python %s" % self.module)
|
||||
self.proc = Process(name=self.name, target=launcher, args=(self.module,))
|
||||
self.proc = Process(name=self.name, target=launcher, args=(self.module, self.name))
|
||||
self.proc.start()
|
||||
self.watchdog_seen = False
|
||||
self.shutting_down = False
|
||||
|
|
Loading…
Reference in New Issue