Esempio n. 1
0
def run_examples(example, pipelines, plugin):
    print 'running example: %s with plugin: %s'%(example, plugin)
    from nipype.utils.config import NipypeConfig
    config = NipypeConfig()
    config.enable_debug_mode()
    __import__(example)
    for pipeline in pipelines:
        wf = getattr(sys.modules[example], pipeline)
        wf.base_dir = os.path.join(os.getcwd(), 'output', example, plugin)
        if os.path.exists(wf.base_dir):
            rmtree(wf.base_dir)
        wf.config = {'execution' :{'hash_method': 'timestamp', 'stop_on_first_rerun': 'true'}}
        wf.run(plugin=plugin, plugin_args={'n_procs': 4})
        #run twice to check if nothing is rerunning
        wf.run(plugin=plugin)
Esempio n. 2
0
def run_examples(example, pipelines, plugin):
    print 'running example: %s with plugin: %s' % (example, plugin)
    from nipype.utils.config import NipypeConfig
    config = NipypeConfig()
    config.enable_debug_mode()
    __import__(example)
    for pipeline in pipelines:
        wf = getattr(sys.modules[example], pipeline)
        wf.base_dir = os.path.join(os.getcwd(), 'output', example, plugin)
        if os.path.exists(wf.base_dir):
            rmtree(wf.base_dir)
        wf.config = {
            'execution': {
                'hash_method': 'timestamp',
                'stop_on_first_rerun': 'true'
            }
        }
        wf.run(plugin=plugin, plugin_args={'n_procs': 4})
        #run twice to check if nothing is rerunning
        wf.run(plugin=plugin)
Esempio n. 3
0
""" Test the nipype interface caching mechanism
"""

from tempfile import mkdtemp
from shutil import rmtree

from nose.tools import assert_equal

from nipype.caching import Memory
from nipype.pipeline.tests.test_engine import TestInterface
from nipype.utils.config import NipypeConfig
config = NipypeConfig()
config.set_default_config()

nb_runs = 0


class SideEffectInterface(TestInterface):

    def _run_interface(self, runtime):
        global nb_runs
        nb_runs += 1
        runtime.returncode = 0
        return runtime


def test_caching():
    temp_dir = mkdtemp(prefix='test_memory_')
    old_rerun = config.get('execution', 'stop_on_first_rerun')
    try:
        # Prevent rerun to check that evaluation is computed only once
Esempio n. 4
0
from nipype.utils.config import NipypeConfig
from nipype.utils.logger import Logging

config = NipypeConfig()
logging = Logging(config)
Esempio n. 5
0
""" Test the nipype interface caching mechanism
"""

from tempfile import mkdtemp
from shutil import rmtree

from nose.tools import assert_equal

from nipype.caching import Memory
from nipype.pipeline.tests.test_engine import TestInterface
from nipype.utils.config import NipypeConfig
config = NipypeConfig()
config.set_default_config()

nb_runs = 0


class SideEffectInterface(TestInterface):
    def _run_interface(self, runtime):
        global nb_runs
        nb_runs += 1
        runtime.returncode = 0
        return runtime


def test_caching():
    temp_dir = mkdtemp(prefix='test_memory_')
    old_rerun = config.get('execution', 'stop_on_first_rerun')
    try:
        # Prevent rerun to check that evaluation is computed only once
        config.set('execution', 'stop_on_first_rerun', 'true')