Spaces:
Running
Running
| /** | |
| * Merge bench-C*.json β metrics CSV + P1 summary + pareto SVG. | |
| * | |
| * Env: | |
| * OPENHANDS_REPORTS_DIR β default artifacts/openhands-reports | |
| * P1_METRICS_CSV β default artifacts/openhands-metrics.csv | |
| * P1_SUMMARY_JSON β default artifacts/openhands-p1-summary.json | |
| * P1_PARETO_SVG β default artifacts/figures/pareto-saved-vs-success.svg | |
| */ | |
| import fs from "fs"; | |
| import path from "path"; | |
| import { | |
| aggregateP1, | |
| loadBenchReports, | |
| writeMetricsCsv, | |
| writeParetoSvg, | |
| } from "../../src/benchmark/openhands-aggregate.ts"; | |
| const reportsDir = path.resolve(process.env.OPENHANDS_REPORTS_DIR ?? "artifacts/openhands-reports"); | |
| const metricsCsv = path.resolve(process.env.P1_METRICS_CSV ?? "artifacts/openhands-metrics.csv"); | |
| const summaryJson = path.resolve(process.env.P1_SUMMARY_JSON ?? "artifacts/openhands-p1-summary.json"); | |
| const paretoSvg = path.resolve(process.env.P1_PARETO_SVG ?? "artifacts/figures/pareto-saved-vs-success.svg"); | |
| const reports = loadBenchReports(reportsDir); | |
| if (reports.length === 0) { | |
| console.error(`No bench-*.json in ${reportsDir}`); | |
| process.exit(1); | |
| } | |
| const { csvRows, summary } = aggregateP1(reports); | |
| writeMetricsCsv(csvRows, metricsCsv); | |
| writeParetoSvg(summary.pareto_points, paretoSvg); | |
| fs.mkdirSync(path.dirname(summaryJson), { recursive: true }); | |
| fs.writeFileSync(summaryJson, `${JSON.stringify(summary, null, 2)}\n`, "utf-8"); | |
| console.log(JSON.stringify(summary, null, 2)); | |
| console.error(`Wrote ${metricsCsv}, ${summaryJson}, ${paretoSvg}`); | |