Skip to content

Commit 9674a51

Browse files
committed
WIP Migrate sections to use runcmd where possible
1 parent 587c2ae commit 9674a51

File tree

10 files changed

+40
-122
lines changed

10 files changed

+40
-122
lines changed

src/_includes/cwl/conformance-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141

142142
# Section 13
143143
- doc: Test for section 13
144-
job: 13-expressions/empty.yml
145-
tool: 13-expressions/expression.cwl
144+
job: expressions/empty.yml
145+
tool: expressions/expression.cwl
146146
output:
147147
example_out:
148148
class: File
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-A 2 -B baz -C 10 9 8 7 6 5 4 3 2 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"message": "こんにちは世界"
3+
}
File renamed without changes.

src/introduction/prerequisites.md

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ for other ways to install `cwltool` with `apt` and `conda`.
6161

6262
Let's use a simple workflow `true.cwl` with `cwltool`.
6363

64-
```{literalinclude} /_includes/cwl/simplest_cwl.cwl
64+
```{literalinclude} /_includes/cwl/true.cwl
6565
:language: cwl
6666
:caption: "`true.cwl`"
6767
:name: true.cwl
@@ -75,29 +75,16 @@ to pass `--validate` to the `cwltool` command:
7575
% TODO: maybe figure out a way to avoid /home/kinow/ etc. in the documentation
7676
% to avoid multiple user-names/directory-locations varying in the docs.
7777

78-
```{code-block} console
78+
```{runcmd} cwltool --validate true.cwl
7979
:name: validating-truecwl-with-cwltool
8080
:caption: Validating `true.cwl` with `cwltool`.
81-
82-
$ cwltool --validate true.cwl
83-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwltool 3.1.20220406080846
84-
INFO Resolved 'true.cwl' to 'file:///tmp/true.cwl'
85-
true.cwl is valid CWL.
8681
```
8782

8883
You can run the CWL workflow now that you know it is valid:
8984

90-
```{code-block} console
85+
```{runcmd} cwltool true.cwl
9186
:name: running-true.cwl-with-cwltool
9287
:caption: Running `true.cwl` with `cwltool`.
93-
94-
$ cwltool true.cwl
95-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwltool 3.1.20220406080846
96-
INFO Resolved 'true.cwl' to 'file:///tmp/true.cwl'
97-
INFO [job true.cwl] /tmp/f8xlh1pl$ true
98-
INFO [job true.cwl] completed success
99-
{}
100-
INFO Final process status is success
10188
```
10289

10390
### cwl-runner Python module
@@ -126,56 +113,42 @@ Now you can validate and run your workflow with `cwl-runner` executable,
126113
which will invoke `cwltool`. You should have the same results and output
127114
as in the previous section.
128115

129-
```{code-block} console
116+
```{runcmd} cwl-runner --validate true.cwl
130117
:name: validating-true.cwl-with-cwl-runner
131118
:caption: Validating `true.cwl` with `cwl-runner`.
132-
133-
$ cwl-runner --validate true.cwl
134-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwl-runner 3.1.20220406080846
135-
INFO Resolved 'true.cwl' to 'file:///tmp/true.cwl'
136-
true.cwl is valid CWL.
137119
```
138120

139-
```{code-block} console
121+
```{runcmd} cwl-runner true.cwl
140122
:name: running-true.cwl-with-cwl-runner
141123
:caption: Running `true.cwl` with `cwl-runner`.
142-
143-
$ cwl-runner true.cwl
144-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwl-runner 3.1.20220406080846
145-
INFO Resolved 'true.cwl' to 'file:///tmp/true.cwl'
146-
INFO [job true.cwl] /tmp/7a2gf1nh$ true
147-
INFO [job true.cwl] completed success
148-
{}
149-
INFO Final process status is success
150124
```
151125

