| #!/bin/bash |
| |
|
|
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| cd "$SCRIPT_DIR" || exit 1 |
|
|
| echo "🔍 Scanning and processing all trace files..." |
| echo "" |
|
|
| count=0 |
| success=0 |
| failed=0 |
| failed_files=() |
|
|
| while IFS= read -r -d '' trace_file; do |
| echo "Processing: $trace_file" |
| |
| if python3 "$SCRIPT_DIR/extract_trace_tree.py" "$trace_file" > /dev/null 2>&1; then |
| ((success++)) |
| else |
| echo " ❌ Failed" |
| ((failed++)) |
| failed_files+=("$trace_file") |
| fi |
| |
| ((count++)) |
| |
| |
| if (( count % 10 == 0 )); then |
| echo "" |
| echo "📊 Progress: processed $count files (success: $success, failed: $failed)" |
| echo "" |
| fi |
| done < <(find . -name "langfuse_trace.json" -type f -print0) |
|
|
| echo "" |
| printf '%*s\n' 60 '' | tr ' ' '=' |
| echo "✨ Batch processing complete!" |
| printf '%*s\n' 60 '' | tr ' ' '=' |
| echo "Total processed: $count files" |
| echo "Success: $success" |
| echo "Failed: $failed" |
| echo "" |
|
|
| |
| if [ $failed -gt 0 ]; then |
| echo "❌ Failed files:" |
| for failed_file in "${failed_files[@]}"; do |
| echo " - $failed_file" |
| done |
| echo "" |
| fi |
|
|
| echo "💡 Tip: The tree is saved as execution_path.md next to langfuse_trace.json" |
|
|