Skip to content

Commit d5f81f3

Browse files
committed
fix: tests to use faster polling loop and white space changes
1 parent 92d6226 commit d5f81f3

File tree

6 files changed

+21
-61
lines changed

6 files changed

+21
-61
lines changed

examples/fmri_ants_openfmri.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def create_reg_workflow(name='registration'):
218218
reg.inputs.args = '--float'
219219
reg.inputs.output_warped_image = 'output_warped_image.nii.gz'
220220
reg.inputs.num_threads = 4
221-
reg.plugin_args = {'qsub_args': '-pe orte 4',
221+
reg.plugin_args = {'qsub_args': '-pe orte 4',
222222
'sbatch_args': '--mem=6G -c 4'}
223223
register.connect(stripper, 'out_file', reg, 'moving_image')
224224
register.connect(inputnode,'target_image_brain', reg,'fixed_image')
@@ -428,7 +428,7 @@ def create_fs_reg_workflow(name='registration'):
428428
reg.inputs.args = '--float'
429429
reg.inputs.output_warped_image = 'output_warped_image.nii.gz'
430430
reg.inputs.num_threads = 4
431-
reg.plugin_args = {'qsub_args': '-pe orte 4',
431+
reg.plugin_args = {'qsub_args': '-pe orte 4',
432432
'sbatch_args': '--mem=6G -c 4'}
433433
register.connect(stripper, 'out_file', reg, 'moving_image')
434434
register.connect(inputnode,'target_image', reg,'fixed_image')
@@ -562,17 +562,17 @@ def get_subjectinfo(subject_id, base_dir, task_id, model_id):
562562
'task%03d_run*' % (idx + 1))))
563563
runs = [int(val[-3:]) for val in files]
564564
run_ids.insert(idx, runs)
565-
json_info = os.path.join(base_dir, subject_id, 'BOLD',
566-
'task%03d_run%03d' % (task_id, run_ids[task_id - 1][0]),
565+
json_info = os.path.join(base_dir, subject_id, 'BOLD',
566+
'task%03d_run%03d' % (task_id, run_ids[task_id - 1][0]),
567567
'bold_scaninfo.json')
568568
if os.path.exists(json_info):
569569
import json
570570
with open(json_info, 'rt') as fp:
571571
data = json.load(fp)
572572
TR = data['global']['const']['RepetitionTime']/1000.
573573
else:
574-
task_scan_key = os.path.join(base_dir, subject_id, 'BOLD',
575-
'task%03d_run%03d' % (task_id, run_ids[task_id - 1][0]),
574+
task_scan_key = os.path.join(base_dir, subject_id, 'BOLD',
575+
'task%03d_run%03d' % (task_id, run_ids[task_id - 1][0]),
576576
'scan_key.txt')
577577
if os.path.exists(task_scan_key):
578578
TR = np.genfromtxt(task_scan_key)[1]
@@ -667,7 +667,7 @@ def analyze_openfmri_dataset(data_dir, subject=None, model_id=None,
667667
name='datasource')
668668
datasource.inputs.base_directory = data_dir
669669
datasource.inputs.template = '*'
670-
670+
671671
if has_contrast:
672672
datasource.inputs.field_template = {'anat': '%s/anatomy/T1_001.nii.gz',
673673
'bold': '%s/BOLD/task%03d_r*/bold.nii.gz',
@@ -909,18 +909,18 @@ def split_files(in_files, splits):
909909
splitfunc, 'in_files')
910910

911911
if subjects_dir:
912-
get_roi_mean = pe.MapNode(fs.SegStats(default_color_table=True),
912+
get_roi_mean = pe.MapNode(fs.SegStats(default_color_table=True),
913913
iterfield=['in_file'], name='get_aparc_means')
914914
get_roi_mean.inputs.avgwf_txt_file = True
915915
wf.connect(fixed_fx.get_node('outputspec'), 'copes', get_roi_mean, 'in_file')
916916
wf.connect(registration, 'outputspec.aparc', get_roi_mean, 'segmentation_file')
917-
918-
get_roi_tsnr = pe.MapNode(fs.SegStats(default_color_table=True),
917+
918+
get_roi_tsnr = pe.MapNode(fs.SegStats(default_color_table=True),
919919
iterfield=['in_file'], name='get_aparc_tsnr')
920920
get_roi_tsnr.inputs.avgwf_txt_file = True
921921
wf.connect(tsnr, 'tsnr_file', get_roi_tsnr, 'in_file')
922922
wf.connect(registration, 'outputspec.aparc', get_roi_tsnr, 'segmentation_file')
923-
923+
924924
"""
925925
Connect to a datasink
926926
"""

nipype/algorithms/tests/test_auto_Overlap.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

nipype/pipeline/plugins/tests/test_callback.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def test_callback_multiproc_normal():
7272
output_names=[]),
7373
name='f_node')
7474
wf.add_nodes([f_node])
75-
wf.config['execution'] = {'crashdump_dir': wf.base_dir}
75+
wf.config['execution']['crashdump_dir'] = wf.base_dir
76+
wf.config['execution']['poll_sleep_duration'] = 2
7677
wf.run(plugin='MultiProc', plugin_args={'status_callback': so.callback})
7778
assert_equal(len(so.statuses), 2)
7879
for (n, s) in so.statuses:
@@ -89,7 +90,8 @@ def test_callback_multiproc_exception():
8990
output_names=[]),
9091
name='f_node')
9192
wf.add_nodes([f_node])
92-
wf.config['execution'] = {'crashdump_dir': wf.base_dir}
93+
wf.config['execution']['crashdump_dir'] = wf.base_dir
94+
wf.config['execution']['poll_sleep_duration'] = 2
9395
try:
9496
wf.run(plugin='MultiProc',
9597
plugin_args={'status_callback': so.callback})

nipype/pipeline/plugins/tests/test_multiproc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_run_multiproc():
3939
pipe.connect([(mod1,mod2,[('output1','input1')])])
4040
pipe.base_dir = os.getcwd()
4141
mod1.inputs.input1 = 1
42+
pipe.config['execution']['poll_sleep_duration'] = 2
4243
execgraph = pipe.run(plugin="MultiProc")
4344
names = ['.'.join((node._hierarchy,node.name)) for node in execgraph.nodes()]
4445
node = execgraph.nodes()[names.index('pipe.mod1')]

nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ def run_multiproc_nondaemon_with_flag(nondaemon_flag):
106106
pipe.base_dir = os.getcwd()
107107
f1.inputs.insum = 0
108108

109-
pipe.config = {'execution': {'stop_on_first_crash': True}}
109+
pipe.config['execution']['stop_on_first_crash'] = True
110+
pipe.config['execution']['poll_sleep_duration'] = 2
111+
110112
# execute the pipe using the MultiProc plugin with 2 processes and the non_daemon flag
111113
# to enable child processes which start other multiprocessing jobs
112114
execgraph = pipe.run(plugin="MultiProc",

nipype/pipeline/tests/test_engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,8 @@ def func1(in1):
660660
# set local check
661661
w1.config['execution'] = {'stop_on_first_crash': 'true',
662662
'local_hash_check': 'true',
663-
'crashdump_dir': wd}
663+
'crashdump_dir': wd,
664+
'poll_sleep_duration': 2}
664665

665666
# test output of num_subnodes method when serial is default (False)
666667
yield assert_equal, n1.num_subnodes(), len(n1.inputs.in1)

0 commit comments

Comments
 (0)