forked from nvaytet/mantid-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ewm7213: Independent Parsing and Child Disk Monitoring (#5)
* Parse individually * children process disk usage * Add egg and version to gitignore --------- Co-authored-by: Pete Peterson <[email protected]>
- Loading branch information
1 parent
0911ef5
commit 0d0cd87
Showing
6 changed files
with
76 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/mantidprofiler.egg-info/ | ||
src/mantidprofiler/_version.py |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# children_util.py - helper functions for dealing with child processes | ||
# | ||
###################################################################### | ||
|
||
|
||
import psutil | ||
|
||
|
||
def all_children(pr: psutil.Process) -> list[psutil.Process]: | ||
try: | ||
return pr.children(recursive=True) | ||
except Exception: # noqa: BLE001 | ||
return [] | ||
|
||
|
||
def update_children(old_children: dict[int, psutil.Process], new_children: list[psutil.Process]): | ||
new_dct = {} | ||
for ch in new_children: | ||
new_dct.update({ch.pid: ch}) | ||
|
||
todel = [] | ||
for pid in old_children.keys(): | ||
if pid not in new_dct.keys(): | ||
todel.append(pid) | ||
|
||
for pid in todel: | ||
del old_children[pid] | ||
|
||
updct = {} | ||
for pid in new_dct.keys(): | ||
if pid not in old_children.keys(): | ||
updct.update({pid: new_dct[pid]}) | ||
old_children.update(updct) |
This file contains 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
This file contains 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