@@ -551,7 +551,7 @@ def func2(a):
551
551
w1 .connect (n1 , ('a' , modify ), n2 ,'a' )
552
552
w1 .base_dir = wd
553
553
554
- w1 .config = { ' crashdump_dir': wd }
554
+ w1 .config [ 'execution' ][ ' crashdump_dir'] = wd
555
555
# generate outputs
556
556
error_raised = False
557
557
try :
@@ -581,7 +581,7 @@ def func1(in1):
581
581
n1 .inputs .in1 = [1 ]
582
582
w1 = Workflow (name = 'test' )
583
583
w1 .base_dir = wd
584
- w1 .config = { ' crashdump_dir': wd }
584
+ w1 .config [ 'execution' ][ ' crashdump_dir'] = wd
585
585
w1 .add_nodes ([n1 ])
586
586
w1 .run ()
587
587
n1 .inputs .in1 = [2 ]
@@ -606,3 +606,56 @@ def func1(in1):
606
606
yield assert_false , error_raised
607
607
os .chdir (cwd )
608
608
rmtree (wd )
609
+
610
+ def test_serial_input ():
611
+ cwd = os .getcwd ()
612
+ wd = mkdtemp ()
613
+ os .chdir (wd )
614
+ from nipype import MapNode , Function , Workflow
615
+ def func1 (in1 ):
616
+ return in1
617
+ n1 = MapNode (Function (input_names = ['in1' ],
618
+ output_names = ['out' ],
619
+ function = func1 ),
620
+ iterfield = ['in1' ],
621
+ name = 'n1' )
622
+ n1 .inputs .in1 = [1 ,2 ,3 ]
623
+
624
+
625
+ w1 = Workflow (name = 'test' )
626
+ w1 .base_dir = wd
627
+ w1 .add_nodes ([n1 ])
628
+ # set local check
629
+ w1 .config ['execution' ] = {'stop_on_first_crash' : 'true' ,
630
+ 'local_hash_check' : 'true' ,
631
+ 'crashdump_dir' : wd }
632
+
633
+ # test output of num_subnodes method when serial is default (False)
634
+ num_subnodes_default = n1 .num_subnodes ()
635
+ yield assert_equal , num_subnodes_default , len (n1 .inputs .in1 )
636
+
637
+ # test running the workflow on default conditions
638
+ error_raised = False
639
+ try :
640
+ w1 .run (plugin = 'MultiProc' )
641
+ except Exception , e :
642
+ pe .logger .info ('Exception: %s' % str (e ))
643
+ error_raised = True
644
+ yield assert_false , error_raised
645
+
646
+ # test output of num_subnodes method when serial is True
647
+ n1 ._serial = True
648
+ num_subnodes_serial = n1 .num_subnodes ()
649
+ yield assert_equal , num_subnodes_serial , 1
650
+
651
+ # test running the workflow on serial conditions
652
+ error_raised = False
653
+ try :
654
+ w1 .run (plugin = 'MultiProc' )
655
+ except Exception , e :
656
+ pe .logger .info ('Exception: %s' % str (e ))
657
+ error_raised = True
658
+ yield assert_false , error_raised
659
+
660
+ os .chdir (cwd )
661
+ rmtree (wd )
0 commit comments