-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun.sh
More file actions
45 lines (38 loc) · 1.37 KB
/
Copy pathrun.sh
File metadata and controls
45 lines (38 loc) · 1.37 KB
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
#!/bin/bash
# This executes the run script
required_vars=(ELASTIC_HOST ELASTIC_USER ELASTIC_USER_PASSWORD REDIS_HOST)
missing=()
for var in "${required_vars[@]}"; do
[[ -z "${!var}" ]] && missing+=("$var")
done
if [[ ${#missing[@]} -gt 0 ]]; then
echo "Error: missing required environment variables: ${missing[*]}"
exit 1
fi
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Build the source code
source "$current_dir/clean.sh"
if ! source "$current_dir/build.sh"; then
echo "Error: Build failed. Aborting."
exit 1
fi
# Debug: Check if the executable exists
if [ -f "$BUILD_DIR/$EXECUTABLE_NAME" ]; then
echo "Executable $EXECUTABLE_NAME found in $BUILD_DIR."
else
echo "Error: Executable $EXECUTABLE_NAME not found in $BUILD_DIR."
ls -la "$BUILD_DIR" # List the contents of the build directory for debugging
exit 1
fi
if ! redis-cli -h localhost ping >/dev/null 2>&1; then
echo "redis-server not reachable on localhost:6379 — skipping"
exit 0
fi
start_time=$(date +%s%N)
# Invoke the `run` subcommand: BacktestingEngine pops a Base64-encoded
# strategy off the Redis `strategy_queue` and executes it against the
# QuestDB host passed as the second argument (here, localhost).
./"$BUILD_DIR/$EXECUTABLE_NAME" run localhost
end_time=$(date +%s%N)
elapsed=$(( (end_time - start_time) / 1000000 ))
echo "Execution time: ${elapsed}ms"