Skip to content

Commit

Permalink
REST API Tests : remove redundant validation in old test and add new …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
Vasu Jaganath committed Sep 10, 2024
1 parent 8aaf2e3 commit 7d6553c
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 151 deletions.
17 changes: 1 addition & 16 deletions src/sophios/api/http/restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@ def remove_dot_dollar(tree: Cwl) -> Cwl:
return tree_no_dd


def get_yaml_tree(req: Json) -> Json:
"""
Get the Sophios yaml tree from incoming JSON
Args:
req (JSON): A raw JSON content of incoming JSON object
Returns:
Cwl: A Cwl document with . and $ removed from $namespaces and $schemas
"""
wkflw_name = "generic_workflow"
# args = converter.get_args(wkflw_name)
# yaml_tree_json: Json = converter.wfb_to_wic(req)
yaml_tree_json: Json = {}
return yaml_tree_json


def run_workflow(compiler_info: CompilerInfo, args: argparse.Namespace) -> int:
"""
Get the Sophios yaml tree from incoming JSON
Expand Down Expand Up @@ -116,8 +101,8 @@ async def compile_wf(request: Request) -> Json:
wkflw_name = "generic_workflow"
args = get_args(wkflw_name, ['--inline_cwl_runtag'])

# Build canonical workflow object
workflow_can = utils_cwl.desugar_into_canonical_normal_form(workflow_temp)
print(yaml.safe_dump(workflow_can, default_flow_style=False))

# ========= BUILD WIC COMPILE INPUT =========
# Build a list of CLTs
Expand Down
1 change: 0 additions & 1 deletion src/sophios/api/utils/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from jsonschema import Draft202012Validator
from sophios.utils_yaml import wic_loader

# from sophios import cli
from sophios.wic_types import Json, Cwl

SCHEMA: Json = {
Expand Down
76 changes: 76 additions & 0 deletions tests/multi_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"nodes": [
{
"id": 7,
"x": 462,
"y": 206,
"z": 2,
"name": "touch",
"pluginId": "touch",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"filename": "empty.txt"
},
"outputs": {
"file": "file_touch"
}
},
"internal": false
},
{
"id": 18,
"x": 155,
"y": 195,
"z": 1,
"name": "append",
"pluginId": "append",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"str": "Hello",
"file": "file_touch"
},
"outputs": {
"file": "file_append1"
}
},
"internal": false
},
{
"id": 9,
"x": 790.3254637299812,
"y": 449.8103498684344,
"z": 5,
"name": "append",
"pluginId": "append",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"str": "World!",
"file": "file_append1"
},
"outputs": {
"file": "file_append2"
}
},
"internal": false
}
],
"links": [
{
"sourceId": 7,
"targetId": 18,
"id": 1
},
{
"sourceId": 18,
"targetId": 9,
"id": 5
}
],
"selection": []
}
181 changes: 181 additions & 0 deletions tests/multi_node_inline_cwl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"nodes": [
{
"id": 7,
"x": 462,
"y": 206,
"z": 2,
"name": "touch",
"pluginId": "touch",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"filename": "empty.txt"
},
"outputs": {
"file": "file_touch"
}
},
"run": {
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"requirements": {
"DockerRequirement": {
"dockerPull": "docker.io/bash:4.4"
},
"InlineJavascriptRequirement": {}
},
"baseCommand": "touch",
"inputs": {
"filename": {
"type": "string",
"inputBinding": {
"position": 1
}
}
},
"outputs": {
"file": {
"type": "File",
"outputBinding": {
"glob": "$(inputs.filename)"
}
}
}
},
"internal": false
},
{
"id": 18,
"x": 155,
"y": 195,
"z": 1,
"name": "append",
"pluginId": "append",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"str": "Hello",
"file": "file_touch"
},
"outputs": {
"file": "file_append1"
}
},
"run": {
"class": "CommandLineTool",
"cwlVersion": "v1.0",
"requirements": {
"ShellCommandRequirement": {},
"InlineJavascriptRequirement": {},
"InitialWorkDirRequirement": {
"listing": [
"$(inputs.file)"
]
}
},
"inputs": {
"str": {
"type": "string",
"inputBinding": {
"shellQuote": false,
"position": 1,
"prefix": "echo"
}
},
"file": {
"type": "File",
"inputBinding": {
"shellQuote": false,
"position": 2,
"prefix": ">>"
}
}
},
"outputs": {
"file": {
"type": "File",
"outputBinding": {
"glob": "$(inputs.file.basename)"
}
}
}
},
"internal": false
},
{
"id": 9,
"x": 790.3254637299812,
"y": 449.8103498684344,
"z": 5,
"name": "append",
"pluginId": "append",
"height": 50,
"width": 250,
"settings": {
"inputs": {
"str": "World!",
"file": "file_append1"
},
"outputs": {
"file": "file_append2"
}
},
"run": {
"class": "CommandLineTool",
"cwlVersion": "v1.0",
"requirements": {
"ShellCommandRequirement": {},
"InlineJavascriptRequirement": {},
"InitialWorkDirRequirement": {
"listing": [
"$(inputs.file)"
]
}
},
"inputs": {
"str": {
"type": "string",
"inputBinding": {
"shellQuote": false,
"position": 1,
"prefix": "echo"
}
},
"file": {
"type": "File",
"inputBinding": {
"shellQuote": false,
"position": 2,
"prefix": ">>"
}
}
},
"outputs": {
"file": {
"type": "File",
"outputBinding": {
"glob": "$(inputs.file.basename)"
}
}
}
},
"internal": false
}
],
"links": [
{
"sourceId": 7,
"targetId": 18,
"id": 1
},
{
"sourceId": 18,
"targetId": 9,
"id": 5
}
],
"selection": []
}
File renamed without changes.
Loading

0 comments on commit 7d6553c

Please sign in to comment.