Skip to content

Commit 7239e51

Browse files
author
Toby Hodges
committed
Merge branch 'gh-pages' of github.com:common-workflow-language/user_guide into shebang
2 parents f39f788 + 0f2a576 commit 7239e51

File tree

12 files changed

+104
-72
lines changed

12 files changed

+104
-72
lines changed

_episodes/01-introduction.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ technologies such as Docker, be used with CWL implementations from different
2828
vendors, and is well suited for describing large-scale workflows in cluster,
2929
cloud and high performance computing environments where tasks are scheduled in
3030
parallel across many nodes.
31-
32-
{% include links.md %}

_episodes/02-1st-example.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,28 @@ The simplest "hello world" program. This accepts one input parameter, writes a
1717

1818

1919
*1st-tool.cwl*
20+
```
2021
{% include cwl/1st-tool.cwl %}
22+
```
2123

2224
Use a YAML object in a separate file to describe the input of a run:
2325

2426
*echo-job.yml*
27+
```
2528
{% include cwl/echo-job.yml %}
29+
```
2630

2731
Now invoke `cwl-runner` with the tool wrapper and the input object on the command line:
2832

2933
```
3034
$ cwl-runner 1st-tool.cwl echo-job.yml
31-
[job 140199012414352] $ echo 'Hello world!'
35+
[job 1st-tool.cwl] /tmp/tmpmM5S_1$ echo \
36+
'Hello world!'
3237
Hello world!
38+
[job 1st-tool.cwl] completed success
39+
{}
3340
Final process status is success
41+
3442
```
3543

3644
What's going on here? Let's break it down:

_episodes/03-input.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ types and appearing on the command line in different ways:
2828

2929
*inp.cwl*
3030

31-
```
31+
~~~
3232
{% include cwl/inp.cwl %}
33-
```
33+
~~~
3434

3535
*inp-job.yml*
3636

@@ -47,10 +47,24 @@ input object on the command line:
4747
```
4848
$ touch whale.txt
4949
$ cwl-runner inp.cwl inp-job.yml
50-
[job 140020149614160] /home/example$ echo -f -i42 --example-string hello --file=/home/example/whale.txt
51-
-f -i42 --example-string hello --file=/home/example/whale.txt
50+
[job inp.cwl] /tmp/tmpzrSnfX$ echo \
51+
-f \
52+
-i42 \
53+
--example-string \
54+
hello \
55+
--file=/tmp/tmpRBSHIG/stg979b6d24-d50a-47e3-9e9e-90097eed2cbc/whale.txt
56+
-f -i42 --example-string hello --file=/tmp/tmpRBSHIG/stg979b6d24-d50a-47e3-9e9e-90097eed2cbc/whale.txt
57+
[job inp.cwl] completed success
58+
{}
5259
Final process status is success
5360
```
61+
> ## Where did those `/tmp` paths come from?
62+
>
63+
> The CWL reference runner (cwltool) and other runners create temporary
64+
> directories with symbolic ("soft") links to your input files to ensure that
65+
> the tools aren't accidently accessing files that were not explicitly
66+
> specified
67+
{: .callout}
5468

5569
The field `inputBinding` is optional and indicates whether and how the
5670
input parameter should be appear on the tool's command line. If
@@ -109,19 +123,19 @@ example_file:
109123
File types appear on the command line as the path to the file. When the
110124
parameter type ends with a question mark `?` it indicates that the
111125
parameter is optional. In the example above, this is rendered as
112-
`--file=/home/example/whale.txt`. However, if the "example_file"
126+
`--file=/tmp/random/path/whale.txt`. However, if the "example_file"
113127
parameter were not provided in the input, nothing would appear on the
114128
command line.
115129

116130
Input files are read-only. If you wish to update an input file, you must
117-
first copy it to the output directory.
131+
[first copy it to the output directory]({{ page.root }}/15-staging/).
118132

119133
The value of `position` is used to determine where parameter should
120134
appear on the command line. Positions are relative to one another, not
121135
absolute. As a result, positions do not have to be sequential, three
122-
parameters with positions `[1, 3, 5]` will result in the same command
123-
line as `[1, 2, 3]`. More than one parameter can have the same position
136+
parameters with positions 1, 3, 5 will result in the same command
137+
line as 1, 2, 3. More than one parameter can have the same position
124138
(ties are broken using the parameter name), and the position field itself
125-
is optional. the default position is 0.
139+
is optional. The default position is 0.
126140

127-
The `baseCommand` field always comes before parameters.
141+
The `baseCommand` field will always appear in the final command line before the parameters.

_episodes/04-output.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,23 @@ wrapper and the input object on the command line:
4141
```
4242
$ touch hello.txt && tar -cvf hello.tar hello.txt
4343
$ cwl-runner tar.cwl tar-job.yml
44-
[job 139868145165200] $ tar xf /home/example/hello.tar
45-
Final process status is success
44+
[job tar.cwl] /tmp/tmpqOeawQ$ tar \
45+
xf \
46+
/tmp/tmpGDk8Y1/stg80bbad20-494d-47af-8075-dffc32df03a3/hello.tar
47+
[job tar.cwl] completed success
4648
{
47-
"example_out": {
48-
"location": "hello.txt",
49-
"size": 13,
50-
"class": "File",
51-
"checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b"
52-
}
49+
"example_out": {
50+
"checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709",
51+
"basename": "hello.txt",
52+
"nameroot": "hello",
53+
"nameext": ".txt",
54+
"location": "file:///home/me/cwl/user_guide/hello.txt",
55+
"path": "/home/me/cwl/user_guide/hello.txt",
56+
"class": "File",
57+
"size": 0
58+
}
5359
}
60+
Final process status is success
5461
```
5562

