File tree Expand file tree Collapse file tree 4 files changed +70
-120
lines changed Expand file tree Collapse file tree 4 files changed +70
-120
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ ```
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
import signal
9
9
import threading
10
10
import time
11
+ import copy
11
12
12
13
app = Flask (__name__ )
13
14
@@ -122,6 +123,21 @@ def getlog(jobid):
122
123
job = jobs [jobid ]
123
124
return Response (logspooler (job ))
124
125
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 ))
125
141
126
142
if __name__ == "__main__" :
127
143
#app.debug = True
You can’t perform that action at this time.
0 commit comments