File size: 2,000 Bytes
58e6885
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
# Run chart-only generation for the pie/donut chart_type whitelist over both
# data pools. Designed to be launched inside a tmux session so it can run
# unattended for hours.
#
# Whitelist (allowed_chart_types.json) must contain:
#   {"chart_types": ["donut chart","pie chart","multiple donut chart","multiple pie chart"]}
#
# Outputs:
#   output/pie_donut_chart_only/<pool_basename>/    -> final svg + png
#   logs/pie_donut_<pool_basename>.log              -> pipeline stdout/stderr

set -u
set -o pipefail

cd "$(dirname "$0")/.."
ROOT="$(pwd)"
echo "[run_pie_donut] cwd=$ROOT"

if [[ ! -s allowed_chart_types.json ]]; then
  echo "[run_pie_donut] ERROR: allowed_chart_types.json missing or empty" >&2
  exit 1
fi
echo "[run_pie_donut] whitelist:"
cat allowed_chart_types.json
echo

export PUPPETEER_EXECUTABLE_PATH="${PUPPETEER_EXECUTABLE_PATH:-/usr/bin/google-chrome}"
THREADS="${THREADS:-32}"
echo "[run_pie_donut] PUPPETEER_EXECUTABLE_PATH=$PUPPETEER_EXECUTABLE_PATH"
echo "[run_pie_donut] THREADS=$THREADS"
echo

mkdir -p logs output/pie_donut_chart_only

POOLS=(
  /data/liduan/resources/claude_data_v2
  /data/liduan/resources/claude_new
)

OVERALL_START=$(date +%s)
for pool in "${POOLS[@]}"; do
  name="$(basename "$pool")"
  out="output/pie_donut_chart_only/$name"
  log="logs/pie_donut_${name}.log"
  echo "============================================================"
  echo "[run_pie_donut] pool=$pool"
  echo "[run_pie_donut] out =$out"
  echo "[run_pie_donut] log =$log"
  echo "[run_pie_donut] starting at $(date -Iseconds)"
  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_pie_donut] finished $name at $(date -Iseconds)"
done

OVERALL_END=$(date +%s)
echo "[run_pie_donut] ALL DONE in $((OVERALL_END - OVERALL_START))s"