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

Upgrade psutil #227

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 2 additions & 7 deletions granulate_utils/linux/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@

def process_exe(process: psutil.Process) -> str:
"""
psutil.Process(pid).exe() returns "" for zombie processes, incorrectly. It should raise ZombieProcess, and return ""
only for kernel threads.

See https://github.com/giampaolo/psutil/pull/2062
psutil.Process(pid).exe() caches the result. This function returns the up-to-date exe in case the process exec-ed.
"""
# Clear the "exe" cache on the process object. It can change after being cached if the process execed.
# Clear the "exe" cache on the process object
process._exe = None # type: ignore
exe = process.exe()
if exe == "":
if is_process_zombie(process):
raise psutil.ZombieProcess(process.pid)
raise MissingExePath(process)
return exe

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
psutil~=5.8.0
psutil~=6.0.0
requests~=2.31.0
grpcio~=1.43.0
protobuf~=3.19.4
Expand Down
Loading