Skip to content

Commit c1824a9

Browse files
author
Peter Amstutz
committed
Update arvados backend for latest WES
1 parent 3b2df6b commit c1824a9

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'connexion',
3131
'bravado',
3232
'ruamel.yaml >= 0.12.4, < 0.15',
33-
'cwl-runner'
33+
'cwlref-runner'
3434
],
3535
entry_points={
3636
'console_scripts': [ "wes-server=wes_service:main",

testdata/md5sum.cwl.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"input_file": {
33
"class": "File",
4-
"path": "../../testdata/md5sum.input"
5-
},
6-
"output_file": {
7-
"class": "File",
8-
"path": "/tmp/md5sum.txt"
4+
"path": "md5sum.input"
95
}
10-
}
6+
}

wes_client/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ def main(argv=sys.argv[1:]):
8080
basedir = os.path.dirname(args.job_order)
8181

8282
def fixpaths(d):
83+
if isinstance(d, dict) and "path" in d:
84+
local_path = os.path.normpath(
85+
os.path.join(os.getcwd(), basedir, d["path"]))
86+
del d["path"]
87+
d["location"] = urllib.pathname2url(local_path)
8388
if isinstance(d, dict) and "location" in d:
8489
if ":" not in d["location"]:
8590
local_path = os.path.normpath(

wes_service/arvados_wes.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import arvados
2+
import arvados.util
23
import arvados.collection
34
import os
45
import connexion
@@ -17,11 +18,11 @@ def get_api():
1718

1819

1920
statemap = {
20-
"Queued": "Queued",
21-
"Locked": "Initializing",
22-
"Running": "Running",
23-
"Complete": "Complete",
24-
"Cancelled": "Canceled"
21+
"Queued": "QUEUED",
22+
"Locked": "INITIALIZING",
23+
"Running": "RUNNING",
24+
"Complete": "COMPLETE",
25+
"Cancelled": "CANCELED"
2526
}
2627

2728

@@ -31,8 +32,8 @@ def GetServiceInfo(self):
3132
"workflow_type_versions": {
3233
"CWL": ["v1.0"]
3334
},
34-
"supported_wes_versions": "0.1.0",
35-
"supported_filesystem_protocols": ["file"],
35+
"supported_wes_versions": "0.2.1",
36+
"supported_filesystem_protocols": ["file", "http", "https", "keep"],
3637
"engine_versions": "cwl-runner",
3738
"system_state_counts": {},
3839
"key_values": {}
@@ -41,19 +42,21 @@ def GetServiceInfo(self):
4142
def ListWorkflows(self):
4243
api = get_api()
4344

44-
requests = api.container_requests().list(
45-
filters=[["requesting_container_uuid", "=", None]],
46-
select=["uuid", "command", "container_uuid"]).execute()
47-
containers = api.containers().list(filters=[["uuid", "in", [w["container_uuid"] for w in requests["items"]]]], # NOQA
48-
select=["uuid", "state"]).execute()
45+
requests = arvados.util.list_all(api.container_requests().list,
46+
filters=[["requesting_container_uuid", "=", None],
47+
["container_uuid", "!=", None]],
48+
select=["uuid", "command", "container_uuid"])
49+
containers = arvados.util.list_all(api.containers().list,
50+
filters=[["uuid", "in", [w["container_uuid"] for w in requests]]],
51+
select=["uuid", "state"])
4952

50-
uuidmap = {c["uuid"]: statemap[c["state"]] for c in containers["items"]} # NOQA
53+
uuidmap = {c["uuid"]: statemap[c["state"]] for c in containers}
5154

5255
return {
5356
"workflows": [{"workflow_id": cr["uuid"],
54-
"state": uuidmap[cr["container_uuid"]]}
55-
for cr in requests["items"]
56-
if cr["command"][0] == "arvados-cwl-runner"],
57+
"state": uuidmap.get(cr["container_uuid"])}
58+
for cr in requests
59+
if cr["command"] and cr["command"][0] == "arvados-cwl-runner"],
5760
"next_page_token": ""
5861
}
5962

@@ -114,7 +117,7 @@ def keepref(d):
114117
"outputs": outputobj
115118
}
116119
if container["exit_code"] is not None:
117-
r["workflow_log"]["exitCode"] = container["exit_code"]
120+
r["workflow_log"]["exit_code"] = container["exit_code"]
118121
return r
119122

120123
def CancelJob(self, workflow_id): # NOQA

0 commit comments

Comments
 (0)