本文整理汇总了Python中nipype.Workflow.config['execution']方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.config['execution']方法的具体用法?Python Workflow.config['execution']怎么用?Python Workflow.config['execution']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nipype.Workflow
的用法示例。
在下文中一共展示了Workflow.config['execution']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serial_input
# 需要导入模块: from nipype import Workflow [as 别名]
# 或者: from nipype.Workflow import config['execution'] [as 别名]
def test_serial_input():
cwd = os.getcwd()
wd = mkdtemp()
os.chdir(wd)
from nipype import MapNode, Function, Workflow
def func1(in1):
return in1
n1 = MapNode(Function(input_names=['in1'],
output_names=['out'],
function=func1),
iterfield=['in1'],
name='n1')
n1.inputs.in1 = [1,2,3]
w1 = Workflow(name='test')
w1.base_dir = wd
w1.add_nodes([n1])
# set local check
w1.config['execution'] = {'stop_on_first_crash': 'true',
'local_hash_check': 'true',
'crashdump_dir': wd}
# test output of num_subnodes method when serial is default (False)
yield assert_equal, n1.num_subnodes(), len(n1.inputs.in1)
# test running the workflow on default conditions
error_raised = False
try:
w1.run(plugin='MultiProc')
except Exception, e:
pe.logger.info('Exception: %s' % str(e))
error_raised = True
示例2: test_serial_input
# 需要导入模块: from nipype import Workflow [as 别名]
# 或者: from nipype.Workflow import config['execution'] [as 别名]
def test_serial_input(tmpdir):
tmpdir.chdir()
wd = os.getcwd()
from nipype import MapNode, Function, Workflow
def func1(in1):
return in1
n1 = MapNode(Function(input_names=['in1'],
output_names=['out'],
function=func1),
iterfield=['in1'],
name='n1')
n1.inputs.in1 = [1, 2, 3]
w1 = Workflow(name='test')
w1.base_dir = wd
w1.add_nodes([n1])
# set local check
w1.config['execution'] = {'stop_on_first_crash': 'true',
'local_hash_check': 'true',
'crashdump_dir': wd,
'poll_sleep_duration': 2}
# test output of num_subnodes method when serial is default (False)
assert n1.num_subnodes() == len(n1.inputs.in1)
# test running the workflow on default conditions
w1.run(plugin='MultiProc')
# test output of num_subnodes method when serial is True
n1._serial = True
assert n1.num_subnodes() == 1
# test running the workflow on serial conditions
w1.run(plugin='MultiProc')