#!/usr/bin/env bash
set -euo pipefail

RUN_ID="$1"
TMP_DIR="$(mktemp -d -t bw-XXXXXXXXXX)"

bazel run //experimental/jake:print_topic_bw_over_runs -- \
    --output-path="$TMP_DIR" \
    --just_the_gold \
    --route="LV - BAM Challenge Route w/ Airport" \
    --vehicle_type="Kitt" \
    --git_branch_regex="ZX.AI.20.49b" \
    --window_start='2021-01-01' \
    --run_id='20210116T194955-kitt_21'

bazel run //scripts/tools/zci:compare_bw_analysis -- \
        --lhs_run_id "$RUN_ID" \
        --avg_acceptable_kbps_increase=150 \
        --bw_type=bw_vehicle_diff \
        --rhs_pbtxt "$TMP_DIR/golden_bw_analysis.pbtxt" \
        --no_bazel \
        --ingest

rm -r $TMP_DIR
