16578: Few more copy script tweaks
[arvados.git] / tools / copy-tutorial / copy-tutorial.sh
index 6addeb1cdac62bad70ba6f140d9d013b7001c985..e7fac7af487bbc4d416cd6b2412f6c979c43ca5c 100755 (executable)
@@ -5,27 +5,23 @@
 
 set -e -o pipefail
 
-if test -z "$1" -o -z "$2"  ; then
+if test -z "$1" ; then
   echo "$0: Copies Arvados tutorial resources from public data cluster (jutro)"
-  echo "Usage: copy-tutorial.sh <dest> <tutorial>"
-  echo "<dest> is 5-character cluster id of the destination"
+  echo "Usage: copy-tutorial.sh <tutorial>"
   echo "<tutorial> is which tutorial to copy, one of:"
   echo " bwa-mem        Tutorial from https://doc.arvados.org/user/tutorials/tutorial-workflow-workbench.html"
   echo " whole-genome   Whole genome variant calling tutorial workflow (large)"
   exit
 fi
 
-src=jutro
-dest=$1
-tutorial=$2
-
-if ! test -f $HOME/.config/arvados/${dest}.conf ; then
-    echo "Please create $HOME/.config/arvados/${dest}.conf with the following contents:"
-    echo "ARVADOS_API_HOST=<${dest} host>"
-    echo "ARVADOS_API_TOKEN=<${dest} token>"
-    exit 1
+if test -z "ARVADOS_API_HOST" ; then
+    echo "Please set ARVADOS_API_HOST to the destination cluster"
+    exit
 fi
 
+src=jutro
+tutorial=$1
+
 if ! test -f $HOME/.config/arvados/jutro.conf ; then
     # Set it up with the anonymous user token.
     echo "ARVADOS_API_HOST=jutro.arvadosapi.com" > $HOME/.config/arvados/jutro.conf
@@ -33,10 +29,8 @@ if ! test -f $HOME/.config/arvados/jutro.conf ; then
     exit 1
 fi
 
-for a in $(cat $HOME/.config/arvados/${dest}.conf) ; do export $a ; done
-
 echo
-echo "Copying from public data cluster (jutro) to $dest"
+echo "Copying from public data cluster (jutro) to $ARVADOS_API_HOST"
 echo
 
 make_project() {
@@ -48,14 +42,14 @@ make_project() {
     project_uuid=$(arv --format=uuid group list --filters '[["name", "=", "'"$name"'"], ["owner_uuid", "=", "'$owner'"]]')
     if test -z "$project_uuid" ; then
        project_uuid=$(arv --format=uuid group create --group '{"name":"'"$name"'", "group_class": "project", "owner_uuid": "'$owner'"}')
-       link=$(arv link create --link '{"link_class": "permission", "name": "can_read", "tail_uuid": "'$dest'-j7d0g-anonymouspublic", "head_uuid": "'$project_uuid'"}')
+
     fi
     echo $project_uuid
 }
 
 copy_jobs_image() {
     if ! arv-keepdocker | grep "arvados/jobs *latest" ; then
-       arv-copy --src jutro --dst $dest --project-uuid=$project_uuid jutro-4zz18-sxmit0qs6i9n2s4
+       arv-copy --project-uuid=$parent_project jutro-4zz18-sxmit0qs6i9n2s4
     fi
 }
 
@@ -67,17 +61,10 @@ if test "$tutorial" = "bwa-mem" ; then
     echo "Copying bwa mem tutorial"
     echo
 
-    set -x
-
-    project_uuid=$(make_project 'User guide resources' $parent_project)
-
-    # Bwa-mem workflow
-    arv-copy --src jutro --dst $dest --project-uuid=$project_uuid jutro-7fd4e-mkmmq53m1ze6apx
-
-    set +x
+    arv-copy --project-uuid=$parent_project jutro-j7d0g-rehmt1w5v2p2drp
 
     echo
-    echo "Finished, data copied to \"User guide resources\" at $project_uuid"
+    echo "Finished, data copied to \"User guide resources\" at $parent_project"
     echo "You can now go to Workbench and choose 'Run a process' and then select 'bwa-mem.cwl'"
     echo
 fi
@@ -87,17 +74,10 @@ if test "$tutorial" = "whole-genome" ; then
     echo "Copying whole genome variant calling tutorial"
     echo
 
-    set -x
-
-    project_uuid=$(make_project 'WGS Processing Tutorial' $parent_project)
-
-    # WGS workflow
-    arv-copy --src jutro --dst $dest --project-uuid=$project_uuid jutro-7fd4e-tnxg9ytblbxm26i
-
-    set +x
+    arv-copy --project-uuid=$parent_project jutro-j7d0g-n2g87m02rsl4cx2
 
     echo
-    echo "Finished, data copied to \"WGS Processing Tutorial\" at $project_uuid"
-    echo "You can now go to Workbench and choose 'Run a process' and then select 'bwa-mem.cwl'"
+    echo "Finished, data copied to \"WGS Processing Tutorial\" at $parent_project"
+    echo "You can now go to Workbench and choose 'Run a process' and then select 'WGS Processing Tutorial'"
     echo
 fi