-
Notifications
You must be signed in to change notification settings - Fork 10
/
collect.sh
executable file
·67 lines (53 loc) · 1.6 KB
/
collect.sh
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
#!/bin/bash
# "Strict bash mode"
set -eu -o pipefail
IFS=$'\n\t'
# Compute paths
pushd "$(dirname "$0")" > /dev/null
SCRIPTPATH=$(pwd)
popd > /dev/null
# VARS
REPO="$SCRIPTPATH"
EPOCH=$(date +%s)
#-------------------------------------------------------------------------------
# Collect results
echo "Collect results"
mkdir -p "$REPO/collected/RESULTS"
# For each database in the results
RESULTS="$REPO/runtime/results.csv"
if [[ -f "$RESULTS" ]]; then
echo "$RESULTS"
if grep -c '^gremlin' "${RESULTS}" ; then
grep '^gremlin' "$RESULTS" | awk -F',' '{print $1}' |\
sort | uniq | while read -r DB
do
echo "Collecting results for $DB"
grep "^$DB," "$RESULTS" > "$REPO/collected/RESULTS/${EPOCH}_${DB}_results.csv"
done
fi
fi
echo "Collect timeouts"
# For each database in the timeout
TIMEOUTS="$REPO/timeout.log"
if [[ -f "$TIMEOUTS" ]]; then
awk -F',' '{print $2}' "$TIMEOUTS" | awk -F' ' '{print $NF}' |\
sort | uniq | while read -r DB
do
echo "Collecting timeouts for $DB"
TO_RES="$REPO/collected/RESULTS/${EPOCH}_${DB}_timeouts.csv"
grep "$DB," "$TIMEOUTS" >> "$TO_RES"
done
fi
#-------------------------------------------------------------------------------
# Collect raw files
echo "Collect raw"
RAW="$REPO/collected/RAW/${EPOCH}/"
mkdir -p "$RAW"
for fname in timeout docker test; do
[[ -f "$REPO"/${fname}.log ]] && mv -f "$REPO"/${fname}.log "$RAW"
done
for fname in results.csv errors.log debug.log; do
[[ -f "$REPO"/runtime/${fname} ]] && mv -f "$REPO"/runtime/${fname} "$RAW"
done
# This is needed to have the script end with a success status
echo "Done!"