Skip to content

Commit 6bd9cfa

Browse files
committed
refactor(harbor): remove project log summary
1 parent f82dded commit 6bd9cfa

3 files changed

Lines changed: 6 additions & 44 deletions

File tree

docs/harbor-braintrust-plugin-design.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Harbor final trial → Braintrust root eval span
1616
Harbor verifier rewards → Braintrust scores or metrics
1717
Harbor verifier labels → Braintrust classifications
1818
Harbor lifecycle + ATIF → child spans
19-
Harbor JobResult → final reconciliation + job summary
19+
Harbor JobResult → final reconciliation
2020
```
2121

2222
### Key decisions
@@ -57,7 +57,7 @@ Version 1 does not need to:
5757

5858
| Harbor | Braintrust | Notes |
5959
|---|---|---|
60-
| Job | Shared metadata + optional project-log summary | A job may create several experiments. |
60+
| Job | Shared metadata on experiments and eval roots | A job may create several experiments. |
6161
| Resolved dataset/task set | Dataset | Scope is the exact logical task selection. |
6262
| Task | Dataset record | Deterministic ID and canonical task input. |
6363
| Eval group/variant | Experiment | Partition by dataset and semantic agent config. |
@@ -307,7 +307,7 @@ Version 1 should only read labels from known Harbor adapters or explicit `classi
307307

308308
If `reward-details.json` exists, put a bounded summary in the scorer output and optionally attach the complete JSON. Do not create criterion-level or judge-LLM spans until Rewardkit has a stable, tested mapping.
309309

310-
Harbor's job metrics, custom `metric.py`, and pass@k remain authoritative aggregate results. Do not create a synthetic eval row for aggregates. Optionally write one project-log trace, `harbor.job.summary`, containing exact Harbor aggregates and links to partition experiments.
310+
Harbor's job metrics, custom `metric.py`, and pass@k remain authoritative aggregate results. Do not create a synthetic eval row or project-log trace for aggregates.
311311

312312
## ATIF import
313313

@@ -495,7 +495,6 @@ HarborPlugin(
495495
max_attachment_bytes=5_000_000,
496496
max_total_attachment_bytes=20_000_000,
497497
max_content_bytes=20_000,
498-
log_job_summary=True,
499498
log_retry_attempts=False,
500499
strict=False,
501500
)
@@ -527,7 +526,7 @@ Do not mutate private fields or depend on queue, metrics, progress, existing-tri
527526
2. Validate config/auth and read resolved tasks, lock, and custom metadata.
528527
3. Normalize metadata, build partitions, sync datasets, and initialize experiments.
529528
4. Register all trial hooks with one thin dispatcher.
530-
5. Dispatch job `READY`; optionally start a project-log job trace.
529+
5. Dispatch job `READY`.
531530

532531
Keep blocking SDK and filesystem work off Harbor's event loop. Preserve per-trial effect ordering while allowing independent trials to make progress concurrently.
533532

py/src/braintrust/integrations/harbor/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class PluginConfig:
103103
max_attachment_bytes: int = 5_000_000
104104
max_total_attachment_bytes: int = 20_000_000
105105
max_content_bytes: int = 20_000
106-
log_job_summary: bool = True
107106
log_retry_attempts: bool = False
108107
strict: bool = False
109108
redact_patterns: tuple[str, ...] = ()
@@ -119,7 +118,6 @@ def from_options(cls, **options: Any) -> "PluginConfig":
119118
for name in (
120119
"include_custom_metadata",
121120
"include_tracebacks",
122-
"log_job_summary",
123121
"log_retry_attempts",
124122
"strict",
125123
):

py/src/braintrust/integrations/harbor/plugin.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pathlib import Path
1515
from typing import Any
1616

17-
from braintrust.logger import Attachment, flush, init, init_dataset, init_logger
17+
from braintrust.logger import Attachment, flush, init, init_dataset
1818
from exceptiongroup import ExceptionGroup
1919

2020
from .atif import _INSTRUMENTATION, ATIFImportResult, import_trajectory, summarize_trajectory
@@ -263,7 +263,6 @@ def __init__(
263263
max_attachment_bytes: Any = _UNSET,
264264
max_total_attachment_bytes: Any = _UNSET,
265265
max_content_bytes: Any = _UNSET,
266-
log_job_summary: Any = _UNSET,
267266
log_retry_attempts: Any = _UNSET,
268267
strict: Any = _UNSET,
269268
**kwargs: Any,
@@ -291,7 +290,6 @@ def __init__(
291290
"max_attachment_bytes": max_attachment_bytes,
292291
"max_total_attachment_bytes": max_total_attachment_bytes,
293292
"max_content_bytes": max_content_bytes,
294-
"log_job_summary": log_job_summary,
295293
"log_retry_attempts": log_retry_attempts,
296294
"strict": strict,
297295
**kwargs,
@@ -356,7 +354,7 @@ async def reconcile(result: Any) -> None:
356354
for name in set(self._trial_machines) - final_names:
357355
await self._dispatch(name, TrialEvent(TrialEventKind.OMIT))
358356
try:
359-
await asyncio.to_thread(self._finalize, job_result)
357+
await asyncio.to_thread(flush)
360358
except Exception as exc:
361359
failures.append(exc)
362360
self._errors.append(f"final flush: {exc}")
@@ -813,39 +811,6 @@ def _sync_final_result(self, result: Any) -> None:
813811
root.log(metadata=metadata)
814812
root.end(end_time=root_end)
815813

816-
def _finalize(self, job_result: Any) -> None:
817-
if self._runtime is None:
818-
return
819-
if self.config.log_job_summary:
820-
project_logger = init_logger(
821-
project=self.config.project_name,
822-
project_id=self.config.project_id,
823-
set_current=False,
824-
)
825-
now = datetime.now().timestamp()
826-
summary_start, summary_end = _timing(job_result, now, now)
827-
summary = project_logger.start_span(
828-
name="harbor.job.summary",
829-
type="task",
830-
id=f"harbor-job-summary-{self._runtime.snapshot.job_id}",
831-
start_time=summary_start,
832-
set_current=False,
833-
input={"job_id": self._runtime.snapshot.job_id},
834-
metadata={
835-
"harbor": {
836-
"job_id": self._runtime.snapshot.job_id,
837-
"experiments": [
838-
{"id": partition.experiment_id, "name": partition.name}
839-
for partition in self._runtime.partitions.values()
840-
],
841-
}
842-
},
843-
internal={"instrumentation": _INSTRUMENTATION},
844-
)
845-
summary.log(output=job_result.stats.model_dump(mode="json", exclude_none=False))
846-
summary.end(end_time=summary_end)
847-
flush()
848-
849814
def _persist_disabled_manifest(self) -> None:
850815
if self._snapshot is None:
851816
return

0 commit comments

Comments
 (0)