#!/usr/bin/env bash

# Deletes all perf/flamegraph data from chum for the given run ID. Allows you
# to re-run the ingest step for that run ID if you suspect corrupt data was
# published to the variant by ingest.

if [ $# -ne 1 ]; then
  echo "Usage: $0 <run ID>"
  exit 1
fi

source $ZOOX_WORKSPACE_ROOT/scripts/shell/zooxrc.sh

runid="$1"

brun //data/chum/tools:chunk_rm -- \
  "-input=s3://zoox-chum-vars" \
  "-uri=${runid}?v=perf/flamegraph" \
  -dryrun=false

echo "Done! Perf data for $runid deleted. You can re-run perf_data ingest now."
