Skip to content

Commit 5a7bc98

Browse files
author
Vasu Jaganath
committed
remove args from utils_cwl, remove args 4/n
1 parent 2de1107 commit 5a7bc98

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/sophios/compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
213213
graph_settings['graph_dark_theme'] = args.graph_dark_theme
214214
graph_settings['graph_inline_depth'] = args.graph_inline_depth
215215
graph_settings['graph_label_edges'] = args.graph_label_edges
216+
graph_settings['graph_show_outputs'] = args.graph_show_outputs
216217

217218
for i, step_key in enumerate(steps_keys):
218219
step_name_i = utils.step_name_str(yaml_stem, i, step_key)
@@ -827,7 +828,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
827828

828829
vars_workflow_output_internal = list(set(vars_workflow_output_internal)) # Get uniques
829830
# (Why are we getting uniques?)
830-
workflow_outputs = utils_cwl.get_workflow_outputs(args, namespaces, is_root, yaml_stem,
831+
workflow_outputs = utils_cwl.get_workflow_outputs(graph_settings, namespaces, is_root, yaml_stem,
831832
steps, outputs_workflow, vars_workflow_output_internal,
832833
graph, tools_lst, step_node_name, tools)
833834
# Add the provided workflow outputs to the workflow outputs from each step

src/sophios/utils_cwl.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import argparse
21
import copy
32
from pathlib import Path
43
from typing import Any, Dict, List
@@ -102,7 +101,7 @@ def add_yamldict_keyval_out(steps_i: Yaml, step_key: str, strs: List[str]) -> Ya
102101
return steps_i
103102

104103

105-
def get_workflow_outputs(args: argparse.Namespace,
104+
def get_workflow_outputs(graph_settings: Dict[str, Any],
106105
namespaces: Namespaces,
107106
is_root: bool,
108107
yaml_stem: str,
@@ -116,7 +115,7 @@ def get_workflow_outputs(args: argparse.Namespace,
116115
"""Chooses a subset of the CWL outputs: to actually output
117116
118117
Args:
119-
args (argparse.Namespace): The command line arguments
118+
graph_settings (Dict[str, Any]): The settings dict for graphpviz graphs
120119
namespaces (Namespaces): Specifies the path in the AST of the current subworkflow
121120
is_root (bool): True if this is the root workflow
122121
yaml_stem (str): The name of the current subworkflow (stem of the yaml filepath)
@@ -148,7 +147,7 @@ def get_workflow_outputs(args: argparse.Namespace,
148147
out_var = f'{step_name_or_key}/{out_key}'
149148
# Avoid duplicating intermediate outputs in GraphViz
150149
out_key_no_namespace = out_key.split('___')[-1]
151-
if args.graph_show_outputs:
150+
if graph_settings['graph_show_outputs']:
152151
vars_nss = [var.replace('/', '___') for var in vars_workflow_output_internal]
153152
case1 = (tool_i['class'] == 'Workflow') and (not out_key in vars_nss)
154153
# Avoid duplicating outputs from subgraphs in parent graphs.
@@ -164,8 +163,8 @@ def get_workflow_outputs(args: argparse.Namespace,
164163
attrs = {'label': out_key_no_namespace, 'shape': 'box',
165164
'style': 'rounded, filled', 'fillcolor': 'lightyellow'}
166165
graph_gv.node(namespaced_output_name, **attrs)
167-
font_edge_color = 'black' if args.graph_dark_theme else 'white'
168-
if args.graph_label_edges:
166+
font_edge_color = 'black' if graph_settings['graph_dark_theme'] else 'white'
167+
if graph_settings['graph_label_edges']:
169168
graph_gv.edge(step_node_name, namespaced_output_name, color=font_edge_color,
170169
label=out_key_no_namespace) # Is labeling necessary?
171170
else:

0 commit comments

Comments
 (0)