Skip to content

Commit 03feedf

Browse files
Fix #411: Incorrect length of input with few sources
Fix #411 If the source for step input has more than one type, it's added to result array for this input exactly the same number of times as the lenght of type list for this source. In function 'workflow.py/match_types' we don't need to check for all source types to be compatible with the sink, 'cos the source could be, for example, int and null, but the sink is only int. But it shouldn't cause an error, 'cos I may use the case when the source is null in valueFrom field. The reason why it doesn't fail right now is the bug in here https://github.com/common-workflow-language/cwltool/ blob/972b0a6d7c2e8abfb287ddedeee48938e76689c9/cwltool /workflow.py#L73 We should use sinktype instead of st. The solution is to check if at least one source type is compatible with the sink and than in linkMerge section additionally check for can_assign_src_to_sink
1 parent 1b27073 commit 03feedf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cwltool/workflow.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,16 @@ def match_types(sinktype, src, iid, inputobj, linkMerge, valueFrom):
6666
return True
6767
elif isinstance(src.parameter["type"], list):
6868
# Source is union type
69-
# Check that every source type is compatible with the sink.
69+
# Check that at least one source type is compatible with the sink.
7070
for st in src.parameter["type"]:
7171
srccopy = copy.deepcopy(src)
7272
srccopy.parameter["type"] = st
73-
if not match_types(st, srccopy, iid, inputobj, linkMerge, valueFrom):
74-
return False
75-
return True
73+
if match_types(sinktype, srccopy, iid, inputobj, linkMerge, valueFrom):
74+
return True
75+
return False
7676
elif linkMerge:
77+
if not can_assign_src_to_sink(src.parameter["type"], sinktype, strict = True):
78+
return False
7779
if iid not in inputobj:
7880
inputobj[iid] = []
7981
if linkMerge == "merge_nested":

0 commit comments

Comments
 (0)