[Swift-commit] r2895 - provenancedb
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Wed Apr 29 06:40:47 CDT 2009
Author: benc
Date: 2009-04-29 06:40:47 -0500 (Wed, 29 Apr 2009)
New Revision: 2895
Modified:
provenancedb/db-to-opm.sh
Log:
Add OPM OTimes into opm exporter
Modified: provenancedb/db-to-opm.sh
===================================================================
--- provenancedb/db-to-opm.sh 2009-04-29 11:39:27 UTC (rev 2894)
+++ provenancedb/db-to-opm.sh 2009-04-29 11:40:47 UTC (rev 2895)
@@ -13,6 +13,15 @@
grep -n "^$1\$" ids.txt | cut -f 1 -d ':'
}
+mkxmldatetime() {
+TZ=UTC date -j -f %s $1 +"%Y-%m-%dT%H:%M:%SZ"
+
+# this includes the TZ, but not in the correct format for xsd:dateTime
+# - xsd dateTime requires a colon separating the TZ hours and minutes
+# date -j -f %s $1 +"%Y-%m-%dT%H:%M:%S%z"
+
+}
+
rm -f opm.xml
echo "<opmGraph xmlns=\"http://openprovenance.org/model/v1.01.a\" xmlns:swift=\"tag:benc at ci.uchicago.edu,2008:swift:opm:20090419\">" > opm.xml
@@ -87,6 +96,12 @@
echo "</artifacts>" >> opm.xml
+# this agent is the Swift command-line client
+# TODO other agents - the wrapper script invocations at least
+echo "<agents>" >> opm.xml
+echo " <agent id=\"swiftclient\"><value/></agent>" >> opm.xml
+echo "</agents>" >> opm.xml
+
echo "<causalDependencies>" >> opm.xml
# other stuff can do this in any order, but here we must probably do it
@@ -116,10 +131,27 @@
fi
done >> opm.xml
+# attach timings of executes
+#sqlite3 -separator ' ' -batch provdb "select * from executes where id='$id';" | ( read id starttime duration finalstate app scratch; echo " <swift:executeinfo starttime=\"$starttime\" duration=\"$duration\" endstate=\"$finalstate\" app=\"$app\" scratch=\"$scratch\"/>" )
+# TODO for now, don't put any different between the no-later-than and
+# no-earlier-than times. in reality, we know the swift log timestamp
+# resolution and can take that into account
+
+sqlite3 -separator ' ' -batch provdb "select * from executes;" | while read id starttime duration finalstate app scratch ; do
+ ( echo "<wasControlledBy><effect id=\"$(mkid $id)\"/><role />" ;
+ echo "<cause id=\"swiftclient\"/>" ;
+ export XMLSTART=$(mkxmldatetime $starttime);
+ echo "<start><noEarlierThan>$XMLSTART</noEarlierThan><clockId>swiftclient</clockId></start>" ;
+ export E=$(mkxmldatetime $(echo $starttime + $duration | bc -l)) ;
+ echo "<end><noLaterThan>$E</noLaterThan><clockId>swiftclient</clockId></end>" ;
+ echo "</wasControlledBy>" ) >> opm.xml
+done
+
echo "</causalDependencies>" >> opm.xml
+
echo "</opmGraph>" >> opm.xml
echo Finished generating OPM, in opm.xml
More information about the Swift-commit
mailing list