accelmo.runlog.writer¶
Writing a run log from inside a fit.
- accelmo.runlog.writer.START_STEP = -1¶
The step under which
RunLog.begin()records the starting knobs.
- accelmo.runlog.writer.REOPEN_SECONDS = 10.0¶
Seconds between closing and reopening the append-only files. A flush only reaches the local cache on AFS; the server (and so other hosts) sees the data on close.
- accelmo.runlog.writer.write_json(path, payload)[source]¶
Write
payloadtopathatomically, so a reader never sees half a file.- Return type:
None- Parameters:
path (Path)
payload (Mapping[str, Any])
- class accelmo.runlog.writer.RunLog(directory, *, name, metadata=None, resume=False)[source]¶
Bases:
objectRecords one fit in
directory; seeaccelmo.runlogfor the files.Call
begin()with the starting knobs, thenlog()andrecord_knobs()once per step,finish()with how the fit ended andclose()at the end. Every write is flushed straight away, so a monitor in another process sees each step as soon as it is logged.- Parameters:
directory (Path)
name (str)
metadata (Mapping[str, Any] | None)
resume (bool)
- knob_names: list[str]¶
- begin(knobs, *, resume_step=None)[source]¶
Fix the knob order to that of
knobsand record them as the start.On a log opened with
resume=Truethat already has a stage file, the existing run is continued instead: rows fromresume_stepon (written after the checkpoint being restored) are dropped, and nothing else is rewritten.- Return type:
None- Parameters:
knobs (Mapping[str, float])
resume_step (int | None)
- log(step, **scalars)[source]¶
Append one line of scalars for
step.- Return type:
None- Parameters:
step (int)
scalars (float | bool | None)
- record_knobs(step, knobs)[source]¶
Append the knob values after
step, in the order fixed bybegin().- Return type:
None- Parameters:
step (int)
knobs (Mapping[str, float])
- finish(**summary)[source]¶
Record how the fit ended (stop reason, best loss, …).
- Return type:
None- Parameters:
summary (Any)