Skip to content

Commit 1dc2481

Browse files
author
Toby Hodges
committed
added staging files episode
1 parent 736ce39 commit 1dc2481

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

_episodes/15-staging.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "Staging Input Files"
3+
teaching: 10
4+
exercises: 0
5+
questions:
6+
- "How do I stage input files in the working directory?"
7+
objectives:
8+
- "Learn how to handle situations where a tool expects to write output files to
9+
the same directory as its input files."
10+
keypoints:
11+
- "Input files are normally kept in a read-only directory."
12+
- "Use `InitialWorkDirRequirement` to stage input files in the working
13+
directory."
14+
---
15+
Normally, input files are located in a read-only directory separate from
16+
the output directory. This causes problems if the underlying tool expects to
17+
write its output files alongside the input file in the same directory. You use `InitialWorkDirRequirement` to stage input files into the output directory.
18+
In this example, we use a Javascript expression to extract the base name of the
19+
input file from its leading directory path.
20+
21+
*linkfile.cwl*
22+
23+
```
24+
{% include cwl/linkfile.cwl %}
25+
```
26+
27+
*arguments-job.yml*
28+
29+
```
30+
{% include cwl/arguments-job.yml %}
31+
```
32+
33+
Now invoke `cwl-runner` with the tool wrapper and the input object on the
34+
command line:
35+
36+
```
37+
$ cwl-runner linkfile.cwl arguments-job.yml
38+
[job 139928309171664] /home/example$ docker run -i --volume=/home/example/Hello.java:/var/lib/cwl/job557617295_examples/Hello.java:ro --volume=/home/example:/var/spool/cwl:rw --volume=/tmp/tmpmNbApw:/tmp:rw --workdir=/var/spool/cwl --read-only=true --net=none --user=1001 --rm --env=TMPDIR=/tmp java:7 javac Hello.java
39+
Final process status is success
40+
{
41+
"classfile": {
42+
"size": 416,
43+
"location": "/home/example/Hello.class",
44+
"checksum": "sha1$2f7ac33c1f3aac3f1fec7b936b6562422c85b38a",
45+
"class": "File"
46+
}
47+
}
48+
```

0 commit comments

Comments
 (0)