@@ -302,6 +302,28 @@ def test_wf_st_1_call_plug(plugin):
302
302
assert odir .exists ()
303
303
304
304
305
+ @pytest .mark .parametrize ("plugin" , Plugins )
306
+ def test_wf_st_noinput_1 (plugin ):
307
+ """ Workflow with one task, a splitter for the workflow"""
308
+ wf = Workflow (name = "wf_spl_1" , input_spec = ["x" ])
309
+ wf .add (add2 (name = "add2" , x = wf .lzin .x ))
310
+
311
+ wf .split (("x" ))
312
+ wf .inputs .x = []
313
+ wf .set_output ([("out" , wf .add2 .lzout .out )])
314
+ wf .plugin = plugin
315
+
316
+ checksum_before = wf .checksum
317
+ with Submitter (plugin = plugin ) as sub :
318
+ sub (wf )
319
+
320
+ assert wf .checksum == checksum_before
321
+ results = wf .result ()
322
+ assert results == []
323
+ # checking all directories
324
+ assert wf .output_dir == []
325
+
326
+
305
327
@pytest .mark .parametrize ("plugin" , Plugins )
306
328
def test_wf_ndst_1 (plugin ):
307
329
""" workflow with one task, a splitter on the task level"""
@@ -394,6 +416,26 @@ def test_wf_ndst_updateinp_1(plugin):
394
416
assert wf .output_dir .exists ()
395
417
396
418
419
+ @pytest .mark .parametrize ("plugin" , Plugins )
420
+ def test_wf_ndst_noinput_1 (plugin ):
421
+ """ workflow with one task, a splitter on the task level"""
422
+ wf = Workflow (name = "wf_spl_1" , input_spec = ["x" ])
423
+ wf .add (add2 (name = "add2" , x = wf .lzin .x ).split ("x" ))
424
+ wf .inputs .x = []
425
+ wf .set_output ([("out" , wf .add2 .lzout .out )])
426
+ wf .plugin = plugin
427
+
428
+ checksum_before = wf .checksum
429
+ with Submitter (plugin = plugin ) as sub :
430
+ sub (wf )
431
+
432
+ assert wf .checksum == checksum_before
433
+ results = wf .result ()
434
+
435
+ assert results .output .out == []
436
+ assert wf .output_dir .exists ()
437
+
438
+
397
439
@pytest .mark .parametrize ("plugin" , Plugins )
398
440
def test_wf_st_2 (plugin ):
399
441
""" workflow with one task, splitters and combiner for workflow"""
@@ -538,12 +580,60 @@ def test_wf_ndst_4(plugin):
538
580
539
581
@pytest .mark .parametrize ("plugin" , Plugins )
540
582
def test_wf_st_5 (plugin ):
541
- """ workflow with two tasks, outer splitter and combiner for the workflow """
583
+ """ workflow with two tasks, outer splitter and no combiner """
542
584
wf = Workflow (name = "wf_st_5" , input_spec = ["x" , "y" ])
543
585
wf .add (multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ))
544
586
wf .add (add2 (name = "add2" , x = wf .mult .lzout .out ))
545
587
546
588
wf .split (["x" , "y" ], x = [1 , 2 ], y = [11 , 12 ])
589
+ wf .set_output ([("out" , wf .add2 .lzout .out )])
590
+ wf .plugin = plugin
591
+
592
+ with Submitter (plugin = plugin ) as sub :
593
+ sub (wf )
594
+
595
+ results = wf .result ()
596
+ assert results [0 ].output .out == 13
597
+ assert results [1 ].output .out == 14
598
+ assert results [2 ].output .out == 24
599
+ assert results [3 ].output .out == 26
600
+ # checking all directories
601
+ assert wf .output_dir
602
+ for odir in wf .output_dir :
603
+ assert odir .exists ()
604
+
605
+
606
+ @pytest .mark .parametrize ("plugin" , Plugins )
607
+ def test_wf_ndst_5 (plugin ):
608
+ """ workflow with two tasks, outer splitter on tasks level and no combiner"""
609
+ wf = Workflow (name = "wf_ndst_5" , input_spec = ["x" , "y" ])
610
+ wf .add (multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ).split (["x" , "y" ]))
611
+ wf .add (add2 (name = "add2" , x = wf .mult .lzout .out ))
612
+ wf .inputs .x = [1 , 2 ]
613
+ wf .inputs .y = [11 , 12 ]
614
+ wf .set_output ([("out" , wf .add2 .lzout .out )])
615
+ wf .plugin = plugin
616
+
617
+ with Submitter (plugin = plugin ) as sub :
618
+ sub (wf )
619
+
620
+ results = wf .result ()
621
+ assert results .output .out [0 ] == 13
622
+ assert results .output .out [1 ] == 14
623
+ assert results .output .out [2 ] == 24
624
+ assert results .output .out [3 ] == 26
625
+ # checking the output directory
626
+ assert wf .output_dir .exists ()
627
+
628
+
629
+ @pytest .mark .parametrize ("plugin" , Plugins )
630
+ def test_wf_st_6 (plugin ):
631
+ """ workflow with two tasks, outer splitter and combiner for the workflow"""
632
+ wf = Workflow (name = "wf_st_6" , input_spec = ["x" , "y" ])
633
+ wf .add (multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ))
634
+ wf .add (add2 (name = "add2" , x = wf .mult .lzout .out ))
635
+
636
+ wf .split (["x" , "y" ], x = [1 , 2 , 3 ], y = [11 , 12 ])
547
637
wf .combine ("x" )
548
638
wf .set_output ([("out" , wf .add2 .lzout .out )])
549
639
wf .plugin = plugin
@@ -554,21 +644,23 @@ def test_wf_st_5(plugin):
554
644
results = wf .result ()
555
645
assert results [0 ][0 ].output .out == 13
556
646
assert results [0 ][1 ].output .out == 24
647
+ assert results [0 ][2 ].output .out == 35
557
648
assert results [1 ][0 ].output .out == 14
558
649
assert results [1 ][1 ].output .out == 26
650
+ assert results [1 ][2 ].output .out == 38
559
651
# checking all directories
560
652
assert wf .output_dir
561
653
for odir in wf .output_dir :
562
654
assert odir .exists ()
563
655
564
656
565
657
@pytest .mark .parametrize ("plugin" , Plugins )
566
- def test_wf_ndst_5 (plugin ):
658
+ def test_wf_ndst_6 (plugin ):
567
659
""" workflow with two tasks, outer splitter and combiner on tasks level"""
568
- wf = Workflow (name = "wf_ndst_5 " , input_spec = ["x" , "y" ])
660
+ wf = Workflow (name = "wf_ndst_6 " , input_spec = ["x" , "y" ])
569
661
wf .add (multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ).split (["x" , "y" ]))
570
662
wf .add (add2 (name = "add2" , x = wf .mult .lzout .out ).combine ("mult.x" ))
571
- wf .inputs .x = [1 , 2 ]
663
+ wf .inputs .x = [1 , 2 , 3 ]
572
664
wf .inputs .y = [11 , 12 ]
573
665
wf .set_output ([("out" , wf .add2 .lzout .out )])
574
666
wf .plugin = plugin
@@ -577,8 +669,9 @@ def test_wf_ndst_5(plugin):
577
669
sub (wf )
578
670
579
671
results = wf .result ()
580
- assert results .output .out [0 ] == [13 , 24 ]
581
- assert results .output .out [1 ] == [14 , 26 ]
672
+ assert results .output .out [0 ] == [13 , 24 , 35 ]
673
+ assert results .output .out [1 ] == [14 , 26 , 38 ]
674
+
582
675
# checking the output directory
583
676
assert wf .output_dir .exists ()
584
677
@@ -587,11 +680,11 @@ def test_wf_ndst_5(plugin):
587
680
588
681
589
682
@pytest .mark .parametrize ("plugin" , Plugins )
590
- def test_wf_st_6 (plugin ):
683
+ def test_wf_st_7 (plugin ):
591
684
""" workflow with three tasks, third one connected to two previous tasks,
592
685
splitter on the workflow level
593
686
"""
594
- wf = Workflow (name = "wf_st_6 " , input_spec = ["x" , "y" ])
687
+ wf = Workflow (name = "wf_st_7 " , input_spec = ["x" , "y" ])
595
688
wf .add (add2 (name = "add2x" , x = wf .lzin .x ))
596
689
wf .add (add2 (name = "add2y" , x = wf .lzin .y ))
597
690
wf .add (multiply (name = "mult" , x = wf .add2x .lzout .out , y = wf .add2y .lzout .out ))
@@ -615,11 +708,11 @@ def test_wf_st_6(plugin):
615
708
616
709
617
710
@pytest .mark .parametrize ("plugin" , Plugins )
618
- def test_wf_ndst_6 (plugin ):
711
+ def test_wf_ndst_7 (plugin ):
619
712
""" workflow with three tasks, third one connected to two previous tasks,
620
713
splitter on the tasks levels
621
714
"""
622
- wf = Workflow (name = "wf_ndst_6 " , input_spec = ["x" , "y" ])
715
+ wf = Workflow (name = "wf_ndst_7 " , input_spec = ["x" , "y" ])
623
716
wf .add (add2 (name = "add2x" , x = wf .lzin .x ).split ("x" ))
624
717
wf .add (add2 (name = "add2y" , x = wf .lzin .y ).split ("x" ))
625
718
wf .add (multiply (name = "mult" , x = wf .add2x .lzout .out , y = wf .add2y .lzout .out ))
@@ -639,11 +732,11 @@ def test_wf_ndst_6(plugin):
639
732
640
733
641
734
@pytest .mark .parametrize ("plugin" , Plugins )
642
- def test_wf_st_7 (plugin ):
735
+ def test_wf_st_8 (plugin ):
643
736
""" workflow with three tasks, third one connected to two previous tasks,
644
737
splitter and partial combiner on the workflow level
645
738
"""
646
- wf = Workflow (name = "wf_st_7 " , input_spec = ["x" , "y" ])
739
+ wf = Workflow (name = "wf_st_8 " , input_spec = ["x" , "y" ])
647
740
wf .add (add2 (name = "add2x" , x = wf .lzin .x ))
648
741
wf .add (add2 (name = "add2y" , x = wf .lzin .y ))
649
742
wf .add (multiply (name = "mult" , x = wf .add2x .lzout .out , y = wf .add2y .lzout .out ))
@@ -670,11 +763,11 @@ def test_wf_st_7(plugin):
670
763
671
764
672
765
@pytest .mark .parametrize ("plugin" , Plugins )
673
- def test_wf_ndst_7 (plugin ):
766
+ def test_wf_ndst_8 (plugin ):
674
767
""" workflow with three tasks, third one connected to two previous tasks,
675
768
splitter and partial combiner on the tasks levels
676
769
"""
677
- wf = Workflow (name = "wf_ndst_7 " , input_spec = ["x" , "y" ])
770
+ wf = Workflow (name = "wf_ndst_8 " , input_spec = ["x" , "y" ])
678
771
wf .add (add2 (name = "add2x" , x = wf .lzin .x ).split ("x" ))
679
772
wf .add (add2 (name = "add2y" , x = wf .lzin .y ).split ("x" ))
680
773
wf .add (
@@ -699,11 +792,11 @@ def test_wf_ndst_7(plugin):
699
792
700
793
701
794
@pytest .mark .parametrize ("plugin" , Plugins )
702
- def test_wf_st_8 (plugin ):
795
+ def test_wf_st_9 (plugin ):
703
796
""" workflow with three tasks, third one connected to two previous tasks,
704
797
splitter and partial combiner (from the second task) on the workflow level
705
798
"""
706
- wf = Workflow (name = "wf_st_8 " , input_spec = ["x" , "y" ])
799
+ wf = Workflow (name = "wf_st_9 " , input_spec = ["x" , "y" ])
707
800
wf .add (add2 (name = "add2x" , x = wf .lzin .x ))
708
801
wf .add (add2 (name = "add2y" , x = wf .lzin .y ))
709
802
wf .add (multiply (name = "mult" , x = wf .add2x .lzout .out , y = wf .add2y .lzout .out ))
@@ -730,11 +823,11 @@ def test_wf_st_8(plugin):
730
823
731
824
732
825
@pytest .mark .parametrize ("plugin" , Plugins )
733
- def test_wf_ndst_8 (plugin ):
826
+ def test_wf_ndst_9 (plugin ):
734
827
""" workflow with three tasks, third one connected to two previous tasks,
735
828
splitter and partial combiner (from the second task) on the tasks levels
736
829
"""
737
- wf = Workflow (name = "wf_ndst_8 " , input_spec = ["x" , "y" ])
830
+ wf = Workflow (name = "wf_ndst_9 " , input_spec = ["x" , "y" ])
738
831
wf .add (add2 (name = "add2x" , x = wf .lzin .x ).split ("x" ))
739
832
wf .add (add2 (name = "add2y" , x = wf .lzin .y ).split ("x" ))
740
833
wf .add (
@@ -760,11 +853,11 @@ def test_wf_ndst_8(plugin):
760
853
761
854
762
855
@pytest .mark .parametrize ("plugin" , Plugins )
763
- def test_wf_st_9 (plugin ):
856
+ def test_wf_st_10 (plugin ):
764
857
""" workflow with three tasks, third one connected to two previous tasks,
765
858
splitter and full combiner on the workflow level
766
859
"""
767
- wf = Workflow (name = "wf_st_9 " , input_spec = ["x" , "y" ])
860
+ wf = Workflow (name = "wf_st_10 " , input_spec = ["x" , "y" ])
768
861
wf .add (add2 (name = "add2x" , x = wf .lzin .x ))
769
862
wf .add (add2 (name = "add2y" , x = wf .lzin .y ))
770
863
wf .add (multiply (name = "mult" , x = wf .add2x .lzout .out , y = wf .add2y .lzout .out ))
@@ -790,11 +883,11 @@ def test_wf_st_9(plugin):
790
883
791
884
792
885
@pytest .mark .parametrize ("plugin" , Plugins )
793
- def test_wf_ndst_9 (plugin ):
886
+ def test_wf_ndst_10 (plugin ):
794
887
""" workflow with three tasks, third one connected to two previous tasks,
795
888
splitter and full combiner on the tasks levels
796
889
"""
797
- wf = Workflow (name = "wf_ndst_9 " , input_spec = ["x" , "y" ])
890
+ wf = Workflow (name = "wf_ndst_10 " , input_spec = ["x" , "y" ])
798
891
wf .add (add2 (name = "add2x" , x = wf .lzin .x ).split ("x" ))
799
892
wf .add (add2 (name = "add2y" , x = wf .lzin .y ).split ("x" ))
800
893
wf .add (
0 commit comments