e5e631d4e230256a2d077607ac23303cf68ccee9
[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 and workflows from one cluster to another. By default, @arv-copy@ will recursively go through the workflow and copy all dependencies associated with the object.
19
20 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 name from the prefix of the uuid of the object you want to copy. For example, in *zzzzz*-4zz18-tci4vn4fa95w0zx, the cluster name is zzzzz.
21
22 In order to communicate with both clusters, you must create custom configuration files for each cluster. In the Arvados Workbench, click on the dropdown menu icon <span class="fa fa-lg fa-user"></span> <span class="caret"></span> in the upper right corner of the top navigation menu to access the user settings menu, and click on the menu item *Current token*. Copy the @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ in both of your clusters. Then, create two configuration files, one for each cluster. The names of the files must have the format of *ClusterID.conf*. In our example, let's make two files, one for *pirca* and one for *dstcl*. From your *Current token* page in *pirca* and *dstcl*, copy the @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@.
23
24 !{display: block;margin-left: 25px;margin-right: auto;}{{ site.baseurl }}/images/api-token-host.png!
25
26 Copy your @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ into the config files as shown below in the shell account from which you are executing the commands. For example, the default shell you may have access to is shell.pirca. You can add these files in ~/.config/arvados/ in the pirca shell terminal.
27
28 <notextile>
29 <pre><code>~$ <span class="userinput">cd ~/.config/arvados</span>
30 ~$ <span class="userinput">echo "ARVADOS_API_HOST=pirca.arvadosapi.com" >> pirca.conf</span>
31 ~$ <span class="userinput">echo "ARVADOS_API_TOKEN=123456789abcdefghijkl" >> pirca.conf</span>
32 ~$ <span class="userinput">echo "ARVADOS_API_HOST=dstcl.arvadosapi.com" >> dstcl.conf</span>
33 ~$ <span class="userinput">echo "ARVADOS_API_TOKEN=987654321lkjihgfedcba" >> dstcl.conf</span>
34 </code></pre>
35 </notextile>
36
37 Now you're ready to copy between *pirca* and *dstcl*!
38
39 h3. How to copy a collection
40
41 First, select the uuid 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/...@)
42
43 Now copy the collection from *pirca* to *dstcl*. We will use the uuid @pirca-4zz18-jyjuzyqq14qspl7@ as an example. You can find this collection in the <a href="https://playground.arvados.org/collections/pirca-4zz18-jyjuzyqq14qspl7">User guide resources project on playground.arvados.org</a>.
44 <notextile>
45 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl pirca-4zz18-jyjuzyqq14qspl7</span>
46 pirca-4zz18-tci4vn4fa95w0zx: 6.1M / 6.1M 100.0%
47 arvados.arv-copy[1234] INFO: Success: created copy with uuid dstcl-4zz18-8765943210cdbae
48 </code></pre>
49 </notextile>
50
51 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 a pre-created project, you can specify the project you want it to be in using the tag @--project-uuid@ followed by the project uuid.
52
53 For example, this will copy the collection to project dstcl-j7d0g-a894213ukjhal12 in the destination cluster.
54
55 <notextile> <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl --project-uuid dstcl-j7d0g-a894213ukjhal12 pirca-4zz18-tci4vn4fa95w0zx</span>
56 </code></pre>
57 </notextile>
58
59 h3. How to copy a workflow
60
61 We will use the uuid @pirca-7fd4e-sampleworkflow1@ as an example workflow.
62
63 <notextile>
64 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl --dst-git-repo $USER/tutorial pirca-7fd4e-sampleworkflow1</span>
65 pirca-4zz18-jidprdejysravcr: 1143M / 1143M 100.0%
66 2017-01-04 04:11:58 arvados.arv-copy[5906] INFO:
67 2017-01-04 04:11:58 arvados.arv-copy[5906] INFO: Success: created copy with uuid dstcl-7fd4e-ojtgpne594ubkt7
68 </code></pre>
69 </notextile>
70
71 The name, description, and workflow definition from the original workflow will be used for the destination copy. In addition, any *locations* and *docker images* found in the src workflow definition will also be copied to the destination recursively.
72
73 If you would like to copy the object without dependencies, you can use the @--no-recursive@ flag.
74
75 For example, we can copy the same object non-recursively using the following:
76
77 <notextile>
78 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl --dst-git-repo $USER/tutorial --no-recursive pirca-7fd4e-sampleworkflow1</span>
79 </code></pre>
80 </notextile>