Skip to content

Index

The conformance check: run an analysis image the way the platform does.

An image is admitted for obeying the container contract, not for how it was built, so the check works on the image alone: it synthesises a recording that satisfies the configuration, writes the manifest the platform would write, runs the container under the platform's confinement, and checks the events document it produced. The same code serves an author's terminal, their continuous integration, and the platform's registration procedure.

The meter runs the same image on long recordings and compares its peak memory with the memory the configuration claims for each.

Entry points: :func:verify, :func:meter and the yousleep-verify command.

CheckResult dataclass

One property, and whether the artefact has it.

status property

PASS, FAIL or WARN.

MeterReport dataclass

The outcome of a metering run.

ok property

Every point was measured and the claim holds at each.

growth()

Find the largest rise of the peak with length, at one rate and selection.

Returns:

Type Description
tuple[float, int, float, int] | None

(short hours, its peak, long hours, its peak) when some peak

tuple[float, int, float, int] | None

rises by more than :data:GROWTH_MIB and :data:GROWTH_FRACTION;

tuple[float, int, float, int] | None

None otherwise.

problems()

Every reason the claim does not hold; empty when it does.

to_dict()

Return a JSON-ready view of the report.

Report dataclass

The outcome of a conformance run.

ok property

Every required check passed.

add(name, passed, detail, *, required=True)

Record a check and return whether it passed.

to_dict()

Return a JSON-ready view of the report.

propose(report, *, terms=None, margin=MARGIN)

Propose memory terms from the measured peaks.

The peaks are fitted to terms: by default the length terms the configuration uses, or every term when it uses none. The proposal keeps the fitted shape and scales it up:

  • the base is the report's headroom over the fitted base;
  • every fitted rate is multiplied by one factor, the smallest that gives each measured point the headroom, and at least margin so that the claim grows faster than the peaks beyond the longest recording measured. The points just past a power-of-two sample count usually set it, which carries their padding to the boundaries between the points;
  • rates are rounded up to a round number (105, 380, 1250), the base to a multiple of :data:BASE_STEP_MIB, and the base is raised if a point still lacks the headroom.

Raises:

Type Description
ValueError

If a point failed, or nothing was measured.

verify(*, image, config, runner, duration_seconds=300, seed=0, timeout_seconds=900, expected=None, record=False, pull=False, upstream_events=None, keep=None, config_only=False, tolerance=1e-06)

Check an image against a configuration.

Parameters:

Name Type Description Default
image str

The image reference to run.

required
config str | Path

The configuration file the image is registered with.

required
runner Runner

The container runtime, normally a :class:DockerRunner.

required
duration_seconds int

Length of the synthetic recording.

300
seed int

Makes the recording reproducible.

0
timeout_seconds float

Wall-clock ceiling for one run of the fixture.

900
expected str | Path | None

An events document recorded earlier; the run must match it.

None
record bool

Write the first run's document to expected instead of comparing, so a later run has something to match.

False
pull bool

Pull the image before inspecting it.

False
upstream_events str | Path | None

An events document to hand a downstream analysis, instead of a synthesised one.

None
keep str | Path | None

Keep the fixture in this directory instead of a temporary one.

None
config_only bool

Stop after the configuration check; no container runs.

False
tolerance float

How far a probability or value may drift from the recorded document; labels, times and channels must match exactly.

1e-06

Returns:

Type Description
Report

The report. report.ok is the verdict.