Skip to content

Commit 19e4214

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

File tree

3 files changed

+9
-37
lines changed

3 files changed

+9
-37
lines changed

src/sophios/apis/rest/api.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
2-
# import argparse
32
import copy
43
import yaml
54

@@ -9,11 +8,11 @@
98
from fastapi.middleware.cors import CORSMiddleware
109

1110
from sophios import __version__, compiler
12-
from sophios import run_local, input_output
11+
from sophios import input_output
1312
from sophios.utils_graphs import get_graph_reps
1413
from sophios.utils_yaml import wic_loader
1514
from sophios import utils_cwl
16-
from sophios.post_compile import cwl_inline_runtag, verify_container_engine_config
15+
from sophios.post_compile import cwl_inline_runtag
1716
from sophios.cli import get_args
1817
from sophios.wic_types import CompilerInfo, Json, Tool, Tools, StepId, YamlTree, Cwl, NodeData
1918
from sophios.apis.utils import converter
@@ -41,33 +40,6 @@ def remove_dot_dollar(tree: Cwl) -> Cwl:
4140
return tree_no_dd
4241

4342

44-
# def run_workflow(compiler_info: CompilerInfo, args: argparse.Namespace) -> int:
45-
# """
46-
# Get the Sophios yaml tree from incoming JSON
47-
# Args:
48-
# req (JSON): A raw JSON content of incoming JSON object
49-
# Returns:
50-
# Cwl: A Cwl document with . and $ removed from $namespaces and $schemas
51-
# """
52-
# # ========= WRITE OUT =======================
53-
# basepath = 'autogenerated'
54-
# input_output.write_to_disk(compiler_info.rose, Path(basepath), relative_run_path=True)
55-
# # ======== TEST RUN =========================
56-
# # verify container_engine install and config
57-
# verify_container_engine_config(args.container_engine, args.ignore_docker_install)
58-
# run_args_dict = {}
59-
# run_args_dict['container_engine'] = args.container_engine
60-
# run_args_dict['cwl_runner'] = args.cwl_runner
61-
# run_args_dict['copy_output_files'] = str(args.copy_output_files)
62-
# rose_tree = compiler_info.rose
63-
# retval = run_local.run_local(run_args_dict, False, passthrough_args=[],
64-
# workflow_name=rose_tree.data.name, basepath=basepath)
65-
# retval_local = 1
66-
# if retval:
67-
# retval_local = retval
68-
# return retval_local
69-
70-
7143
app = FastAPI()
7244

7345
origins = ["*"]

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)