Skip to content

Commit

Permalink
semi-fix the inline_cwl when using stock CLT names with REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasu Jaganath committed Oct 9, 2024
1 parent bed7a69 commit e8e48db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/sophios/api/http/restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ async def compile_wf(request: Request) -> Json:
compiler_info: CompilerInfo = compiler.compile_workflow(yaml_tree, args, [], [graph], {}, {}, {}, {},
tools_cwl, True, relative_run_path=True, testing=False)

rose_tree = compiler_info.rose
if args.inline_cwl_runtag:
input_output.write_to_disk(rose_tree, Path('autogenerated/'), True, args.inputs_file)
rose_tree = plugins.cwl_update_inline_runtag_rosetree(rose_tree, Path('autogenerated/'), True)
# ======== OUTPUT PROCESSING ================
# ========= PROCESS COMPILED OBJECT =========
sub_node_data: NodeData = compiler_info.rose.data
sub_node_data: NodeData = rose_tree.data
yaml_stem = sub_node_data.name
cwl_tree = sub_node_data.compiled_cwl
yaml_inputs = sub_node_data.workflow_inputs_file
Expand Down
17 changes: 9 additions & 8 deletions src/sophios/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,14 +880,15 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
newval['format'] = in_format
new_keyval = {key: newval}
elif 'Directory' == in_dict['type']:
if in_dict['value'].startswith('/'):
print("Warning! directory can not start with '/'")
print("It is most likely an incorrect path! Treating it as './' relative path")
in_dict['value'] = '.' + in_dict['value']
ldir = Path(in_dict['value'])
if not ldir.is_absolute():
ldir = Path('autogenerated') / ldir
ldir.mkdir(parents=True, exist_ok=True)
if not args.ignore_dir_path:
if in_dict['value'].startswith('/'):
print("Warning! directory can not start with '/'")
print("It is most likely an incorrect path! Can't create directories!")
sys.exit(1)
ldir = Path(in_dict['value'])
if not ldir.is_absolute():
ldir = Path('autogenerated') / ldir
ldir.mkdir(parents=True, exist_ok=True)
newval = {'class': 'Directory', 'location': in_dict['value']}
new_keyval = {key: newval}
# TODO: Check for all valid types?
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rest_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async def receive() -> Json:


@pytest.mark.fast
def test_rest_core_multi_node() -> None:
def test_rest_core_multi_node_file() -> None:
"""A simple multi node sophios/restapi test"""
inp_file = "multi_node.json"
inp: Json = {}
Expand Down

0 comments on commit e8e48db

Please sign in to comment.