Skip to content

Commit

Permalink
fix empty scatter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed May 20, 2022
1 parent 84a297f commit f23e700
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cwltool/workflow_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def nested_crossproduct_scatter(
runtimeContext: RuntimeContext,
) -> JobsGeneratorType:
scatter_key = scatter_keys[0]
jobl = len(cast(Sized, joborder[scatter_key]))
jobl = len(cast(Sized, joborder[scatter_key])) if joborder[scatter_key] else 0
output = {} # type: ScatterDestinationsType
for i in process.tool["outputs"]:
output[i["id"]] = [None] * jobl
Expand Down Expand Up @@ -252,7 +252,7 @@ def _flat_crossproduct_scatter(
) -> Tuple[List[Optional[JobsGeneratorType]], int,]:
"""Inner loop."""
scatter_key = scatter_keys[0]
jobl = len(cast(Sized, joborder[scatter_key]))
jobl = len(cast(Sized, joborder[scatter_key])) if joborder[scatter_key] else 0
steps = [] # type: List[Optional[JobsGeneratorType]]
put = startindex
for index in range(0, jobl):
Expand Down Expand Up @@ -292,7 +292,7 @@ def dotproduct_scatter(
jobl = None # type: Optional[int]
for key in scatter_keys:
if jobl is None:
jobl = len(cast(Sized, joborder[key]))
jobl = len(cast(Sized, joborder[key])) if joborder[key] else 0
elif jobl != len(cast(Sized, joborder[key])):
raise WorkflowException(
"Length of input arrays must be equal when performing "
Expand Down Expand Up @@ -729,7 +729,9 @@ def valueFromFunc(
runtimeContext.postScatterEval = postScatterEval

emptyscatter = [
shortname(s) for s in scatter if len(cast(Sized, inputobj[s])) == 0
shortname(s)
for s in scatter
if not inputobj[s] or len(cast(Sized, inputobj[s])) == 0
]
if emptyscatter:
_logger.warning(
Expand Down

0 comments on commit f23e700

Please sign in to comment.