Skip to content

Commit 4073f39

Browse files
committed
[FIX] Resource monitoring minor bugfix
Fixes #2241
1 parent e4e95f3 commit 4073f39

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nipype/utils/profiler.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# @Author: oesteban
33
# @Date: 2017-09-21 15:50:37
44
# @Last Modified by: oesteban
5-
# @Last Modified time: 2017-10-02 15:44:29
5+
# @Last Modified time: 2017-10-20 09:12:36
66
"""
77
Utilities to keep track of performance
88
"""
@@ -77,9 +77,13 @@ def _sample(self, cpu_interval=None):
7777
except psutil.NoSuchProcess:
7878
pass
7979

80-
# parent_mem = mem
8180
# Iterate through child processes and get number of their threads
82-
for child in self._process.children(recursive=True):
81+
try:
82+
children = self._process.children(recursive=True)
83+
except psutil.NoSuchProcess:
84+
children = []
85+
86+
for child in children:
8387
try:
8488
with child.oneshot():
8589
cpu += child.cpu_percent()

0 commit comments

Comments
 (0)