Skip to content

Commit 6d1f04a

Browse files
author
Peter Amstutz
committed
Update README.md
1 parent 817ff81 commit 6d1f04a

File tree

4 files changed

+70
-120
lines changed

4 files changed

+70
-120
lines changed

README

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
This is a proof of concept web service for the Common Workflow Language. It
2+
works with any `cwl-runner` that supports the CWL standard command line interface:
3+
http://www.commonwl.org/draft-3/CommandLineTool.html#Executing_CWL_documents_as_scripts
4+
5+
Theory of operation:
6+
7+
* Accept job order via HTTP POST, create job and redirect to job URL
8+
* Client can poll for job status
9+
* Client can get streaming logs (stderr of `cwl-runner`)
10+
11+
Installation:
12+
13+
```
14+
python setup.py install
15+
```
16+
17+
Run standalone server:
18+
19+
```
20+
cwl-server
21+
```
22+
23+
Run a job, get status, get log:
24+
25+
```
26+
$ echo '{"message": "It works"}' | curl -L -X POST -d@- http://localhost:5000/run?wf=https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/draft-3/examples/1st-tool.cwl
27+
{
28+
"state": "Running",
29+
"run": "https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/draft-3/examples/1st-tool.cwl",
30+
"log": "http://localhost:5000/jobs/0/log",
31+
"input": {
32+
"message": "It works"
33+
},
34+
"output": null,
35+
"id": "http://localhost:5000/jobs/0"
36+
}
37+
$ curl http://localhost:5000/jobs/0
38+
{
39+
"state": "Success",
40+
"run": "https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/draft-3/examples/1st-tool.cwl",
41+
"log": "http://localhost:5000/jobs/0/log",
42+
"input": {
43+
"message": "It works"
44+
},
45+
"output": {},
46+
"id": "http://localhost:5000/jobs/0"
47+
}
48+
$ curl http://localhost:5000/jobs/0/log
49+
cwl-runner 1.0.20160518201549
50+
[job 1st-tool.cwl] /tmp/tmpKcoc_I$ echo \
51+
'It works'
52+
It works
53+
Final process status is success
54+
```

cwl_client.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

cwl_flask.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import signal
99
import threading
1010
import time
11+
import copy
1112

1213
app = Flask(__name__)
1314

@@ -122,6 +123,21 @@ def getlog(jobid):
122123
job = jobs[jobid]
123124
return Response(logspooler(job))
124125

126+
@app.route("/jobs", methods=['GET'])
127+
def getjobs():
128+
with jobs_lock:
129+
jobscopy = copy.copy(jobs)
130+
def spool(jc):
131+
yield "["
132+
first = True
133+
for j in jc:
134+
if first:
135+
yield json.dumps(j.getstatus(), indent=4)
136+
first = False
137+
else:
138+
yield ", " + json.dumps(j.getstatus(), indent=4)
139+
yield "]"
140+
return Response(spool(jobscopy))
125141

126142
if __name__ == "__main__":
127143
#app.debug = True

0 commit comments

Comments
 (0)