Batch Report 技能
为已完成的批处理作业生成全面的分析报告。
特性
- 清单分析 - 统计成功、失败、部分完成项数量
- 时间分解 - 分析每个步骤的延迟,识别瓶颈
- 失败模式 - 分类和汇总失败原因
- 质量指标 - 对样本输出进行质量评估
- Markdown 报告 - 人类可读的摘要
- agent-inbox 集成 - 自动发送到项目收件箱
快速开始
cd .pi/skills/batch-report
# 为 extractor 批处理生成报告(自动检测格式)
uv run python report.py analyze /path/to/batch/output
# 生成报告并发送到 agent-inbox
uv run python report.py analyze /path/to/batch/output --send-to extractor
# 仅显示摘要统计信息
uv run python report.py summary /path/to/batch/output
# 分析独立的 state 文件
uv run python report.py state /path/to/.batch_state.json
# 输出 JSON 格式以便管道传输
uv run python report.py summary /path/to/output --json | jq .success_rate
命令
analyze - 完整分析报告
uv run python report.py analyze /path/to/output \
--output report.md \
--send-to extractor \
--priority high
选项:
| 选项 | 缩写 | 描述 |
|---|---|---|
--output | -o | 输出文件路径(默认为标准输出) |
--send-to | -s | 将报告发送到 agent-inbox 项目 |
--priority | -p | agent-inbox 的优先级(low/normal/high/critical) |
--sample | -n | 包含的样本数量(默认:5) |
--format | -f | 批处理格式:extractor、youtube、generic、auto(默认:auto) |
--json | -j | 输出为 JSON 格式,便于管道传输到其他工具 |
summary - 仅快速统计信息
uv run python report.py summary /path/to/output
uv run python report.py summary /path/to/output --json
输出:
Batch: run-2025-12-18_144426-2eb428c
Total: 230 | Success: 180 | Failed: 35 | Partial: 15
Success rate: 78.3%
Avg time: 4.2 min | Slowest: 09_section_summarizer (45%)
JSON 输出:
{
"batch": "run-2025-12-18_144426-2eb428c",
"format": "extractor",
"total": 230,
"successful": 180,
"partial": 15,
"failed": 35,
"success_rate": 78.3,
"avg_time_min": 4.2
}
state - 分析独立的 state 文件
uv run python report.py state /path/to/.batch_state.json
uv run python report.py state /path/to/.batch_state.json --json
适用于来自任何批处理作业的任何 .batch_state.json 文件。
failures - 列出失败项及其原因
uv run python report.py failures /path/to/output
uv run python report.py failures /path/to/output --json
报告格式
# 批处理报告:run-2025-12-18_144426-2eb428c
## 摘要
- **总项数:** 230
- **成功:** 180 (78.3%)
- **失败:** 35 (15.2%)
- **部分完成:** 15 (6.5%)
## 耗时分析
| 步骤 | 平均(秒) | 最大(秒) | 占总时间百分比 |
|------|---------|---------|------------|
| 09_section_summarizer | 120.5 | 341.0 | 45.2% |
| 05_table_extractor | 65.3 | 105.0 | 24.5% |
...
## 失败模式
| 模式 | 数量 | 示例 |
|---------|-------|---------|
| 空文本内容 Empty text_content | 12 | 047ca6ef... |
| CUDA 内存不足 | 5 | 9497a4e5... |
...
## 建议
1. 考虑为知识提取使用 --text-only 模式
2. 在 VLM 之前添加表格置信度阈值
...
可视化
生成报告后(特别是使用 --json 时),可通过 /create-figure 提供可视化功能:
# 按流水线步骤生成耗时瀑布图
create-figure metrics --input batch.json --output timing.png --type hbar --title "步骤耗时"
# 成功/失败分布
create-figure metrics --input batch.json --output results.png --type pie --title "批处理结果"
# 失败模式细分
create-figure metrics --input batch.json --output failures.png --type bar --title "失败模式"
何时提供: 展示批处理分析后,询问:“是否希望我将耗时分解可视化?”
支持的批处理格式
--format 标志接受:extractor、youtube、generic 或 auto(默认)。
自动检测逻辑:
- 如果存在
*/manifest.json和*/timings_summary.json→extractor - 如果
.batch_state.json的描述中包含“transcript” →youtube - 如果存在
.batch_state.json→generic
extractor 类型的批处理
预期文件:
*/manifest.json- 每项的清单*/timings_summary.json- 耗时数据*/14_report_generator/json_output/final_report.json- 质量指标failed_urls.txt- 失败项列表
YouTube 转录类型的批处理
预期文件:
.batch_state.json- 包含与转录相关的描述的 state 文件
generic 类型的批处理
预期文件:
.batch_state.json- 包含完成/失败计数的 state 文件*.log文件(可选)用于失败分析
与 agent-inbox 的集成
# 以 bug 形式发送报告
uv run python report.py analyze /path/to/output \
--send-to extractor \
--priority high
# 发送的消息:extractor_abc123
依赖项
dependencies = [
"typer",
"rich",
]