Skip to content

Commit

Permalink
WDL.values_from_json: remove extra subworkflow name component from in…
Browse files Browse the repository at this point in the history
…put keys
  • Loading branch information
mlin committed Dec 6, 2019
1 parent 49456fc commit 4369f07
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions WDL/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ def values_from_json(
key2 = key
if namespace and key.startswith(namespace):
key2 = key[len(namespace) :]
if key2 not in available:
# attempt to simplify <call>.<subworkflow>.<input>
key2parts = key2.split(".")
if len(key2parts) == 3 and key2parts[0] and key2parts[1] and key2parts[2]:
key2 = ".".join([key2parts[0], key2parts[2]])
try:
ty = available[key2].type
except KeyError:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_6workflowrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,20 @@ def test_subworkflow(self):
self.assertEqual(outputs["sums"], [1, 5, 14])
self.assertEqual(outputs["sum"], 20)

subwf_input = R"""
version 1.0
import "sum_sq.wdl" as lib
workflow subwf_input {
call lib.sum_sq as summer
output {
Int ans = summer.ans
}
}
"""
self._test_workflow(subwf_input, {"summer.n": 3})
self._test_workflow(subwf_input, {"summer.sum_sq.n": 3})

def test_host_file_access(self):
exn = self._test_workflow("""
version 1.0
Expand Down

0 comments on commit 4369f07

Please sign in to comment.