Skip to content

Commit f23e700

Browse files
committed
fix empty scatter bug
1 parent 84a297f commit f23e700

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cwltool/workflow_job.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def nested_crossproduct_scatter(
172172
runtimeContext: RuntimeContext,
173173
) -> JobsGeneratorType:
174174
scatter_key = scatter_keys[0]
175-
jobl = len(cast(Sized, joborder[scatter_key]))
175+
jobl = len(cast(Sized, joborder[scatter_key])) if joborder[scatter_key] else 0
176176
output = {} # type: ScatterDestinationsType
177177
for i in process.tool["outputs"]:
178178
output[i["id"]] = [None] * jobl
@@ -252,7 +252,7 @@ def _flat_crossproduct_scatter(
252252
) -> Tuple[List[Optional[JobsGeneratorType]], int,]:
253253
"""Inner loop."""
254254
scatter_key = scatter_keys[0]
255-
jobl = len(cast(Sized, joborder[scatter_key]))
255+
jobl = len(cast(Sized, joborder[scatter_key])) if joborder[scatter_key] else 0
256256
steps = [] # type: List[Optional[JobsGeneratorType]]
257257
put = startindex
258258
for index in range(0, jobl):
@@ -292,7 +292,7 @@ def dotproduct_scatter(
292292
jobl = None # type: Optional[int]
293293
for key in scatter_keys:
294294
if jobl is None:
295-
jobl = len(cast(Sized, joborder[key]))
295+
jobl = len(cast(Sized, joborder[key])) if joborder[key] else 0
296296
elif jobl != len(cast(Sized, joborder[key])):
297297
raise WorkflowException(
298298
"Length of input arrays must be equal when performing "
@@ -729,7 +729,9 @@ def valueFromFunc(
729729
runtimeContext.postScatterEval = postScatterEval
730730

731731
emptyscatter = [
732-
shortname(s) for s in scatter if len(cast(Sized, inputobj[s])) == 0
732+
shortname(s)
733+
for s in scatter
734+
if not inputobj[s] or len(cast(Sized, inputobj[s])) == 0
733735
]
734736
if emptyscatter:
735737
_logger.warning(

0 commit comments

Comments
 (0)