152126
Another way to execute `cwl-runner` is invoking the file directly. For that,
153-
the first thing you need is to modify the `true.cwl` workflow and include
154-
a special first line, a *shebang*:
127+
the first thing you need to copy `true.cwl` workflow into a new file
128+
`true_shebang.cwl` and include a special first line, a *shebang*:
155129

156-
```{literalinclude} /_includes/cwl/simplest_cwl_shebang.cwl
130+
```{literalinclude} /_includes/cwl/true_shebang.cwl
157131
:language: cwl
158-
:name: cwltool-with-a-shebang
159-
:caption: "`cwltool` with a shebang"
132+
:name: "true_shebang.cwl"
133+
:caption: "`true_shebang.cwl`"
160134
```
161135

162-
Now, after you make the file `true.cwl` executable with `chmod u+x`,
163-
you can execute it directly in the command-line and the program
164-
specified in the shebang (`cwl-runner`) will be used to execute the
165-
rest of the file.
136+
Now you can make the file `true_shebang.cwl` executable with `chmod u+x`.
166137

167138
```{code-block} console
168-
:name: making-true.cwl-executable-and-running-it
169-
:caption: Making `true.cwl` executable and running it.
139+
:name: making-true.cwl-executable
140+
:caption: Making `true.cwl` executable.
170141
171142
$ chmod u+x true.cwl
172-
$ ./true.cwl
173-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwl-runner 3.1.20220406080846
174-
INFO Resolved './true.cwl' to 'file:///tmp/true.cwl'
175-
INFO [job true.cwl] /tmp/jz7ups99$ true
176-
INFO [job true.cwl] completed success
177-
{}
178-
INFO Final process status is success
143+
```
144+
145+
And finally you can execute it directly in the command-line and the program
146+
specified in the shebang (`cwl-runner`) will be used to execute the
147+
rest of the file.
148+
149+
```{runcmd} ./true_shebang.cwl
150+
:name: running-true_shebang.cwl-with-a-shebang
151+
:caption: Running `true_shebang.cwl` with a shebang.
179152
```
180153

181154
```{note}

src/introduction/quick-start.md

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,66 +55,34 @@ The usage of the `cwltool` command-line executable is basically
5555
`cwltool [OPTIONS] <CWL_DOCUMENT> [INPUTS_OBJECT]`. You can run the
5656
`hello_world.cwl` workflow without specifying any option:
5757

58-
```{code-block} console
58+
```{runcmd} cwltool hello_world.cwl
5959
:name: running-hello_world.cwl-with-cwltool
6060
:caption: Running `hello_world.cwl` with `cwltool`.
61-
62-
$ cwltool hello_world.cwl
63-
INFO /tmp/venv/bin/cwltool 3.1.20220628170238
64-
INFO Resolved 'hello_world.cwl' to 'file:///tmp/hello_world.cwl'
65-
INFO [job hello_world.cwl] /tmp/yn0e8xu6$ echo \
66-
'Hello World'
67-
Hello World
68-
INFO [job hello_world.cwl] completed success
69-
{}
70-
INFO Final process status is success
7161
```
7262

7363
Or you can override the default value of the input parameter `message`, similar
7464
to how you would change the argument of the `echo` base command:
7565

76-
```{code-block} console
66+
```{runcmd} cwltool hello_world.cwl --message="Hola mundo"
7767
:name: running-hello_world.cwl-with-cwltool-passing-an-input-parameter
7868
:caption: Running `hello_world.cwl` with `cwltool` passing an input parameter.
79-
80-
$ cwltool hello_world.cwl --message="Hola mundo"
81-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwltool 3.1.20220406080846
82-
INFO Resolved '/tmp/hello_world.cwl' to 'file:///tmp/hello_world.cwl'
83-
INFO [job hello_world.cwl] /tmp/ua5vt9hl$ echo \
84-
'Hola mundo'
85-
Hola mundo
86-
INFO [job hello_world.cwl] completed success
87-
{}
88-
INFO Final process status is success
8969
```
9070

