Skip to content

Commit

Permalink
Fix telemetry query syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffxy committed Nov 23, 2023
1 parent bce1ee0 commit 1a1484f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/one_off/gather_athena_telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ mkdir -p $out_dir/raw

for epoch in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22; do
echo "Processing $epoch"
sql_file_orig=$out_dir/sql/epoch_${epoch}_orig.sql
sql_file_clean=$out_dir/sql/epoch_${epoch}.sql

jq -r '.["epoch_'"$epoch"'"] | .[]' $queries_json > $sql_file_orig

jq -r '.["epoch_'"$epoch"'"] | .[]' $queries_json > $out_dir/sql/epoch_${epoch}_orig.sql
# Need to fix the query: `movie_telemetry` should be `telemetry`
sed 's/movie_telemetry/telemetry/g' epoch_${epoch}_orig.sql > epoch_${epoch}.sql
sed 's/movie_telemetry/telemetry/g' $sql_file_orig > $sql_file_clean

# Need to fix problematic SQL synatx.
sed -i 's/timestamp >/"timestamp" > timestamp/g' $sql_file_clean
sed -i 's/timestamp </"timestamp" < timestamp/g' $sql_file_clean
sed -i 's/timestamp <=/"timestamp" <= timestamp/g' $sql_file_clean
sed -i 's/timestamp >=/"timestamp" >= timestamp/g' $sql_file_clean
sed -i 's/timestamp =/"timestamp" = timestamp/g' $sql_file_clean

echo "Gathering data..."
python ../../run_cost_model.py \
Expand Down

0 comments on commit 1a1484f

Please sign in to comment.