@@ -532,9 +532,9 @@ def test_wf_st_2(plugin):
532
532
sub (wf )
533
533
534
534
results = wf .result ()
535
- # expected: [[ ({"test7.x": 1}, 3), ({"test7.x": 2}, 4)] ]
536
- assert results [0 ][ 0 ] .output .out == 3
537
- assert results [0 ][ 1 ].output .out == 4
535
+ # expected: [({"test7.x": 1}, 3), ({"test7.x": 2}, 4)]
536
+ assert results [0 ].output .out == 3
537
+ assert results [1 ].output .out == 4
538
538
# checking all directories
539
539
assert wf .output_dir
540
540
for odir in wf .output_dir :
@@ -554,8 +554,8 @@ def test_wf_ndst_2(plugin):
554
554
sub (wf )
555
555
556
556
results = wf .result ()
557
- # expected: [[ ({"test7.x": 1}, 3), ({"test7.x": 2}, 4)] ]
558
- assert results .output .out [ 0 ] == [3 , 4 ]
557
+ # expected: [({"test7.x": 1}, 3), ({"test7.x": 2}, 4)]
558
+ assert results .output .out == [3 , 4 ]
559
559
assert wf .output_dir .exists ()
560
560
561
561
@@ -625,10 +625,10 @@ def test_wf_st_4(plugin):
625
625
626
626
results = wf .result ()
627
627
# expected: [
628
- # [ ({"test7.x": 1, "test7.y": 11}, 13), ({"test7.x": 2, "test.y": 12}, 26)]
628
+ # ({"test7.x": 1, "test7.y": 11}, 13), ({"test7.x": 2, "test.y": 12}, 26)
629
629
# ]
630
- assert results [0 ][ 0 ] .output .out == 13
631
- assert results [0 ][ 1 ].output .out == 26
630
+ assert results [0 ].output .out == 13
631
+ assert results [1 ].output .out == 26
632
632
# checking all directories
633
633
assert wf .output_dir
634
634
for odir in wf .output_dir :
@@ -652,9 +652,9 @@ def test_wf_ndst_4(plugin):
652
652
653
653
results = wf .result ()
654
654
# expected: [
655
- # [ ({"test7.x": 1, "test7.y": 11}, 13), ({"test7.x": 2, "test.y": 12}, 26)]
655
+ # ({"test7.x": 1, "test7.y": 11}, 13), ({"test7.x": 2, "test.y": 12}, 26)
656
656
# ]
657
- assert results .output .out [ 0 ] == [13 , 26 ]
657
+ assert results .output .out == [13 , 26 ]
658
658
# checking the output directory
659
659
assert wf .output_dir .exists ()
660
660
@@ -757,11 +757,81 @@ def test_wf_ndst_6(plugin):
757
757
assert wf .output_dir .exists ()
758
758
759
759
760
+ @pytest .mark .parametrize ("plugin" , Plugins )
761
+ def test_wf_ndst_7 (plugin ):
762
+ """ workflow with two tasks, outer splitter and (full) combiner for first node only"""
763
+ wf = Workflow (name = "wf_ndst_6" , input_spec = ["x" , "y" ])
764
+ wf .add (multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ).split ("x" ).combine ("x" ))
765
+ wf .add (identity (name = "iden" , x = wf .mult .lzout .out ))
766
+ wf .inputs .x = [1 , 2 , 3 ]
767
+ wf .inputs .y = 11
768
+ wf .set_output ([("out" , wf .iden .lzout .out )])
769
+ wf .plugin = plugin
770
+
771
+ with Submitter (plugin = plugin ) as sub :
772
+ sub (wf )
773
+
774
+ results = wf .result ()
775
+ assert results .output .out == [11 , 22 , 33 ]
776
+
777
+ # checking the output directory
778
+ assert wf .output_dir .exists ()
779
+
780
+
781
+ @pytest .mark .parametrize ("plugin" , Plugins )
782
+ def test_wf_ndst_8 (plugin ):
783
+ """ workflow with two tasks, outer splitter and (partial) combiner for first task only"""
784
+ wf = Workflow (name = "wf_ndst_6" , input_spec = ["x" , "y" ])
785
+ wf .add (
786
+ multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y ).split (["x" , "y" ]).combine ("x" )
787
+ )
788
+ wf .add (identity (name = "iden" , x = wf .mult .lzout .out ))
789
+ wf .inputs .x = [1 , 2 , 3 ]
790
+ wf .inputs .y = [11 , 12 ]
791
+ wf .set_output ([("out" , wf .iden .lzout .out )])
792
+ wf .plugin = plugin
793
+
794
+ with Submitter (plugin = plugin ) as sub :
795
+ sub (wf )
796
+
797
+ results = wf .result ()
798
+ assert results .output .out [0 ] == [11 , 22 , 33 ]
799
+ assert results .output .out [1 ] == [12 , 24 , 36 ]
800
+
801
+ # checking the output directory
802
+ assert wf .output_dir .exists ()
803
+
804
+
805
+ @pytest .mark .parametrize ("plugin" , Plugins )
806
+ def test_wf_ndst_9 (plugin ):
807
+ """ workflow with two tasks, outer splitter and (full) combiner for first task only"""
808
+ wf = Workflow (name = "wf_ndst_6" , input_spec = ["x" , "y" ])
809
+ wf .add (
810
+ multiply (name = "mult" , x = wf .lzin .x , y = wf .lzin .y )
811
+ .split (["x" , "y" ])
812
+ .combine (["x" , "y" ])
813
+ )
814
+ wf .add (identity (name = "iden" , x = wf .mult .lzout .out ))
815
+ wf .inputs .x = [1 , 2 , 3 ]
816
+ wf .inputs .y = [11 , 12 ]
817
+ wf .set_output ([("out" , wf .iden .lzout .out )])
818
+ wf .plugin = plugin
819
+
820
+ with Submitter (plugin = plugin ) as sub :
821
+ sub (wf )
822
+
823
+ results = wf .result ()
824
+ assert results .output .out == [11 , 12 , 22 , 24 , 33 , 36 ]
825
+
826
+ # checking the output directory
827
+ assert wf .output_dir .exists ()
828
+
829
+
760
830
# workflows with structures A -> C, B -> C
761
831
762
832
763
833
@pytest .mark .parametrize ("plugin" , Plugins )
764
- def test_wf_st_7 (plugin ):
834
+ def test_wf_3nd_st_1 (plugin ):
765
835
""" workflow with three tasks, third one connected to two previous tasks,
766
836
splitter on the workflow level
767
837
"""
@@ -789,7 +859,7 @@ def test_wf_st_7(plugin):
789
859
790
860
791
861
@pytest .mark .parametrize ("plugin" , Plugins )
792
- def test_wf_ndst_7 (plugin ):
862
+ def test_wf_3nd_ndst_1 (plugin ):
793
863
""" workflow with three tasks, third one connected to two previous tasks,
794
864
splitter on the tasks levels
795
865
"""
@@ -813,7 +883,7 @@ def test_wf_ndst_7(plugin):
813
883
814
884
815
885
@pytest .mark .parametrize ("plugin" , Plugins )
816
- def test_wf_st_8 (plugin ):
886
+ def test_wf_3nd_st_2 (plugin ):
817
887
""" workflow with three tasks, third one connected to two previous tasks,
818
888
splitter and partial combiner on the workflow level
819
889
"""
@@ -844,7 +914,7 @@ def test_wf_st_8(plugin):
844
914
845
915
846
916
@pytest .mark .parametrize ("plugin" , Plugins )
847
- def test_wf_ndst_8 (plugin ):
917
+ def test_wf_3nd_ndst_2 (plugin ):
848
918
""" workflow with three tasks, third one connected to two previous tasks,
849
919
splitter and partial combiner on the tasks levels
850
920
"""
@@ -873,7 +943,7 @@ def test_wf_ndst_8(plugin):
873
943
874
944
875
945
@pytest .mark .parametrize ("plugin" , Plugins )
876
- def test_wf_st_9 (plugin ):
946
+ def test_wf_3nd_st_3 (plugin ):
877
947
""" workflow with three tasks, third one connected to two previous tasks,
878
948
splitter and partial combiner (from the second task) on the workflow level
879
949
"""
@@ -904,7 +974,7 @@ def test_wf_st_9(plugin):
904
974
905
975
906
976
@pytest .mark .parametrize ("plugin" , Plugins )
907
- def test_wf_ndst_9 (plugin ):
977
+ def test_wf_3nd_ndst_3 (plugin ):
908
978
""" workflow with three tasks, third one connected to two previous tasks,
909
979
splitter and partial combiner (from the second task) on the tasks levels
910
980
"""
@@ -934,7 +1004,7 @@ def test_wf_ndst_9(plugin):
934
1004
935
1005
936
1006
@pytest .mark .parametrize ("plugin" , Plugins )
937
- def test_wf_st_10 (plugin ):
1007
+ def test_wf_3nd_st_4 (plugin ):
938
1008
""" workflow with three tasks, third one connected to two previous tasks,
939
1009
splitter and full combiner on the workflow level
940
1010
"""
@@ -950,21 +1020,21 @@ def test_wf_st_10(plugin):
950
1020
sub (wf )
951
1021
952
1022
results = wf .result ()
953
- assert len (results ) == 1
954
- assert results [0 ][ 0 ] .output .out == 39
955
- assert results [0 ][ 1 ].output .out == 42
956
- assert results [0 ][ 2 ].output .out == 52
957
- assert results [0 ][ 3 ].output .out == 56
958
- assert results [0 ][ 4 ].output .out == 65
959
- assert results [0 ][ 5 ].output .out == 70
1023
+ assert len (results ) == 6
1024
+ assert results [0 ].output .out == 39
1025
+ assert results [1 ].output .out == 42
1026
+ assert results [2 ].output .out == 52
1027
+ assert results [3 ].output .out == 56
1028
+ assert results [4 ].output .out == 65
1029
+ assert results [5 ].output .out == 70
960
1030
# checking all directories
961
1031
assert wf .output_dir
962
1032
for odir in wf .output_dir :
963
1033
assert odir .exists ()
964
1034
965
1035
966
1036
@pytest .mark .parametrize ("plugin" , Plugins )
967
- def test_wf_ndst_10 (plugin ):
1037
+ def test_wf_3nd_ndst_4 (plugin ):
968
1038
""" workflow with three tasks, third one connected to two previous tasks,
969
1039
splitter and full combiner on the tasks levels
970
1040
"""
@@ -986,8 +1056,8 @@ def test_wf_ndst_10(plugin):
986
1056
# assert wf.output_dir.exists()
987
1057
results = wf .result ()
988
1058
989
- assert len (results .output .out ) == 1
990
- assert results .output .out == [[ 39 , 42 , 52 , 56 , 65 , 70 ] ]
1059
+ assert len (results .output .out ) == 6
1060
+ assert results .output .out == [39 , 42 , 52 , 56 , 65 , 70 ]
991
1061
# checking the output directory
992
1062
assert wf .output_dir .exists ()
993
1063
@@ -1284,8 +1354,8 @@ def test_wf_st_singl_1(plugin):
1284
1354
sub (wf )
1285
1355
1286
1356
results = wf .result ()
1287
- assert results [0 ][ 0 ] .output .out == 13
1288
- assert results [0 ][ 1 ].output .out == 24
1357
+ assert results [0 ].output .out == 13
1358
+ assert results [1 ].output .out == 24
1289
1359
# checking all directories
1290
1360
assert wf .output_dir
1291
1361
for odir in wf .output_dir :
@@ -1309,7 +1379,7 @@ def test_wf_ndst_singl_1(plugin):
1309
1379
sub (wf )
1310
1380
1311
1381
results = wf .result ()
1312
- assert results .output .out [ 0 ] == [13 , 24 ]
1382
+ assert results .output .out == [13 , 24 ]
1313
1383
# checking the output directory
1314
1384
assert wf .output_dir .exists ()
1315
1385
@@ -2665,7 +2735,7 @@ def test_workflow_combine1(tmpdir):
2665
2735
2666
2736
assert result .output .out_pow == [1 , 1 , 4 , 8 ]
2667
2737
assert result .output .out_iden1 == [[1 , 4 ], [1 , 8 ]]
2668
- assert result .output .out_iden2 == [[[ 1 , 4 ], [1 , 8 ] ]]
2738
+ assert result .output .out_iden2 == [[1 , 4 ], [1 , 8 ]]
2669
2739
2670
2740
2671
2741
def test_workflow_combine2 (tmpdir ):
@@ -2679,7 +2749,7 @@ def test_workflow_combine2(tmpdir):
2679
2749
result = wf1 (plugin = "cf" )
2680
2750
2681
2751
assert result .output .out_pow == [[1 , 4 ], [1 , 8 ]]
2682
- assert result .output .out_iden == [[[ 1 , 4 ], [1 , 8 ] ]]
2752
+ assert result .output .out_iden == [[1 , 4 ], [1 , 8 ]]
2683
2753
2684
2754
2685
2755
# testing lzout.all to collect all of the results and let FunctionTask deal with it
0 commit comments