summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2010-12-27 08:40:08 -0800
committerTim Hatch <tim@timhatch.com>2010-12-27 08:40:30 -0800
commit75c7028fe60c08a2ff2f997e4b57f48ea975e6eb (patch)
tree43646f05d9c003952b926f15e1ceb0aabf97f29b
parent9d82262b1ddb5fdd8bba22b8f8a68efb613a697c (diff)
downloadmd5game-75c7028fe60c08a2ff2f997e4b57f48ea975e6eb.tar.gz
md5game-75c7028fe60c08a2ff2f997e4b57f48ea975e6eb.zip
Display benchmark numbers in submit_to_web_batch
-rwxr-xr-xsubmit_to_web_batch47
1 files changed, 47 insertions, 0 deletions
diff --git a/submit_to_web_batch b/submit_to_web_batch
index 09a9a6a..b6775f6 100755
--- a/submit_to_web_batch
+++ b/submit_to_web_batch
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+USER="$1"
+[ -z "$USER" ] && echo "Provide a user as the first arg" && exit 1
+[ -z "$HOST" ] && HOST="$(hostname -s)"
+[ "$HOST" == "localhost" ] && HOST="$(hostname)"
+
+CURL="`which curl`"
+[ ! -x "$CURL" ] && echo "No curl, please install" && exit 1
+
+RETRY_LOG=back.log
+
+trap clear_backlog INT TERM
+clear_backlog() {
+ # The fun stuff goes here
+ trap - INT TERM
+ submit
+}
+
+submit() {
+ echo "Buffer $buf"
+ curl --max-time 5 --retry 10 --retry-delay 2 -F user="$USER" -F host="$HOST" \
+ -F input_batch="$buf" "http://timhatch.com/projects/md5game/?a=submit&api=1"
+ if [ $? -ne 0 ]; then
+ echo "$buf" >> "$RETRY_LOG"
+ fi
+ buf=''
+ i=0
+}
+
+i=0
+buf=''
+while read f; do
+ echo "$f" | grep -q 'Benchmark\|Starting\|0x\|rough';
+ if [ $? -eq 0 ]; then echo "> $f"; continue; fi;
+ f="$(echo "$f" | sed -e 's/ .*//')"
+ echo "$f queued"
+ buf="$buf
+$f"
+ i=$(($i+1))
+ if [ $i -gt 10 ]; then
+ echo "Submitting..."
+ submit
+ fi
+done
+
+clear_backlog