21020: Expound documentation for setting up arv-copy
[arvados.git] / doc / user / topics / arv-copy.html.textile.liquid
1 ---
2 layout: default
3 navsection: userguide
4 title: "Using arv-copy"
5 ...
6 {% comment %}
7 Copyright (C) The Arvados Authors. All rights reserved.
8
9 SPDX-License-Identifier: CC-BY-SA-3.0
10 {% endcomment %}
11
12 This tutorial describes how to copy Arvados objects from one cluster to another by using @arv-copy@.
13
14 {% include 'tutorial_expectations' %}
15
16 h2. arv-copy
17
18 @arv-copy@ allows users to copy collections, workflow definitions and projects from one cluster to another.  You can also use @arv-copy@ to import resources from HTTP URLs into Keep.
19
20 For projects, @arv-copy@ will copy all the collections workflow definitions owned by the project, and recursively copy subprojects.
21
22 For workflow definitions, @arv-copy@ will recursively go through the workflow and copy all associated dependencies (input collections and Docker images).
23
24 For example, let's copy from the <a href="https://playground.arvados.org/">Arvados Playground</a>, also known as *pirca*, to *dstcl*. The names *pirca* and *dstcl* are interchangable with any cluster ID. You can find the cluster ID from the prefix of the UUID of the object you want to copy. For example, in <notextile><code><strong>zzzzz</strong>-4zz18-tci4vn4fa95w0zx</code></notextile>, the cluster name is *zzzzz*.
25
26 In order to communicate with both clusters, you must create custom configuration files for each cluster.  The "Getting an API token":{{site.baseurl}}/user/reference/api-tokens.html page describes how to get a token and create a configuration file.  However, instead of creating the default @~/.config/arvados/settings.conf@ you need two configuration files, one for each cluster, with filenames in the format of <notextile><code><strong>ClusterID</strong>.conf</code></notextile>. For this example, follow these steps:
27
28 # Open the "Arvados Playground Workbench":https://playground.arvados.org.
29 # On the system where you'll run @arv-copy@, start a new file named @~/.config/arvados/pirca.conf@ in your editor.
30 # In Workbench, open the user menu in the upper right, and select "Get API token."
31 # In the Workbench "Get API Token" dialog, under the "API Host" header, copy the value to your clipboard using the button.
32 # In your editor, write the text @ARVADOS_API_HOST=@, then paste the "API Host" value you copied in the previous step, and start a new line.
33 # In the Workbench "Get API Token" dialog, under the "API Token" header, copy the value to your clipboard using the button.
34 # In your editor, write the text @ARVADOS_API_TOKEN=@, then paste the "API Token" value you copied in the previous step, and start a new line.
35 # Review your work. In your editor, @pirca.conf@ should look like this, with a different value for @ARVADOS_API_TOKEN@:
36   <pre><code>ARVADOS_API_HOST=pirca.arvadosapi.com
37 ARVADOS_API_TOKEN=v2/jutro-gj3su-12345abcde67890/abcdefghijklmnopqrstuvwxyz1234567890
38 </code></pre> If it looks right, save and close the file.
39 # Open Workbench for your destination cluster *dstcl*.
40 # On the system where you'll run @arv-copy@, start a new file named <notextile><code>~/.config/arvados/<b>dstcl</b>.conf</code></notextile> in your editor. Replace *@dstcl@* in the filename with the actual cluster ID of your destination cluster.
41 # Repeat steps 3-8 to create a settings file with credentials for *dsctl*.
42
43 h3. How to copy a collection
44
45 First, determine the UUID or portable data hash of the collection you want to copy from the source cluster. The UUID can be found in the collection display page in the collection summary area (top left box), or from the URL bar (the part after @collections/...@)
46
47 Now copy the collection from *pirca* to *dstcl*. We will use the UUID @jutro-4zz18-tv416l321i4r01e@ as an example. You can find this collection on <a href="https://playground.arvados.org/collections/jutro-4zz18-tv416l321i4r01e">playground.arvados.org</a>.
48 <notextile>
49 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl jutro-4zz18-tv416l321i4r01e</span>
50 jutro-4zz18-tv416l321i4r01e: 6.1M / 6.1M 100.0%
51 arvados.arv-copy[1234] INFO: Success: created copy with uuid dstcl-4zz18-xxxxxxxxxxxxxxx
52 </code></pre>
53 </notextile>
54
55 You can also copy by content address:
56
57 <notextile>
58 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl 2463fa9efeb75e099685528b3b9071e0+438</span>
59 2463fa9efeb75e099685528b3b9071e0+438: 6.1M / 6.1M 100.0%
60 arvados.arv-copy[1234] INFO: Success: created copy with uuid dstcl-4zz18-xxxxxxxxxxxxxxx
61 </code></pre>
62 </notextile>
63
64 The output of arv-copy displays the UUID of the collection generated in the destination cluster. By default, the output is placed in your home project in the destination cluster. If you want to place your collection in an existing project, you can specify the project you want it to be in using the tag @--project-uuid@ followed by the project UUID.
65
66 For example, this will copy the collection to project @dstcl-j7d0g-a894213ukjhal12@ in the destination cluster.
67
68 <notextile> <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl --project-uuid dstcl-j7d0g-a894213ukjhal12 jutro-4zz18-tv416l321i4r01e
69 </code></pre>
70 </notextile>
71
72 Additionally, if you need to specify the storage classes where to save the copied data on the destination cluster, you can do that by using the @--storage-classes LIST@ argument, where @LIST@ is a comma-separated list of storage class names.
73
74 h3. How to copy a workflow
75
76 Copying workflows requires @arvados-cwl-runner@ to be available in your @$PATH@.
77
78 We will use the UUID @jutro-7fd4e-mkmmq53m1ze6apx@ as an example workflow.
79
80 Arv-copy will infer the source cluster is @jutro@ from the object UUID, and destination cluster is @pirca@ from @--project-uuid@.
81
82 <notextile>
83 <pre><code>~$ <span class="userinput">arv-copy --project-uuid pirca-j7d0g-ecak8knpefz8ere jutro-7fd4e-mkmmq53m1ze6apx</span>
84 ae480c5099b81e17267b7445e35b4bc7+180: 23M / 23M 100.0%
85 2463fa9efeb75e099685528b3b9071e0+438: 156M / 156M 100.0%
86 jutro-4zz18-vvvqlops0a0kpdl: 94M / 94M 100.0%
87 2020-08-19 17:04:13 arvados.arv-copy[4789] INFO:
88 2020-08-19 17:04:13 arvados.arv-copy[4789] INFO: Success: created copy with uuid pirca-7fd4e-s0tw9rfbkpo2fmx
89 </code></pre>
90 </notextile>
91
92 The name, description, and workflow definition from the original workflow will be used for the destination copy. In addition, any *collections* and *Docker images* referenced in the source workflow definition will also be copied to the destination.
93
94 If you would like to copy the object without dependencies, you can use the @--no-recursive@ flag.
95
96 h3. How to copy a project
97
98 We will use the UUID @jutro-j7d0g-xj19djofle3aryq@ as an example project.
99
100 Arv-copy will infer the source cluster is @jutro@ from the source project UUID, and destination cluster is @pirca@ from @--project-uuid@.
101
102 <notextile>
103 <pre><code>~$ <span class="userinput">arv-copy --project-uuid pirca-j7d0g-lr8sq3tx3ovn68k jutro-j7d0g-xj19djofle3aryq</span>
104 2021-09-08 21:29:32 arvados.arv-copy[6377] INFO:
105 2021-09-08 21:29:32 arvados.arv-copy[6377] INFO: Success: created copy with uuid pirca-j7d0g-ig9gvu5piznducp
106 </code></pre>
107 </notextile>
108
109 The name and description of the original project will be used for the destination copy.  If a project already exists with the same name, collections and workflow definitions will be copied into the project with the same name.
110
111 If you would like to copy the project but not its subproject, you can use the @--no-recursive@ flag.
112
113 h3. Importing HTTP resources to Keep
114
115 You can also use @arv-copy@ to copy the contents of a HTTP URL into Keep.  When you do this, Arvados keeps track of the original URL the resource came from.  This allows you to refer to the resource by its original URL in Workflow inputs, but actually read from the local copy in Keep.
116
117 <notextile>
118 <pre><code>~$ <span class="userinput">arv-copy --project-uuid tordo-j7d0g-lr8sq3tx3ovn68k https://example.com/index.html</span>
119 tordo-4zz18-dhpb6y9km2byb94
120 2023-10-06 10:15:36 arvados.arv-copy[374147] INFO: Success: created copy with uuid tordo-4zz18-dhpb6y9km2byb94
121 </code></pre>
122 </notextile>
123
124 In addition, when importing from HTTP URLs, you may provide a different cluster than the destination in @--src@. This tells @arv-copy@ to search the other cluster for a collection associated with that URL, and if found, copy the collection from that cluster instead of downloading from the original URL.
125
126 The following @arv-copy@ command line options affect the behavior of HTTP import.
127
128 table(table table-bordered table-condensed).
129 |_. Option |_. Description |
130 |==--varying-url-params== VARYING_URL_PARAMS|A comma separated list of URL query parameters that should be ignored when storing HTTP URLs in Keep.|
131 |==--prefer-cached-downloads==|If a HTTP URL is found in Keep, skip upstream URL freshness check (will not notice if the upstream has changed, but also not error if upstream is unavailable).|