Skip to content

Commit 116a6a1

Browse files
committed
Removed node.run level profiling
1 parent 07461cf commit 116a6a1

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

nipype/pipeline/plugins/multiproc.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,40 @@
66
http://stackoverflow.com/a/8963618/1183453
77
"""
88

9+
# Import packages
910
from multiprocessing import Process, Pool, cpu_count, pool
1011
from traceback import format_exception
1112
import sys
1213
import numpy as np
1314
from copy import deepcopy
1415
from ..engine import MapNode
1516
from ...utils.misc import str2bool
16-
import datetime
1717
import psutil
1818
from ... import logging
1919
import semaphore_singleton
2020
from .base import (DistributedPluginBase, report_crash)
2121

22+
# Init logger
23+
logger = logging.getLogger('workflow')
2224

2325
# Run node
2426
def run_node(node, updatehash, runtime_profile=False):
2527
"""docstring
2628
"""
2729

2830
# Import packages
29-
try:
30-
import memory_profiler
31-
import datetime
32-
except ImportError:
33-
runtime_profile = False
31+
import datetime
3432

3533
# Init variables
3634
result = dict(result=None, traceback=None)
3735

3836
# If we're profiling the run
3937
if runtime_profile:
4038
try:
41-
# Init function tuple
42-
proc = (node.run, (), {'updatehash' : updatehash})
4339
start = datetime.datetime.now()
44-
mem_mb, retval = memory_profiler.memory_usage(proc=proc, retval=True,
45-
include_children=True,
46-
max_usage=True, interval=.9e-6)
40+
retval = node.run(updatehash=updatehash)
4741
run_secs = (datetime.datetime.now() - start).total_seconds()
4842
result['result'] = retval
49-
result['node_memory'] = mem_mb[0]/1024.0
5043
result['run_seconds'] = run_secs
5144
if hasattr(retval.runtime, 'get'):
5245
result['cmd_memory'] = retval.runtime.get('cmd_memory')
@@ -83,11 +76,11 @@ class NonDaemonPool(pool.Pool):
8376
"""
8477
Process = NonDaemonProcess
8578

86-
logger = logging.getLogger('workflow')
8779

8880
def release_lock(args):
8981
semaphore_singleton.semaphore.release()
9082

83+
9184
class ResourceMultiProcPlugin(DistributedPluginBase):
9285
"""Execute workflow with multiprocessing, not sending more jobs at once
9386
than the system can support.

0 commit comments

Comments
 (0)