Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion composer/diagnostics/timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

from contextlib import asynccontextmanager, contextmanager
import os
from logging import Logger
import time
from contextvars import ContextVar
Expand Down Expand Up @@ -75,6 +76,10 @@ class PhaseRecord:
final_link: str | None = None # URL (cloud) or local results directory (local) of the last prover run.
token_usage_by_model: dict[str, TokenTotals] = field(default_factory=dict)

def run_id_generator() -> str:
if (res := os.getenv("AUTOPROVER_JOB_ID")):
return res
return uuid.uuid4().hex

@dataclass
class RunSummary:
Expand All @@ -85,7 +90,7 @@ class RunSummary:
_active_prover_by_task: dict[str, tuple[float, int]] = field(default_factory=dict, repr=False)
prover_reported_ms_total: int = 0 # Run-wide prover-REPORTED runtime, summed over every prover run. Distinct from prover_total_s, which is composer's client-side wall-clock (and so includes cloud queue / polling / result download).
_active_prover_reported_by_task: dict[str, int] = field(default_factory=dict, repr=False) # Maps task_id -> prover-reported ms accumulated while the task is in flight.
run_id: str = field(default_factory=lambda: uuid.uuid4().hex) # Maps task_id -> (prover_s_accum, prover_calls) recorded while task is in flight.
run_id: str = field(default_factory=run_id_generator) # Maps task_id -> (prover_s_accum, prover_calls) recorded while task is in flight.
_latest_link_by_task: dict[str, str] = field(default_factory=dict, repr=False) # Maps task_id -> link for the most recent prover run.
token_usage_by_model: dict[str, TokenTotals] = field(default_factory=dict) # Maps model_name -> accumulated raw token counts across the whole run.
_active_tokens_by_task: dict[str, dict[str, TokenTotals]] = field(default_factory=dict, repr=False) # Maps task_id -> {model_name -> token counts} accumulated while the task is in flight.
Expand Down
1 change: 1 addition & 0 deletions composer/pipeline/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ async def cli_pipeline[P: enum.Enum, H](
model = get_model()
text_log, events_log = setup_autoprove_logging(project_root, thread_id)
print(f"autoprove logs: {text_log}\n events: {events_log}", file=sys.stderr)
print(f"Selected run id: {summary.run_id}")
install_run_summary(summary)

disc_cache_ns: tuple[str, ...] | None = (
Expand Down
Loading