5663
The field `outputBinding` describes how to to set the value of each
@@ -61,8 +68,8 @@ outputs:
6168
example_out:
6269
type: File
6370
outputBinding:
64-
glob: hello.txt
71+
glob: hello.txt
6572
```
6673

6774
The `glob` field consists of the name of a file in the output directory.
68-
If you don't know name of the file in advance, you can use a wildcard pattern.
75+
If you don't know name of the file in advance, you can use a wildcard pattern like `*.txt`.

_episodes/05-stdout.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,21 @@ on the command line:
3131

3232
```
3333
$ cwl-runner stdout.cwl echo-job.yml
34-
[job 140199012414352] $ echo 'Hello world!' > output.txt
35-
Final process status is success
34+
[job stdout.cwl] /tmp/tmpE0gTz7$ echo \
35+
'Hello world!' > /tmp/tmpE0gTz7/output.txt
36+
[job stdout.cwl] completed success
3637
{
37-
"output": {
38-
"location": "output.txt",
39-
"size": 13,
40-
"class": "File",
41-
"checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b"
42-
}
38+
"output": {
39+
"checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b",
40+
"basename": "output.txt",
41+
"nameroot": "output",
42+
"nameext": ".txt",
43+
"location": "file:///home/me/cwl/user_guide/output.txt",
44+
"path": "/home/me/cwl/user_guide/output.txt",
45+
"class": "File",
46+
"size": 13
47+
}
4348
}
44-
$ cat output.txt
45-
Hello world!
49+
Final process status is success
50+
4651
```

_episodes/06-params.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,24 @@ input object on the command line:
3434
```
3535
$ rm hello.tar || true && touch goodbye.txt && tar -cvf hello.tar goodbye.txt
3636
$ cwl-runner tar-param.cwl tar-param-job.yml
37-
[job 139868145165200] $ tar xf /home/example/hello.tar goodbye.txt
38-
Final process status is success
37+
[job tar-param.cwl] /tmp/tmpwH4ouT$ tar \
38+
xf \
39+
/tmp/tmpREYiEt/stgd7764383-99c9-4848-af51-7c2d6e5527d9/hello.tar \
40+
goodbye.txt
41+
[job tar-param.cwl] completed success
3942
{
40-
"example_out": {
41-
"location": "goodbye.txt",
42-
"size": 24,
43-
"class": "File",
44-
"checksum": "sha1$dd0a4c4c49ba43004d6611771972b6cf969c1c01"
45-
}
43+
"example_out": {
44+
"checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709",
45+
"basename": "goodbye.txt",
46+
"nameroot": "goodbye",
47+
"nameext": ".txt",
48+
"location": "file:///home/me/cwl/user_guide/goodbye.txt",
49+
"path": "/home/me/cwl/user_guide/goodbye.txt",
50+
"class": "File",
51+
"size": 0
52+
}
4653
}
54+
Final process status is success
4755
```
4856

4957
Certain fields permit parameter references which are enclosed in `$(...)`.

_episodes/07-containers.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ complete known-good runtime for software and its dependencies. However,
1717
containers are also purposefully isolated from the host system, so in
1818
order to run a tool inside a Docker container there is additional work to
1919
ensure that input files are available inside the container and output
20-
files can be recovered from the container. CWL can perform this work
20+
files can be recovered from the container. A CWL runner can perform this work
2121
automatically, allowing you to use Docker to simplify your software
2222
management while avoiding the complexity of invoking and managing Docker
2323
containers.
@@ -42,15 +42,31 @@ input object on the command line:
4242
```
4343
$ echo "console.log(\"Hello World\");" > hello.js
4444
$ cwl-runner docker.cwl docker-job.yml
45-
[job 140259721854416] /home/example$ docker run -i --volume=/home/example/hello.js:/var/lib/cwl/job369354770_examples/hello.js:ro --volume=/home/example:/var/spool/cwl:rw --volume=/tmp/tmpDLs5hm:/tmp:rw --workdir=/var/spool/cwl --read-only=true --net=none --user=1001 --rm --env=TMPDIR=/tmp node:slim node /var/lib/cwl/job369354770_examples/hello.js
46-
Hello world!
45+
[job docker.cwl] /tmp/tmpgugLND$ docker \
46+
run \
47+
-i \
48+
--volume=/tmp/tmpgugLND:/var/spool/cwl:rw \
49+
--volume=/tmp/tmpSs5JoN:/tmp:rw \
50+
--volume=/home/me/cwl/user_guide/hello.js:/var/lib/cwl/stg16848d97-e6ba-4b35-b666-4546d9965a2d/hello.js:ro \
51+
--workdir=/var/spool/cwl \
52+
--read-only=true \
53+
--user=1000 \
54+
--rm \
55+
--env=TMPDIR=/tmp \
56+
--env=HOME=/var/spool/cwl \
57+
node:slim \
58+
node \
59+
/var/lib/cwl/stg16848d97-e6ba-4b35-b666-4546d9965a2d/hello.js
60+
Hello World
61+
[job docker.cwl] completed success
62+
{}
4763
Final process status is success
4864
```
4965

5066
Notice the CWL runner has constructed a Docker command line to run the
5167
script. One of the responsibilities of the CWL runner is to adjust the paths of
5268
input files to reflect the location where they appear inside the container.
53-
In this example, the path to the script `hello.js` is `/home/example/hello.js`
69+
In this example, the path to the script `hello.js` is `/home/me/cwl/user_guide/hello.js`
5470
outside the container but `/var/lib/cwl/job369354770_examples/hello.js` inside
5571
the container, as reflected in the invocation of the `node` command.
5672

_extras/about.md

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

_extras/discuss.md

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

_extras/figures.md

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

0 commit comments

Comments
 (0)