Skip to content

Commit 7a8383b

Browse files
committed
Experimented with process STATUS
1 parent 5c2f2c1 commit 7a8383b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

nipype/interfaces/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,14 +1225,16 @@ def _get_num_threads(proc):
12251225

12261226
# Init variables
12271227
num_threads = proc.num_threads()
1228-
1228+
alive_procs = 0
12291229
# Iterate through child processes and get number of their threads
12301230
try:
1231-
num_children = len(proc.children())
1231+
#num_children = len(proc.children())
12321232
for child in proc.children(recursive=True):
1233-
#num_threads += child.num_threads()
1234-
num_threads = max(num_threads, num_children,
1235-
child.num_threads(), len(child.children()))
1233+
if child.status() == psutil.STATUS_RUNNING:
1234+
alive_procs += 1
1235+
num_threads += max(alive_procs, child.num_threads()) #child.num_threads()
1236+
#num_threads = max(num_threads, num_children,
1237+
# child.num_threads(), len(child.children()))
12361238
except psutil.NoSuchProcess:
12371239
pass
12381240

0 commit comments

Comments
 (0)