Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudlog: add daemon name to context for python daemons #23225

Merged
merged 3 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions selfdrive/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def manager_cleanup():


def manager_thread():
cloudlog.bind(daemon="manager")
cloudlog.info("manager start")
cloudlog.info({"environ": os.environ})

Expand Down
6 changes: 4 additions & 2 deletions selfdrive/manager/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ENABLE_WATCHDOG = os.getenv("NO_WATCHDOG") is None


def launcher(proc):
def launcher(proc, name):
try:
# import the process
mod = importlib.import_module(proc)
Expand All @@ -33,6 +33,8 @@ def launcher(proc):
# create new context since we forked
messaging.context = messaging.Context()

cloudlog.bind(daemon=name)
adeebshihadeh marked this conversation as resolved.
Show resolved Hide resolved

# exec the process
mod.main()
except KeyboardInterrupt:
Expand Down Expand Up @@ -223,7 +225,7 @@ def start(self):
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
Expand Down