Skip to content

Commit c323c86

Browse files
authored
Fixes 2.2 (#6)
* Add pypi rst readme pypi does not like markdown. * Add md5sum test data from GA4GH dream * Safely check options, close #3 * Add example using md5sum in test data * Clarify readme and add cwl-runner reqt thx @achave11
1 parent 21d4732 commit c323c86

File tree

8 files changed

+206
-17
lines changed

8 files changed

+206
-17
lines changed

README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,71 @@ It provides an [Arvados](https://github.com/curoverse/arvados) backend. It
88
also works with any `cwl-runner` that supports the CWL standard command line
99
interface: http://www.commonwl.org/v1.0/CommandLineTool.html#Executing_CWL_documents_as_scripts
1010

11-
Installation:
11+
## Installation:
1212

1313
```
1414
pip install wes-service
1515
```
1616

17+
## Usage
18+
1719
Run a standalone server with default `cwl-runner` backend:
1820

1921
```
2022
$ wes-server
2123
```
2224

23-
Submit a workflow to run:
25+
### Submit a workflow to run:
26+
27+
Note! All inputs files must be accessible from the filesystem.
2428

2529
```
26-
$ wes-client --host=localhost:8080 myworkflow.cwl myjob.json
30+
$ wes-client --host=localhost:8080 testdata/md5sum.cwl testdata/md5sum.cwl.json
2731
```
2832

29-
List workflows:
33+
### List workflows
3034

3135
```
32-
$ wes-client --list
36+
$ wes-client --proto http --host=locahost:8080 --list
3337
```
3438

35-
Get workflow status:
39+
### Get workflow status
3640

3741
```
38-
$ wes-client --get <workflow-id>
42+
$ wes-client --proto http --host=locahost:8080 --get <workflow-id>
3943
```
4044

41-
Get stderr log from workflow:
45+
### Get stderr log from workflow:
4246

4347
```
44-
$ wes-client --log <workflow-id>
48+
$ wes-client --proto http --host=locahost:8080 --log <workflow-id>
4549
```
4650

47-
# Server Options
51+
## Server Configuration
4852

49-
## Run a standalone server with Arvados backend:
53+
### Run a standalone server with Arvados backend:
5054

5155
```
5256
$ wes-server --backend=wes_service.arvados_wes
5357
```
5458

55-
## Use a different executable with cwl_runner backend
59+
### Use a different executable with cwl_runner backend
5660

5761
```
5862
$ wes-server --backend=wes_service.cwl_runner --opt runner=cwltoil
5963
```
6064

61-
## Pass parameters to cwl-runner
65+
### Pass parameters to cwl-runner
6266

6367
```
6468
$ wes-server --backend=wes_service.cwl_runner --opt extra=--workDir=/
6569
```
6670

67-
# Client environment options
71+
## Client Configuration
72+
73+
These options will be read in as defaults when running the client from the
74+
command line. The default protocol is https, to support secure communications,
75+
but the server starts using http, to ease development.
6876

6977
Set service endpoint:
7078

@@ -83,3 +91,6 @@ Set the protocol (one of http, https)
8391
```
8492
$ export WES_API_PROTO=http
8593
```
94+
95+
Then, when you call `wes-client` these defaults will be used in place of the
96+
flags, `--host`, `--auth`, and `proto` respectively.

README.pypi.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Workflow as a Service
2+
=====================
3+
4+
This provides client and server implementations of the `GA4GH Workflow
5+
Execution
6+
Service <https://github.com/ga4gh/workflow-execution-schemas>`__ API for
7+
the Common Workflow Language.
8+
9+
It provides an `Arvados <https://github.com/curoverse/arvados>`__
10+
backend. It also works with any ``cwl-runner`` that supports the CWL
11+
standard command line interface:
12+
http://www.commonwl.org/v1.0/CommandLineTool.html#Executing\_CWL\_documents\_as\_scripts
13+
14+
Installation:
15+
16+
::
17+
18+
pip install wes-service
19+
20+
Run a standalone server with default ``cwl-runner`` backend:
21+
22+
::
23+
24+
$ wes-server
25+
26+
Submit a workflow to run:
27+
28+
::
29+
30+
$ wes-client --host=localhost:8080 myworkflow.cwl myjob.json
31+
32+
List workflows:
33+
34+
::
35+
36+
$ wes-client --list
37+
38+
Get workflow status:
39+
40+
::
41+
42+
$ wes-client --get <workflow-id>
43+
44+
Get stderr log from workflow:
45+
46+
::
47+
48+
$ wes-client --log <workflow-id>
49+
50+
Server Options
51+
==============
52+
53+
Run a standalone server with Arvados backend:
54+
---------------------------------------------
55+
56+
::
57+
58+
$ wes-server --backend=wes_service.arvados_wes
59+
60+
Use a different executable with cwl\_runner backend
61+
---------------------------------------------------
62+
63+
::
64+
65+
$ wes-server --backend=wes_service.cwl_runner --opt runner=cwltoil
66+
67+
Pass parameters to cwl-runner
68+
-----------------------------
69+
70+
::
71+
72+
$ wes-server --backend=wes_service.cwl_runner --opt extra=--workDir=/
73+
74+
Client environment options
75+
==========================
76+
77+
Set service endpoint:
78+
79+
::
80+
81+
$ export WES_API_HOST=localhost:8080
82+
83+
Set the value to pass in the ``Authorization`` header:
84+
85+
::
86+
87+
$ export WES_API_AUTH=my_api_token
88+
89+
Set the protocol (one of http, https)
90+
91+
::
92+
93+
$ export WES_API_PROTO=http

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
from setuptools import setup, find_packages
99

1010
SETUP_DIR = os.path.dirname(__file__)
11-
README = os.path.join(SETUP_DIR, 'README.md')
11+
12+
long_description = ""
13+
14+
with open("README.pypi.rst") as readmeFile:
15+
long_description = readmeFile.read()
1216

1317
setup(name='wes-service',
1418
version='2.1',
1519
description='GA4GH Workflow Execution Service reference implementation',
16-
long_description=open(README).read(),
20+
long_description=long_description,
1721
author='GA4GH Containers and Workflows task team',
1822
author_email='[email protected]',
1923
url="https://github.com/common-workflow-language/cwltool-service",
@@ -26,6 +30,7 @@
2630
'connexion',
2731
'bravado',
2832
'ruamel.yaml >= 0.12.4, < 0.15',
33+
'cwl-runner'
2934
],
3035
entry_points={
3136
'console_scripts': [ "wes-server=wes_service:main",

testdata/dockstore-tool-md5sum.cwl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
class: CommandLineTool
4+
id: Md5sum
5+
label: Simple md5sum tool
6+
cwlVersion: v1.0
7+
8+
$namespaces:
9+
dct: http://purl.org/dc/terms/
10+
foaf: http://xmlns.com/foaf/0.1/
11+
12+
doc: |
13+
[![Docker Repository on Quay.io](https://quay.io/repository/briandoconnor/dockstore-tool-md5sum/status "Docker Repository on Quay.io")](https://quay.io/repository/briandoconnor/dockstore-tool-md5sum)
14+
[![Build Status](https://travis-ci.org/briandoconnor/dockstore-tool-md5sum.svg)](https://travis-ci.org/briandoconnor/dockstore-tool-md5sum)
15+
A very, very simple Docker container for the md5sum command. See the [README](https://github.com/briandoconnor/dockstore-tool-md5sum/blob/master/README.md) for more information.
16+
17+
18+
#dct:creator:
19+
# '@id': http://orcid.org/0000-0002-7681-6415
20+
# foaf:name: Brian O'Connor
21+
# foaf:mbox: [email protected]
22+
23+
requirements:
24+
- class: DockerRequirement
25+
dockerPull: quay.io/briandoconnor/dockstore-tool-md5sum:1.0.4
26+
- class: InlineJavascriptRequirement
27+
28+
hints:
29+
- class: ResourceRequirement
30+
# The command really requires very little resources.
31+
coresMin: 1
32+
ramMin: 1024
33+
outdirMin: 512
34+
35+
inputs:
36+
input_file:
37+
type: File
38+
inputBinding:
39+
position: 1
40+
doc: The file that will have its md5sum calculated.
41+
42+
outputs:
43+
output_file:
44+
type: File
45+
format: http://edamontology.org/data_3671
46+
outputBinding:
47+
glob: md5sum.txt
48+
doc: A text file that contains a single line that is the md5sum of the input file.
49+
50+
baseCommand: [/bin/my_md5sum]
51+

testdata/md5sum.cwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cwlVersion: v1.0
2+
class: Workflow
3+
4+
inputs:
5+
input_file: File
6+
7+
outputs:
8+
output_file:
9+
type: File
10+
outputSource: md5sum/output_file
11+
12+
steps:
13+
md5sum:
14+
run: dockstore-tool-md5sum.cwl
15+
in:
16+
input_file: input_file
17+
out: [output_file]
18+

testdata/md5sum.cwl.json

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

testdata/md5sum.input

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello

wes_service/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def visit(d, op):
1010
class WESBackend(object):
1111
def __init__(self, opts):
1212
self.pairs = []
13-
for o in opts:
13+
for o in opts if opts else []:
1414
k, v = o.split("=", 1)
1515
self.pairs.append((k, v))
1616

0 commit comments

Comments
 (0)