Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix step_key evaluation in get_workflow_outputs #246

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/sophios/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,8 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
vars_workflow_output_internal = list(set(vars_workflow_output_internal)) # Get uniques
# (Why are we getting uniques?)
workflow_outputs = utils_cwl.get_workflow_outputs(args, namespaces, is_root, yaml_stem,
steps, outputs_workflow, vars_workflow_output_internal, graph, tools_lst, step_node_name)
steps, outputs_workflow, vars_workflow_output_internal,
graph, tools_lst, step_node_name, tools)
# Add the provided workflow outputs to the workflow outputs from each step
outputs_combined = {**yaml_tree.get('outputs', {}), **workflow_outputs}
yaml_tree.update({'outputs': outputs_combined})
Expand Down
8 changes: 6 additions & 2 deletions src/sophios/utils_cwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from . import utils
from .wic_types import (GraphReps, InternalOutputs, Namespaces, Tool, Tools,
WorkflowOutputs, Yaml)
WorkflowOutputs, Yaml, StepId)


def maybe_add_requirements(yaml_tree: Yaml, steps_keys: List[str],
Expand Down Expand Up @@ -110,7 +110,8 @@ def get_workflow_outputs(args: argparse.Namespace,
vars_workflow_output_internal: InternalOutputs,
graph: GraphReps,
tools_lst: List[Tool],
step_node_name: str) -> Dict[str, Dict[str, str]]:
step_node_name: str,
tools: Tools) -> Dict[str, Dict[str, str]]:
"""Chooses a subset of the CWL outputs: to actually output

Args:
Expand All @@ -125,6 +126,7 @@ def get_workflow_outputs(args: argparse.Namespace,
graph (GraphReps): A tuple of a GraphViz DiGraph and a networkx DiGraph
tools_lst (List[Tool]): A list of the CWL CommandLineTools or compiled subworkflows for the current workflow.
step_node_name (str): The namespaced name of the current step
tools (Tools): The CWL CommandLineTool definitions found using get_tools_cwl()

Returns:
Dict[str, Dict[str, str]]: The actual outputs to be specified in the generated CWL file
Expand All @@ -135,7 +137,9 @@ def get_workflow_outputs(args: argparse.Namespace,
for i, step_key in enumerate(steps_keys):
tool_i = tools_lst[i].cwl
step_name_i = utils.step_name_str(yaml_stem, i, step_key)
step_id = StepId(Path(step_key).stem, 'global')
step_name_or_key = step_name_i if step_key.endswith('.wic') \
or step_id in tools \
or Path(step_key).stem == Path(tools_lst[i].run_path).stem else step_key
# step_name_or_key = step_name_i if stepid in tools else step_key
out_keys = steps[i]['out']
Expand Down
Loading