Skip to content

Commit

Permalink
Added exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PalNilsson committed Nov 26, 2024
1 parent 0864ecb commit 5b87905
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.2.32
3.9.2.33
2 changes: 1 addition & 1 deletion pilot/util/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
RELEASE = '3' # released number should be fixed at 3 for Pilot 3
VERSION = '9' # version number is '1' for first release, '0' until then, increased for bigger updates
REVISION = '2' # revision number should be reset to '0' for every new version release, increased for small updates
BUILD = '32' # build number should be reset to '1' for every new development cycle
BUILD = '33' # build number should be reset to '1' for every new development cycle

SUCCESS = 0
FAILURE = 1
Expand Down
14 changes: 10 additions & 4 deletions pilot/util/psutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,16 @@ def find_lingering_processes(parent_pid: int) -> list:
return []

lingering_processes = []
parent_process = psutil.Process(parent_pid)
for child in parent_process.children(recursive=True):
if child.status() != psutil.STATUS_ZOMBIE:
lingering_processes.append(child.pid)
try:
parent_process = psutil.Process(parent_pid)
for child in parent_process.children(recursive=True):
try:
if child.status() != psutil.STATUS_ZOMBIE:
lingering_processes.append(child.pid)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess) as e:
logger.warning(f"[harmless] failed to get status for child process {child.pid}: {e}")
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess, psutil.FileNotFoundError) as e:
logger.warning(f"[harmless] failed to get parent process {parent_pid}: {e}")

return lingering_processes

Expand Down

0 comments on commit 5b87905

Please sign in to comment.