feat: set kernel process title to 'hermes' in ps/top/htop - #35111
Closed
wenchengxucool wants to merge 3 commits into
Closed
feat: set kernel process title to 'hermes' in ps/top/htop#35111wenchengxucool wants to merge 3 commits into
wenchengxucool wants to merge 3 commits into
Conversation
Uses ctypes (stdlib, no new dependency) to call prctl on Linux and pthread_setname_np on macOS so the process shows up as 'hermes' instead of 'python3.xx' in ps, top, htop. No-op on Windows (hermes.exe is already the visible name). Closes NousResearch#35108
Adds setproctitle as a core dependency (pure C, very stable) to change
the process title from 'python3.xx' to 'hermes' on Linux, macOS, and BSD.
Strategy:
1. setproctitle.setproctitle('hermes') — works everywhere, no 15-char limit
2. Fallback: ctypes prctl(PR_SET_NAME) on Linux (stdlib)
3. Fallback: ctypes pthread_setname_np on macOS (stdlib, kernel thread name)
Closes NousResearch#35108
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux and macOS,
hermesshows up aspython3.11(or whatever Python version) in process monitoring tools likeps,top, andhtop. This is confusing — users naturally look for the app name, not the interpreter.This PR sets the process title to
hermesso the process is immediately recognizable.Changes
hermes_cli/main.py: added_set_process_title()— tries three strategies in order:setproctitle.setproctitle("hermes")— cross-platform, works on Linux/macOS/BSDprctl(PR_SET_NAME)via ctypes (Linux, stdlib)pthread_setname_npvia ctypes (macOS, stdlib — kernel thread name only)Called at the very top of
main(), before any other initialization.pyproject.toml: addedsetproctitle==1.3.7as core dependency (pure C, very stable).exename is alreadyhermes.exe).Example
Before:
After:
Notes
setproctitleis pure C, very stable, and already packaged for all major distros.