[Swift-commit] r7220 - SwiftApps/gocat

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Thu Oct 24 10:24:34 CDT 2013


Author: ketan
Date: 2013-10-24 10:24:34 -0500 (Thu, 24 Oct 2013)
New Revision: 7220

Modified:
   SwiftApps/gocat/tagwrap.sh
Log:
 

Modified: SwiftApps/gocat/tagwrap.sh
===================================================================
--- SwiftApps/gocat/tagwrap.sh	2013-10-24 03:06:29 UTC (rev 7219)
+++ SwiftApps/gocat/tagwrap.sh	2013-10-24 15:24:34 UTC (rev 7220)
@@ -1,43 +1,30 @@
 #!/bin/bash -x
 
 # Usage: $0 <dataset_name> <tagname>=<value>
-
+# Required: Env variable catloc pointing to the directory containing catalog.py
 if [ $# -ne 2 ]
 then
- echo "Usage: $0 <dataset_name> <tagname>=<value>"
+ echo "Usage: $0 <dataset_name> <tagnamei1>=<value1> <tagname2>=<valu2> ..."
  exit 1
 fi
 
-loc=/scratch/local/ketan/catalog-client/globusonline/catalog/client/examples
 catid=48
 dsetname=$1
-tagvalpair=$2
+shift
 
-tagname=`echo $tagvalpair|awk -F= '{print $1}'`
-tagval=`echo $tagvalpair|awk -F= '{print $2}'`
+for tagvalpair in "$@"
+do
+  tagname=`echo $tagvalpair|awk -F= '{print $1}'`
+  tagval=`echo $tagvalpair|awk -F= '{print $2}'`
 
-# 1. Create dataset
- # a. Check if it already exists
- python $loc/catalog.py -text query_datasets $catid name EQUAL $dsetname
+  python $catloc/catalog.py -text query_datasets $catid name EQUAL $dsetname
+  exprstr="{\"name\":\"$dsetname\"}"
+  retstr=$(python $catloc/catalog.py create_dataset $catid $exprstr)
 
- exprstr="{\"name\":\"$dsetname\"}"
- echo '==='
- echo $exprstr
- echo '==='
- retstr=$(python $loc/catalog.py create_dataset $catid $exprstr)
+  python $catloc/catalog.py create_annotation_def $catid "$tagname" 'text'
+  dsetid=`echo $retstr |awk -F, '{print $2}'`
 
- echo '==='
- echo CatalogID, DatasetID: $retstr
- echo '==='
+  python $catloc/catalog.py add_dataset_annotation $catid $dsetid "{\"$tagname\":\"$tagval\"}"
 
-# 2. Annotate it
-  # a. create annotation definition
-  python $loc/catalog.py create_annotation_def $catid "$tagname" 'text'
+done
 
-  dsetid=`echo $retstr |awk -F, '{print $2}'`
-  echo '==='
-  echo "Dataset ID: $dsetid"
-  echo '==='
-  # b. Add dataset annotation
-  python $loc/catalog.py add_dataset_annotation $catid $dsetid "{\"$tagname\":\"$tagval\"}"
-




More information about the Swift-commit mailing list