Skip to content

Commit ae60958

Browse files
committed
Add bash script to run the new job queue collector
1 parent eab3127 commit ae60958

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

collector/collect-job-queue.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# This script expects DATABASE and COLLECTOR_NAME to be defined in the environment
4+
5+
set -u -o pipefail
6+
7+
echo "Running job queue collector"
8+
9+
export RUST_LOG=collector=trace,collector::sysroot=debug
10+
export PATH="/home/collector/.cargo/bin:$PATH"
11+
12+
while : ; do
13+
# Update and rebuild the collector.
14+
git pull
15+
git reset --hard @{upstream}
16+
17+
# Make sure we have a recent build, so that we can successfully build
18+
# the collector.
19+
rustup update stable
20+
cargo +stable build --release -p collector
21+
22+
CURRENT_SHA=`git rev-parse HEAD`
23+
24+
target/release/collector benchmark_job_queue \
25+
--db "${DATABASE}" \
26+
--check_git_sha \
27+
--git_sha "${CURRENT_SHA}"
28+
--collector_name "${COLLECTOR_NAME}"
29+
30+
STATUS=$?
31+
echo finished run at `date` with exit code $STATUS
32+
33+
# Wait a bit if the command has failed.
34+
if [ $STATUS -ne 0 ]; then
35+
sleep 60
36+
fi
37+
done

0 commit comments

Comments
 (0)