Skip to content

Commit

Permalink
Better solution for simple scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-kotliar committed Oct 13, 2020
1 parent c39befa commit 6d5083b
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cwl_airflow/utilities/cwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,17 +673,23 @@ def fast_cwl_step_load(workflow, target_id, cwl_args=None, location=None):
))[0][1]
step_out_with_step_id = step_out.replace("/", "_") # to include both step name and id

if "scatter" in selected_step: # in case of scatter, wrap all outputs to arrays
selected_step_output_type = {
"type": "array",
"items": selected_step_output["type"]
}
else:
selected_step_output_type = selected_step_output["type"]
# update output type in case of scatter
if "scatter" in selected_step:
selected_step_output = deepcopy(selected_step_output) # need to deepcopy, otherwise we change embedded tool's output
if isinstance(selected_step["scatter"], MutableSequence) \
and selected_step.get("scatterMethod") == "nested_crossproduct":
nesting = len(selected_step["scatter"])
else:
nesting = 1
for _ in range(0, nesting):
selected_step_output["type"] = {
"type": "array",
"items": selected_step_output["type"]
}

workflow_outputs.append({
"id": step_out_with_step_id,
"type": selected_step_output_type,
"type": selected_step_output["type"],
"outputSource": step_out
})

Expand Down

0 comments on commit 6d5083b

Please sign in to comment.