File size: 1,342 Bytes
8c10cf2 | 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 | #!/bin/bash
# Batch-generate tree views for all langfuse_trace.json files
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++))
# Show progress every 10 files
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 there are failed files, list them
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"
|