19070: Still trying to fix test_with_arvbox
[arvados.git] / doc / _includes / _mount_types.liquid
1 {% comment %}
2 Copyright (C) The Arvados Authors. All rights reserved.
3
4 SPDX-License-Identifier: CC-BY-SA-3.0
5 {% endcomment %}
6
7 h2. Mount types
8
9 The "mounts" hash is the primary mechanism for adding data to the container at runtime (beyond what is already in the container image).
10
11 Each value of the "mounts" hash is itself a hash, whose "kind" key determines the handler used to attach data to the container.
12
13 table(table table-bordered table-condensed).
14 |_. Mount type|_. Kind|_. Description|_. Examples|
15 |Arvados data collection|@collection@|@"portable_data_hash"@ _or_ @"uuid"@ _may_ be provided. If not provided, a new collection will be created. This is useful when @"writable":true@ and the container's @output_path@ is (or is a subdirectory of) this mount target.
16 @"writable"@ may be provided with a @true@ or @false@ to indicate the path must (or must not) be writable. If not specified, the system can choose.
17 @"path"@ may be provided, and defaults to @"/"@.
18 At container startup, the target path will have the same directory structure as the given path within the collection. Even if the files/directories are writable in the container, modifications will _not_ be saved back to the original collections when the container ends.|<pre><code>{
19  "kind":"collection",
20  "uuid":"...",
21  "path":"/foo.txt"
22 }
23 {
24  "kind":"collection",
25  "uuid":"..."
26 }</code></pre>|
27 |Git tree|@git_tree@|@"uuid"@ must be the UUID of an Arvados-hosted git repository.
28 @"commit"@ must be a full 40-character commit hash.
29 @"path"@, if provided, must be "/".
30 At container startup, the target path will have the source tree indicated by the given commit. The @.git@ metadata directory _will not_ be available.|<pre><code>{
31  "kind":"git_tree",
32  "uuid":"zzzzz-s0uqq-xxxxxxxxxxxxxxx",
33  "commit":"f315c59f90934cccae6381e72bba59d27ba42099"
34 }
35 </code></pre>|
36 |Temporary directory|@tmp@|@"capacity"@: capacity (in bytes) of the storage device.
37 @"device_type"@ (optional, default "network"): one of @{"ram", "ssd", "disk", "network"}@ indicating the acceptable level of performance. (*note: not yet implemented as of v1.5*)
38 At container startup, the target path will be empty. When the container finishes, the content will be discarded. This will be backed by a storage mechanism no slower than the specified type.|<pre><code>{
39  "kind":"tmp",
40  "capacity":100000000000
41 }
42 {
43  "kind":"tmp",
44  "capacity":1000000000,
45  "device_type":"ram"
46 }</code></pre>|
47 |Keep|@keep@|Expose all readable collections via arv-mount.
48 Requires suitable runtime constraints.|<pre><code>{
49  "kind":"keep"
50 }</code></pre>|
51 |Mounted file or directory|@file@|@"path"@: absolute path (inside the container) of a file or directory that is (or is inside) another mount target.
52 Can be used for "stdin" and "stdout" targets.|<pre><code>{
53  "kind":"file",
54  "path":"/mounted_tmp/a.out"
55 }</code></pre>|
56 |JSON document|@json@|A JSON-encoded string, array, or object.|<pre>{
57  "kind":"json",
58  "content":{"foo":"bar"}
59 }</pre>|
60
61 h2(#pre-populate-output). Pre-populate output using Mount points
62
63 When a container's output_path is a tmp mount backed by local disk, this output directory can be pre-populated with content from existing collections. This content can be specified by mounting collections at mount points that are subdirectories of output_path. Certain restrictions apply:
64
65 1. Only mount points of kind @collection@ are supported.
66
67 2. Mount points underneath output_path which have @"writable":true@ are copied into output_path during container initialization and may be updated, renamed, or deleted by the running container.  The original collection is not modified.  On container completion, files remaining in the output are saved to the output collection.   The mount at output_path must be big enough to accommodate copies of the inner writable mounts.
68
69 3. If any such mount points are configured as @exclude_from_output":true@, they will be excluded from the output.
70
71 If any process in the container tries to modify, remove, or rename these mount points or anything underneath them, the operation will fail and the container output and the underlying collections used to pre-populate are unaffected.
72
73 h3. Example mount point configurations
74
75 All the below examples are based on this collection:
76 <pre><code>
77 portable_data_hash cdfbe2e823222d26483d52e5089d553c+175
78
79 manifest_text: ./alice 03032680d3fa0561ef4f85071140861e+13+A04e9d06459cda00aa997565bd78001061cf5bffb@58ab593d 0:13:hello.txt\n./bob d820b9df970e1b498e7723c50b107e1b+11+A42d162a60210479d1cfaf9fbb98d494ac6322ae6@58ab593d 0:11:hello.txt\n./carol cf72b172ff969250ae14a893a6745440+13+A476a2fd39e14e9c03af3076bd17e3612c075ff66@58ab593d 0:13:hello.txt\n
80 </code></pre>
81
82 table(table table-bordered table-condensed).
83 |{width:40%}. *Mount point*|{width:30%}. *Description*|{width:30%}. *Resulting collection manifest text*|
84 |<pre><code>"mounts": {
85   "/tmp/foo": {
86     "kind": "collection",
87     "portable_data_hash": "cdfbe2...+175"
88   },
89 },
90 "output_path": "/tmp"
91 </code></pre>|No path specified and hence the entire collection will be mounted.|./*foo/*alice 030326... 0:13:hello.txt\n
92 ./*foo/*bob d820b9... 0:11:hello.txt\n
93 ./*foo/*carol cf72b1... 0:13:hello.txt\n
94 *Note:* Here the "." in streams is replaced with *foo*.|
95 |<pre><code>"mounts": {
96   "/tmp/foo/bar": {
97     "kind": "collection",
98     "portable_data_hash": "cdfbe2...+175"
99     "path": "alice"
100   },
101 },
102 "output_path": "/tmp"
103 </code></pre>|Specified path refers to the subdirectory *alice* in the collection.|./*foo/bar* 030326... 0:13:hello.txt\n
104 *Note:* only the manifest text segment for the subdirectory *alice* is included after replacing the subdirectory *alice* with *foo/bar*.|
105 |<pre><code>"mounts": {
106   "/tmp/foo/bar": {
107     "kind": "collection",
108     "portable_data_hash": "cdfbe2...+175"
109     "path": "alice/hello.txt"
110   },
111 },
112 "output_path": "/tmp"
113 </code></pre>|Specified path refers to the file *hello.txt* in the *alice* subdirectory|./*foo* 030326... 0:13:*bar*\n
114 *Note:* Here the subdirectory *alice* is replaced with *foo* and the filename *hello.txt* from this subdirectory is replaced with *bar*.|
115
116 h2(#symlinks-in-output). Symlinks in output
117
118 When a container's output_path is a tmp mount backed by local disk, this output directory can contain symlinks to other files in the output directory, or to collection mount points.  If the symlink leads to a collection mount, efficiently copy the collection into the output collection.  Symlinks leading to files or directories are expanded and created as regular files in the output collection.  Further, whether symlinks are relative or absolute, every symlink target (even targets that are symlinks themselves) must point to a path in either the output directory or a collection mount.