9171
Another way of passing values to your workflow input parameters is via an
9272
*Inputs Object*. This is a file containing the input fields with the
9373
corresponding values. This file can be written in JSON or YAML. For example:
9474

95-
```{code-block} json
75+
```{literalinclude} /_includes/cwl/hello_world-job.json
76+
:language: json
9677
:name: hello_world-job.json
9778
:caption: "`hello_world-job.json`"
98-
{
99-
"message": "こんにちは世界"
100-
}
10179
```
102-
<p class="text-center text-muted mt-n2">hello_world-job.json</p>
10380

10481
You can use this Inputs Object file now to execute the “Hello World” workflow:
10582

106-
```{code-block} console
83+
```{runcmd} cwltool hello_world.cwl hello_world-job.json
10784
:name: passing-an-inputs-object-file-to-cwltool
10885
:caption: Passing an Inputs Object file to `cwltool`.
109-
$ cwltool hello_world.cwl hello_world-job.json
110-
INFO /home/kinow/Development/python/workspace/user_guide/venv/bin/cwltool 3.1.20220406080846
111-
INFO Resolved '/tmp/hello_world.cwl' to 'file:///tmp/hello_world.cwl'
112-
INFO [job hello_world.cwl] /tmp/c5uchknw$ echo \
113-
こんにちは世界
114-
こんにちは世界
115-
INFO [job hello_world.cwl] completed success
116-
{}
117-
INFO Final process status is success
11886
```
11987

12088
```{note}

src/topics/expressions.md

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ When manipulating file names, extensions, paths etc, consider whether one of the
1212
etc, could be used instead.
1313
See the [list of best practices](best-practices.md).
1414
15-
```{literalinclude} /_includes/cwl/13-expressions/expression.cwl
15+
```{literalinclude} /_includes/cwl/expressions/expression.cwl
1616
:language: cwl
1717
:caption: "`expression.cwl`"
1818
:name: expression.cwl
@@ -21,7 +21,7 @@ See the [list of best practices](best-practices.md).
2121
As this tool does not require any `inputs` we can run it with an (almost) empty
2222
job file:
2323

24-
```{literalinclude} /_includes/cwl/13-expressions/empty.yml
24+
```{literalinclude} /_includes/cwl/expressions/empty.yml
2525
:language: yaml
2626
:caption: "`empty.yml`"
2727
:name: empty.cwl
@@ -33,41 +33,14 @@ represented simply by a set of empty brackets.
3333

3434
We can then run `expression.cwl`:
3535

36-
```{code-block} console
36+
```{runcmd} cwl-runner expression.cwl empty.yml
3737
:name: running-expression.cwl
3838
:caption: Running `expression.cwl`
39+
:working-directory: src/_includes/cwl/expressions/
40+
```
3941

40-
$ cwl-runner expression.cwl empty.yml
41-
[job expression.cwl] /home/example$ echo \
42-
-A \
43-
2 \
44-
-B \
45-
baz \
46-
-C \
47-
10 \
48-
9 \
49-
8 \
50-
7 \
51-
6 \
52-
5 \
53-
4 \
54-
3 \
55-
2 \
56-
1 > /home/example/output.txt
57-
[job expression.cwl] completed success
58-
{
59-
"example_out": {
60-
"location": "file:///home/example/output.txt",
61-
"basename": "output.txt",
62-
"class": "File",
63-
"checksum": "sha1$a739a6ff72d660d32111265e508ed2fc91f01a7c",
64-
"size": 36,
65-
"path": "/home/example/output.txt"
66-
}
67-
}
68-
Final process status is success
69-
$ cat output.txt
70-
-A 2 -B baz -C 10 9 8 7 6 5 4 3 2 1
42+
```{runcmd} cat output.txt
43+
:working-directory: src/_includes/cwl/expressions/
7144
```
7245

7346
Note that requirements can be provided with the map syntax, as in the example above:

0 commit comments

Comments
 (0)