ChartPipeline / scripts /run_line_pie_donut.sh
Ray1ee01's picture
Upload folder using huggingface_hub
58e6885 verified
Raw
History Blame Contribute Delete
2.37 kB
#!/usr/bin/env bash
# chart-only run for the donut/pie + line/spline whitelist over both data pools.
# Designed to be launched inside a tmux session.
#
# Whitelist (allowed_chart_types.json) should contain the donut/pie + line set.
#
# Outputs (NEW root, separate from the older pie/donut-only run):
# output/line_pie_donut_chart_only/<pool>/ -> final svg + png
# logs/line_pie_donut_<pool>.log -> pipeline stdout/stderr
set -u
set -o pipefail
cd "$(dirname "$0")/.."
ROOT="$(pwd)"
echo "[run_line_pie_donut] cwd=$ROOT"
if [[ ! -s allowed_chart_types.json ]]; then
echo "[run_line_pie_donut] ERROR: allowed_chart_types.json missing or empty" >&2
exit 1
fi
echo "[run_line_pie_donut] whitelist:"
cat allowed_chart_types.json
echo
export PUPPETEER_EXECUTABLE_PATH="${PUPPETEER_EXECUTABLE_PATH:-/usr/bin/google-chrome}"
THREADS="${THREADS:-48}"
echo "[run_line_pie_donut] PUPPETEER_EXECUTABLE_PATH=$PUPPETEER_EXECUTABLE_PATH"
echo "[run_line_pie_donut] THREADS=$THREADS"
echo
mkdir -p logs output/line_pie_donut_chart_only
mapfile -t POOLS < <(python -c "import config; print('\n'.join(config.data_resource_dirs))")
if [[ ${#POOLS[@]} -eq 0 ]]; then
echo "[run_line_pie_donut] ERROR: config.data_resource_dirs is empty" >&2
exit 1
fi
echo "[run_line_pie_donut] POOLS (from config.data_resource_dirs):"
printf ' %s\n' "${POOLS[@]}"
OVERALL_START=$(date +%s)
for pool in "${POOLS[@]}"; do
name="$(basename "$pool")"
out="output/line_pie_donut_chart_only/$name"
log="logs/line_pie_donut_${name}.log"
echo "============================================================"
echo "[run_line_pie_donut] pool=$pool"
echo "[run_line_pie_donut] out =$out"
echo "[run_line_pie_donut] log =$log"
echo "[run_line_pie_donut] starting at $(date -Iseconds)"
echo "[run_line_pie_donut] disk before: $(df -h /data | tail -1)"
echo "============================================================"
mkdir -p "$out"
python pipeline.py \
--input "$pool" \
--output "$out" \
--modules infographics_generator \
--chart-only --output-png \
--threads "$THREADS" \
2>&1 | tee "$log"
echo "[run_line_pie_donut] finished $name at $(date -Iseconds)"
echo "[run_line_pie_donut] disk after : $(df -h /data | tail -1)"
done
OVERALL_END=$(date +%s)
echo "[run_line_pie_donut] ALL DONE in $((OVERALL_END - OVERALL_START))s"