Skip to content

k4bench.plugin.schema

k4bench.plugin.schema

Version contracts of the timing plugins' JSON artifacts.

Each plugin stamps its output with a schema_version: the event timing plugin's <label>_events.json, the region timing plugin's <label>_regions.json and the Gaudi auditor's <label>_components.json and <label>_heap.json (the auditor also writes <label>_events.json, in the event format), and so do the k4run benchmark's <label>_dataflow.json, built from the auditor's file, the runners' <label>_event_size.json and the benchmarks' event_source.json.gz. Every reader validates through this module, so a new version of any format is accepted or refused in one place.

A file without schema_version is the legacy unversioned format of its kind and is read as before.

validate_event_schema

validate_event_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is an event file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_event_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is an event file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="event", current=EVENT_SCHEMA_VERSION, source=source)

validate_region_schema

validate_region_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is a region file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_region_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is a region file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="region", current=REGION_SCHEMA_VERSION, source=source)

validate_component_schema

validate_component_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is a component file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_component_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is a component file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="component", current=COMPONENT_SCHEMA_VERSION, source=source)

validate_heap_schema

validate_heap_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is a heap file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_heap_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is a heap file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="heap", current=HEAP_SCHEMA_VERSION, source=source)

validate_dataflow_schema

validate_dataflow_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is a data-flow file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_dataflow_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is a data-flow file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="dataflow", current=DATAFLOW_SCHEMA_VERSION, source=source)

validate_event_size_schema

validate_event_size_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is an event-size file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_event_size_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is an event-size file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="event size", current=EVENT_SIZE_SCHEMA_VERSION, source=source)

validate_event_source_schema

validate_event_source_schema(raw: object, *, source: str | Path | None = None) -> None

Raise ValueError unless raw is an event-source file this k4bench can read.

See :func:_validate_schema for the rules.

Source code in k4bench/plugin/schema.py
def validate_event_source_schema(raw: object, *, source: str | Path | None = None) -> None:
    """Raise ``ValueError`` unless *raw* is an event-source file this k4bench can read.

    See :func:`_validate_schema` for the rules.
    """
    _validate_schema(raw, kind="event source", current=EVENT_SOURCE_SCHEMA_VERSION, source=source)