Use Codex-only daily refresh
This commit is contained in:
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# AgentStage runs this hourly. Refresh exactly once during the 12:00 hour.
|
||||
export TZ=Asia/Shanghai
|
||||
hour="$(date +%H)"
|
||||
target_date="$(date -v-1d +%F 2>/dev/null || date -d yesterday +%F)"
|
||||
if [ "$hour" -ne 12 ]; then exit 0; fi
|
||||
|
||||
: "${TABLEAU_PAT_NAME:?Set TABLEAU_PAT_NAME in the AgentStage runner secret environment}"
|
||||
: "${TABLEAU_PAT_SECRET:?Set TABLEAU_PAT_SECRET in the AgentStage runner secret environment}"
|
||||
|
||||
repo_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
cd "$repo_dir"
|
||||
runtime_dir="${TABLEAU_HYPER_RUNTIME:-$repo_dir/.runtime/tableau-hyperapi}"
|
||||
success_marker="$repo_dir/.runtime/last-successful-date"
|
||||
if [ -f "$success_marker" ] && [ "$(cat "$success_marker")" = "$target_date" ]; then
|
||||
exit 0
|
||||
fi
|
||||
if ! PYTHONPATH="$runtime_dir" python3 -c 'import tableauhyperapi' 2>/dev/null; then
|
||||
mkdir -p "$runtime_dir"
|
||||
python3 -m pip install --disable-pip-version-check --target "$runtime_dir" tableauhyperapi
|
||||
fi
|
||||
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp_dir"' EXIT
|
||||
raw_file="$tmp_dir/tableau.csv"
|
||||
PYTHONPATH="$runtime_dir" python3 refresh_tableau.py "$target_date" "$raw_file"
|
||||
python3 transform_tableau.py "$raw_file" "$target_date"
|
||||
printf '%s\n' "$target_date" > "$success_marker"
|
||||
Reference in New Issue
Block a user