R6 class for managing a collection of trials with optional persistence.
Existing JSONL records are loaded when log_dir already contains a log.
New trials are appended one record at a time; matching trial IDs are
idempotent, while conflicting records with the same ID are rejected. The
trials.jsonl journal is authoritative. metadata.json, README.md, and
best_program.rds are independently refreshed, best-effort derived views;
they may lag after an interruption and are rebuilt by a later successful
save. On Unix, a pre-existing private log directory must be owned by the
effective user with exactly mode 0700, and every pre-existing log file must
have exactly mode 0600; special mode bits are rejected. Every existing
ancestor must be owned by root or the effective user, including sticky
shared parents. Before initialization or a save to another directory locks,
reads, or mutates storage, dsprrr preflights every known target: the lock,
journal, metadata, summary, and best-program artifact. Unsafe paths are
rejected without repair or reads. Directories and files created for the
current operation are enforced as owner-only. Non-symbolic regular files
remain required. Windows uses the account's filesystem ACLs, which base R
cannot verify as owner-only, and fails closed if stable device and file
identifiers are unavailable.
Public fields
optimizer_nameName of the optimizer using this log.
log_dirDirectory for persistence (NULL for in-memory only).
trialsList of optimization trial records.
metadataAdditional metadata about the optimization run.
Methods
TrialLog$new()
Create or resume a TrialLog. Existing JSONL records are loaded without rewriting the file.
Usage
TrialLog$new(optimizer_name, log_dir = NULL, metadata = NULL)TrialLog$add_trial()
Add a trial to the log. Persisted trials atomically append one authoritative JSONL record. Derived metadata, summaries, and the best program are then refreshed independently on a best-effort basis.
Arguments
trialA trial record created by
create_trial().persistWhether to immediately persist to disk if log_dir is set.
TrialLog$save()
Save the trial log to disk. Only records missing from the destination are appended to the authoritative journal. Derived files are independently refreshed on a best-effort basis and may lag if that refresh warns.