Bench features in task-bench with --tasks features, from the folder the config names as bench-tasks
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -19,7 +19,7 @@ SIDES: tuple[Side, Side] = ("base", "head")
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Figures:
|
||||
"""One finished run, as its stream tells it. reads counts the reads and searches before the first open of the file the bug is
|
||||
in, and is None where the run never opened it."""
|
||||
in, and is None where the run never opened it, and in a run that built a feature, which has no such file."""
|
||||
version: str
|
||||
model: str
|
||||
tokens: Tokens
|
||||
@@ -59,12 +59,11 @@ COLUMNS = (
|
||||
Column("Wall, s", lambda found: found.seconds, "share"),
|
||||
Column("Reads", lambda found: found.reads, "count"),
|
||||
)
|
||||
HEADINGS = ["Bug", "Side", "Passed", *(column.heading for column in COLUMNS)]
|
||||
|
||||
|
||||
def figures(events: list[dict], bug_file: str) -> Figures | None | Failure:
|
||||
def figures(events: list[dict], bug_file: str | None) -> Figures | None | Failure:
|
||||
"""The figures of the run whose claude printed events, the objects parsed from its stream's lines, with bug_file the bug's file as the run's
|
||||
container names it.
|
||||
container names it, None where the run built a feature.
|
||||
|
||||
None where the stream holds no result. A Failure where the API refused the run, as on a token it doesn't take: such a run
|
||||
doesn't measure anything, and every later run would end the same."""
|
||||
@@ -80,7 +79,9 @@ def figures(events: list[dict], bug_file: str) -> Figures | None | Failure:
|
||||
return Figures(str(init.get("claude_code_version", "")), str(init.get("model", "")), tokens_of(result.get("usage")), int(result.get("num_turns") or 0), (result.get("duration_ms") or 0) / 1000, reads_before(calls, bug_file))
|
||||
|
||||
|
||||
def reads_before(calls: list[ToolCall], bug_file: str) -> int | None:
|
||||
def reads_before(calls: list[ToolCall], bug_file: str | None) -> int | None:
|
||||
if bug_file is None:
|
||||
return None
|
||||
count = 0
|
||||
for call in calls:
|
||||
read = reads_of(call, WORK, HOME).read
|
||||
@@ -90,13 +91,14 @@ def reads_before(calls: list[ToolCall], bug_file: str) -> int | None:
|
||||
return None
|
||||
|
||||
|
||||
def table(results: list[Result], tasks: dict[int, str]) -> list[str]:
|
||||
"""A row per task and side, then one per side over every task, then the head's change against the base, as `change` says. Each
|
||||
def table(results: list[Result], tasks: dict[int, str], noun: str = "bug") -> list[str]:
|
||||
"""A row per task and side, under a heading that calls a task by noun, then one per side over every task, then the head's change against the base, as `change` says. Each
|
||||
figure is the median over the side's runs that have figures, and Reads over those that opened the bug's file."""
|
||||
sides = {(task, side): [result for result in results if (result.task, result.side) == (task, side)] for task in tasks for side in SIDES}
|
||||
rows = [row(f"{task}: {tasks[task]}", side, sides[task, side]) for task in sorted(tasks) for side in SIDES]
|
||||
base, head = ([result for result in results if result.side == side] for side in SIDES)
|
||||
return [cells(HEADINGS), cells(["---"] * len(HEADINGS)).replace(" ", ""), *rows, row("All", "base", base), row("All", "head", head), change([(sides[task, "base"], sides[task, "head"]) for task in sorted(tasks)])]
|
||||
headings = [noun.capitalize(), "Side", "Passed", *(column.heading for column in COLUMNS)]
|
||||
return [cells(headings), cells(["---"] * len(headings)).replace(" ", ""), *rows, row("All", "base", base), row("All", "head", head), change([(sides[task, "base"], sides[task, "head"]) for task in sorted(tasks)])]
|
||||
|
||||
|
||||
def median(column: Column, results: list[Result]) -> float | None:
|
||||
|
||||
Reference in New Issue
Block a user