[Swift-commit] r5755 - provenancedb

lgadelha at ci.uchicago.edu lgadelha at ci.uchicago.edu
Tue Apr 24 14:24:13 CDT 2012


Author: lgadelha
Date: 2012-04-24 14:24:13 -0500 (Tue, 24 Apr 2012)
New Revision: 5755

Modified:
   provenancedb/prov-to-sql.sh
Log:
Minor fixes.


Modified: provenancedb/prov-to-sql.sh
===================================================================
--- provenancedb/prov-to-sql.sh	2012-04-24 11:58:19 UTC (rev 5754)
+++ provenancedb/prov-to-sql.sh	2012-04-24 19:24:13 UTC (rev 5755)
@@ -16,8 +16,8 @@
 
 echo "    - Function calls."
 while read time duration thread localthread endstate tr_name scratch; do
-    echo "INSERT INTO fun_call (id, type, run_id) VALUES ('$thread', 'execute', '$WF');"  >> /tmp/$RUNID-1.sql
-    echo "INSERT INTO app_fun_call (id, fun_call_name, start_time, duration, final_state, scratch) VALUES ('$thread', '$tr_name', $time, $duration, '$endstate', '$scratch');"   >> /tmp/$RUNID.sql
+    echo "INSERT INTO fun_call (id, type, run_id) VALUES ('$thread', 'execute', '$WF');"  >> /tmp/$RUNID.sql
+    echo "INSERT INTO app_fun_call (id, name, start_time, duration, final_state, scratch) VALUES ('$thread', '$tr_name', $time, $duration, '$endstate', '$scratch');"   >> /tmp/$RUNID.sql
 done < execute.global.event
 
 echo "    - Application executions."
@@ -81,10 +81,6 @@
     echo  "INSERT INTO ds_in (fun_call_id, ds_id, parameter) VALUES ('$id', '$value', 'undefined');"  >> /tmp/$RUNID.sql
 done < function-inputs.txt
 
-echo "    - Function call names."
-while read thread appname; do
-    echo  "UPDATE fun_call SET name='$appname' WHERE id='$thread';"  >> /tmp/$RUNID.sql
-done < invocation-procedure-names.txt
 
 echo "    - Script run events."
 while read start duration wfid rest; do
@@ -126,23 +122,6 @@
     echo "INSERT INTO $table (fun_call_id, ds_id, parameter) VALUES ('$thread', '$dataset', '$variable');"  >> /tmp/$RUNID.sql
 done < tie-data-invocs.txt
 
-echo "    - Wrapper log extra info."
-if [ -f extrainfo.txt ]; then
-    while read execute2_id extrainfo; do
-	echo $extrainfo | awk -F ";"  '{ for (i = 1; i <= NF; i++)
-                                               print $i
-                                         }' | awk -F "=" '{ print $1 " " $2 }' | awk -F ":" '{ print $1 " " $2 }' > fields.txt
-	id=$($SQLCMD --tuples-only -c "select app_fun_call_id from app_exec where id='$execute2_id';" | awk '{print $1}')
-	while read name type value; do
-	    if [ "$type" = "num" ]; then
-		echo "INSERT INTO annot_fun_call_num (id, name, value) VALUES ('$id', '$name', $value);"  >> /tmp/$RUNID.sql
-	    fi 
-	    if [ "$type" = "txt" ]; then
-		echo "INSERT INTO annot_fun_call_text (id, name, value) VALUES ('$id', '$name', '$value');"  >> /tmp/$RUNID.sql
-	    fi
-	done < fields.txt
-    done < extrainfo.txt
-fi
 
 echo "    - Wrapper log resource consumption info."
 if [ -f runtime.txt ]; then
@@ -168,12 +147,35 @@
 	minorpagefaults=$(echo $runtime | awk -F "," '{print $12}' | awk -F ":" '{print $2}')
 	contextswitchesinv=$(echo $runtime | awk -F "," '{print $13}' | awk -F ":" '{print $2}')
 	contextswitchesvol=$(echo $runtime | awk -F "," '{print $14}' | awk -F ":" '{print $2}')
-	echo "UPDATE app_exec SET maxrss=$maxrss, walltime=$walltime, systime=$systime, usertime=$usertime, cpu=$cpu, fsin=$fsin, fsout=$fsout, timesswapped=$timesswapped, socketrecv=$socketrecv, socketsent=$socketsent, majorpagefaults=$majorpagefaults, minorpagefaults=$minorpagefaults, contextswitchesinv=$contextswitchesinv, contextswitchesvol=$contextswitchesvol where id='$execute2_id';"  >> /tmp/$RUNID.sql
+	echo "UPDATE app_exec SET maxrss=$maxrss, walltime=$walltime, systime=$systime, usertime=$usertime, cpu=$cpu, fsin=$fsin, fsout=$fsout, timesswpd=$timesswapped, socketrecv=$socketrecv, socketsent=$socketsent, majpfaults=$majorpagefaults, minpfaults=$minorpagefaults, ctxswinv=$contextswitchesinv, ctxswvol=$contextswitchesvol where id='$execute2_id';"  >> /tmp/$RUNID.sql
     done < runtime.txt
 fi
 
+echo "    - Function call names."
+while read thread appname; do
+    echo  "UPDATE fun_call SET name='$appname' WHERE id='$thread';"  >> /tmp/$RUNID.sql
+done < invocation-procedure-names.txt
+
+echo "    - Wrapper log extra info."
+if [ -f extrainfo.txt ]; then
+    while read execute2_id extrainfo; do
+	echo $extrainfo | awk -F ";"  '{ for (i = 1; i <= NF; i++)
+                                               print $i
+                                         }' | awk -F "=" '{ print $1 " " $2 }' | awk -F ":" '{ print $1 " " $2 }' > fields.txt
+	id=$($SQLCMD --tuples-only -c "select app_fun_call_id from app_exec where id='$execute2_id';" | awk '{print $1}')
+	while read name type value; do
+	    if [ "$type" = "num" ]; then
+		echo "INSERT INTO annot_fun_call_num (id, name, value) VALUES ('$id', '$name', $value);"  >> /tmp/$RUNID.sql
+	    fi 
+	    if [ "$type" = "txt" ]; then
+		echo "INSERT INTO annot_fun_call_text (id, name, value) VALUES ('$id', '$name', '$value');"  >> /tmp/$RUNID.sql
+	    fi
+	done < fields.txt
+    done < extrainfo.txt
+fi
+
 echo "Finished SQL generation."
 echo "Exporting provenance to database..."
-$SQLCMD -f /tmp/$RUNID.sql 1> /tmp/$RUNID-provenancedb-import.log
-rm /tmp/$RUNID.sql
+$SQLCMD -f /tmp/$RUNID.sql 1> /dev/null 2> /tmp/$RUNID-provenancedb-error.log
+mv /tmp/$RUNID.sql /tmp/$RUNID.sql-$(date +%Y%m%d%H%M%S)
 echo "Finished exporting provenance to database."
\ No newline at end of file




More information about the Swift-commit mailing list