quantlab.runs.record.compare#

quantlab.runs.record.compare(expected, actual, *, owner, partial=False)[source]#

Compare two provenance records, logging one warning per difference.

A provenance record holds data_fingerprint (a DataRecorder.records) and code (a code_record). Each of the two is compared when both sides hold it and neither is None, so a caller with only the code passes {"code": ...}. Data are compared by digest alone, per key and request: a key or request on one side only, or a differing digest, logs a warning that explains a differing digest from the per-variable digests and dtypes and shows both ranges and sizes. Code is compared by module digest and library version, component modules reported before framework modules; the git commit is context only. Nothing is raised.

Parameters:
expected, actualmapping

The record of the earlier run and of this one.

ownerstr

The name that opens every warning.

partialbool

The failure-path comparison of the data: a key or request expected but not read yet is skipped, since “not read yet” is not “not read”, and every warning says the comparison is partial instead of “continuing”.

Examples

used is the trained unit a run used and retrained the unit a rebuild trained, both TrainedRun; unchanged data and code log nothing:

compare(
    {"data_fingerprint": used.data_fingerprint, "code": used.code},
    {"data_fingerprint": retrained.data_fingerprint, "code": retrained.code},
    owner="FirstFeatureHead training",
)