[Swift-commit] r3833 - in provenancedb: . apps/oops

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Dec 27 19:51:41 CST 2010


Author: lgadelha
Date: 2010-12-27 19:51:41 -0600 (Mon, 27 Dec 2010)
New Revision: 3833

Modified:
   provenancedb/apps/oops/oops_extractor.sh
   provenancedb/pql_functions.sql
Log:
Minor fixes to provenancedb.


Modified: provenancedb/apps/oops/oops_extractor.sh
===================================================================
--- provenancedb/apps/oops/oops_extractor.sh	2010-12-28 00:17:14 UTC (rev 3832)
+++ provenancedb/apps/oops/oops_extractor.sh	2010-12-28 01:51:41 UTC (rev 3833)
@@ -23,7 +23,7 @@
     do 
 	cd $IMPORT_HOME
 	if ! grep --silent $i provdb_imported; then
-	    if grep --silent "Swift finished with no errors" $PROTESTS_HOME/$k/$i/psim.loops-*.log; then
+	    if grep --silent "Swift finished with no errors" $PROTESTS_HOME/$k/$i/*-*-*-*.log; then
 	        # swift-prov-import-all-logs also controls what already has been
 	        # imported, so it does not repeat work
 		echo "export LOGREPO=$PROTESTS_HOME/$k/$i" > $PROVDB_HOME/etc/provenance.config
@@ -68,7 +68,23 @@
 		    fi 
 		done < $FILENAME
 
-		# extracts scientific parameters given as input to the workflow in file *.params.
+		#extracts length of the fasta sequence given as input to the workflow in file *.fasta.
+		cd $IMPORT_HOME/swift-logs
+
+		echo "select file.id,file.filename from process, ds_usage, ds_containment, file where  process.id=ds_usage.process_id and ds_usage.dataset_id=out_id and file.id=ds_containment.in_id and filename like '%.fasta' and process.name='PrepLoop' and process.workflow_id='$WORKFLOW_ID' and ds_usage.direction='O';" > query.sql;
+		
+		$SQLCMD -t -A -F " " -f query.sql -o result.txt
+		
+		DATASET_ID=$(awk '{if (NR==1) print $1}' result.txt)
+		FILENAME=$(awk '{if (NR==1) print $2}' result.txt | sed 's/file:\/\/localhost\///g')
+		
+		cd $PROTESTS_HOME/$k/$i
+		
+		if [ -n "$FILENAME" ]; then
+		    SEQLENGTH=$(awk '{if (NR==2) print $1}' $FILENAME | wc -c)
+		    echo "insert into annot_ds_txt values ('$DATASET_ID', 'fasta_sequence_length', $SEQLENGTH);" | $SQLCMD
+		fi
+		# extracts scientific parameters given as output by the workflow in *.log.
 		# relevant lines:
 		# zone2            (Initial Energy: -21352.116911)
 		# Total Function Evaluations: 20000
@@ -79,10 +95,14 @@
 		# Final Energy: -27152.264775
 		# Final Temp: 79.778142
 		# Total Running Time: 18006
+
+		cd $IMPORT_HOME/swift-logs
 	    
 		echo "select file.id,file.filename from process, ds_usage, ds_containment, file where  process.id=ds_usage.process_id and ds_usage.dataset_id=out_id and file.id=ds_containment.in_id and filename like '%.log' and process.name='LoopModel' and process.workflow_id='$WORKFLOW_ID' and ds_usage.direction='O';" > query.sql;
 
 		$SQLCMD -t -A -F " " -f query.sql -o result.txt
+
+		cd $PROTESTS_HOME/$k/$i
 		
 		while read dataset filename; do
 		    FILENAME=$(echo $filename | sed 's/file:\/\/localhost\///g')
@@ -91,29 +111,29 @@
 			    initialenergy=$(echo $token3 | awk 'BEGIN { FS = "\)" }; {print $1}')
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'initial_energy', $initialenergy);" | $SQLCMD
 			fi
-			if [ "$token1" = "Total" && "$token2" = "Function" && "$token3" = "Evaluations:" ]; then
+			if [ "$token1" = "Total" ] && [ "$token2" = "Function" ] && [ "$token3" = "Evaluations:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'total_function_evaluations', $token4);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Increasing" && "$token2" = "transitions:" ]; then
+			if [ "$token1" = "Increasing" ] && [ "$token2" = "transitions:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'accepted_increasing_transitions', $token3);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Decreasing" && "$token2" = "transitions:" ]; then
+			if [ "$token1" = "Decreasing" ] && [ "$token2" = "transitions:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'accepted_decreasing_transitions', $token3);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Rejected" && "$token2" = "transitions:" ]; then
+			if [ "$token1" = "Rejected" ] && [ "$token2" = "transitions:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'rejected_transitions', $token3);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Final" && "$token2" = "Energy:" ]; then
+			if [ "$token1" = "Final" ] && [ "$token2" = "Energy:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'final_energy', $token3);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Final" && "$token2" = "Temp:" ]; then
+			if [ "$token1" = "Final" ] && [ "$token2" = "Temp:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'final_temp', $token3);" | $SQLCMD
 			fi 
-			if [ "$token1" = "Total" && "$token2" = "Running" && "$token3" = "Time:" ]; then
+			if [ "$token1" = "Total" ] && [ "$token2" = "Running" ] && [ "$token3" = "Time:" ]; then
 			    echo "insert into annot_ds_num (id, name, value) values ('$dataset', 'total_running_time', $token4);" | $SQLCMD
 			fi 
-		    done < result.txt
-		done < $FILENAME
+		    done < $FILENAME
+		done < $IMPORT_HOME/swift-logs/result.txt
 	    fi
 	fi 
     done

Modified: provenancedb/pql_functions.sql
===================================================================
--- provenancedb/pql_functions.sql	2010-12-28 00:17:14 UTC (rev 3832)
+++ provenancedb/pql_functions.sql	2010-12-28 01:51:41 UTC (rev 3833)
@@ -34,6 +34,20 @@
 	GROUP BY workflow.log_filename,ds_usage.param_name,variable.value;
 $$ LANGUAGE SQL;
 
+drop type annot_across_wf_type cascade;
+create type annot_across_wf_type as (workflow varchar, process varchar, name varchar, value numeric);
+
+create or replace function annot_across_wf(name varchar)
+returns setof annot_across_wf_type as $$
+	select   process.workflow_id,process.id,annot_ds_num.name,annot_ds_num.value 
+	from     process,ds_usage,ds_containment,annot_ds_num
+	where    process.id=ds_usage.process_id and ds_usage.dataset_id=ds_containment.out_id and
+        	 ds_containment.in_id=annot_ds_num.id and annot_ds_num.name=$1
+	order by process.workflow_id,process.id;
+$$ language sql;
+
+
+
 -- lists variations of the values of a set of parameters
 
 DROP TYPE param_across_wf_class_type CASCADE;
@@ -41,7 +55,7 @@
 
 CREATE OR REPLACE FUNCTION param_across_wf_class(param_name VARCHAR, wf_class VARACHAR) 
 RETURNS SETOF param_across_wf_type AS $$
-	
+
 $$ LANGUAGE plpgsql; 
 
 -- correlate a parameter with workflow runtime statistics




More information about the Swift-commit mailing list