JsonlAuditSink#

class scikitplot.agent.JsonlAuditSink(path, *, fsync=False)[source]#

Append records to a JSON Lines file, one canonical line each.

Parameters:
pathstr or os.PathLike

The file; created if missing, never truncated.

fsyncbool, default=False

Call os.fsync after each record, so it survives a crash of the machine and not only of the process.

Parameters:
digest_at(run_id, seq)[source]#

Return the digest of record seq of run_id (reads the file).

Parameters:
Return type:

str | None

head(run_id)[source]#

Return the last record of run_id in the file.

The file is read once and then only again when another writer has changed it (its size or modification time differ).

Parameters:

run_id (str)

Return type:

dict[str, Any] | None

write(record)[source]#

Append record as one line and flush it.

Parameters:

record (Mapping[str, Any])

Return type:

None