-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswift-prov-import-all-logs-datalog
executable file
·82 lines (67 loc) · 2.18 KB
/
swift-prov-import-all-logs-datalog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
PROVDIR=$(dirname $0)
pushd $PROVDIR
PROVDIR=$(pwd)
popd
# we need to keep this out of the log-proceesing dir because import
# of individual runs will clean other files.
source $PROVDIR/etc/provenance.config
export PATH=$PROVDIR:$PATH
# this generates a file with tuples like:
# <starttime> <swift version> <logfilename>
# This is where Swift's version is collected.
swift-plot-log $LOGREPO everylog-vs-versions.data
if [ "$?" != "0" ]; then
echo swift-plot-log failed when building everylog-vs-versions.data
exit 1
fi
# TODO better tmp handling that always using the same name in a shared
# directory
cp everylog-vs-versions.data /tmp/
echo first commandline param is $1
if [ "$1" == "rebuild" ]; then
echo CLEANING DATABASE
cat $PROVDIR/provenancedb-rules.datalog > provenancedb.datalog
fi
while read start version filename; do
export IDIR=$(echo $filename | sed 's/\.log$/.d/')
echo IDIR=$IDIR
if [ $version -ge 1538 ]; then
echo -n "Log: $filename ... "
EXISTING=$(grep "hasLogFilename('$filename')." provenancedb.datalog)
if [ -z "$EXISTING" ]; then
PROV_ENABLED=$(grep provenanceid $filename | wc -l)
if [ $PROV_ENABLED -gt 0 ]; then
echo IMPORTING
if grep --silent "Loader Swift finished with no errors" $filename; then
wfstatus="SUCCESS"
else
wfstatus="FAIL"
fi
export RUNID=$(basename $filename .log)
export WF="${RUNID}"
echo WP1
echo "isRun('$WF')." >> provenancedb.datalog
echo "hasLogFilename('$WF', '$filename')." >> provenancedb.datalog
echo "hasSwiftVersion('$WF', '$version')." >> provenancedb.datalog
echo "hasFinalState('$WF', '$wfstatus')." >> provenancedb.datalog
echo version $version in log file $filename
echo ============= will import =============
prepare-for-import $filename
if [ "$?" != "0" ]; then
echo prepare-for-import failed
exit 2
fi
version=$version import-run-to-datalog $filename
if [ "$?" != "0" ]; then
echo import-run-to-datalog failed
exit 3
fi
else
echo SKIP: provenance.log not set to true in etc/swift.properties
fi
else
echo SKIP: Already known in workflow
fi
fi
done < /tmp/everylog-vs-versions.data