Skip to content

Commit afbe002

Browse files
committed
WDL support.
1 parent fa314d2 commit afbe002

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

wes_client/wes_client_main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import logging
1111
import schema_salad.ref_resolver
1212
import requests
13-
from requests.exceptions import InvalidSchema
13+
from requests.exceptions import InvalidSchema, MissingSchema
1414
from wes_service.util import visit
1515
from bravado.client import SwaggerClient
1616
from bravado.requests_client import RequestsClient
@@ -81,6 +81,13 @@ def main(argv=sys.argv[1:]):
8181
json.dump(response.result(), sys.stdout, indent=4)
8282
return 0
8383

84+
if args.workflow_url.lower().endswith('wdl'):
85+
wf_type = 'WDL'
86+
elif args.workflow_url.lower().endswith('cwl'):
87+
wf_type = 'CWL'
88+
elif args.workflow_url.lower().endswith('py'):
89+
wf_type = 'PY'
90+
8491
loader = schema_salad.ref_resolver.Loader({
8592
"location": {"@type": "@id"},
8693
"path": {"@type": "@id"}
@@ -112,7 +119,7 @@ def fixpaths(d):
112119

113120
parts = [
114121
("workflow_params", json.dumps(input_dict)),
115-
("workflow_type", "CWL"),
122+
("workflow_type", wf_type),
116123
("workflow_type_version", "v1.0")
117124
]
118125
if workflow_url.startswith("file://"):
@@ -163,6 +170,8 @@ def fixpaths(d):
163170
logging.info("Workflow log:\n" + logs)
164171
except InvalidSchema:
165172
logging.info("Workflow log:\n" + str(s["workflow_log"]["stderr"]))
173+
except MissingSchema:
174+
logging.info("Workflow log:\n" + str(s["workflow_log"]["stderr"]))
166175

167176
if "fields" in s["outputs"] and s["outputs"]["fields"] is None:
168177
del s["outputs"]["fields"]

wes_service/toil_wes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def write_workflow(self, request, opts, wftype='cwl'):
5353
if wftype == 'cwl':
5454
command_args = ['toil-cwl-runner'] + extra + [workflow_url, self.input_json]
5555
elif wftype == 'wdl':
56+
if workflow_url.startswith('http://') or workflow_url.startswith('https://'):
57+
subprocess.check_call(['wget', workflow_url])
58+
workflow_url = os.path.abspath(workflow_url.split('/')[-1])
5659
command_args = ['toil-wdl-runner'] + extra + [workflow_url, self.input_json]
5760
assert(os.path.exists(workflow_url), workflow_url)
5861
with open(workflow_url, 'r') as f:

0 commit comments

Comments
 (0)