diff --git a/nipype/utils/profiler.py b/nipype/utils/profiler.py index 7dd1823d43..f9299bf87c 100644 --- a/nipype/utils/profiler.py +++ b/nipype/utils/profiler.py @@ -2,7 +2,7 @@ # @Author: oesteban # @Date: 2017-09-21 15:50:37 # @Last Modified by: oesteban -# @Last Modified time: 2017-10-02 15:44:29 +# @Last Modified time: 2017-10-20 09:12:36 """ Utilities to keep track of performance """ @@ -77,9 +77,13 @@ def _sample(self, cpu_interval=None): except psutil.NoSuchProcess: pass - # parent_mem = mem # Iterate through child processes and get number of their threads - for child in self._process.children(recursive=True): + try: + children = self._process.children(recursive=True) + except psutil.NoSuchProcess: + children = [] + + for child in children: try: with child.oneshot(): cpu += child.cpu_percent()