nirs4all.pipeline.storage.artifacts.artifact_loader module

Artifact Loader V3 - Chain-based artifact loading for prediction replay.

This module provides the ArtifactLoader class which loads artifacts using the V3 chain-based identification system. It supports:

  • Loading by V3 artifact ID (pipeline$hash:fold)

  • Loading by operator chain path

  • Loading by step/branch/source/fold context

  • Transitive dependency resolution for stacking

  • Per-fold model loading for CV averaging

  • LRU caching for efficient reuse

V3 Key Features: - Chain path indexing for deterministic artifact lookup - Source index tracking for multi-source pipelines - Unified handling of branching, stacking, and bundles

The loader works with centralized storage at workspace/binaries/<dataset>/ and reads artifact metadata from V3 manifests.

class nirs4all.pipeline.storage.artifacts.artifact_loader.LRUCache(max_size: int = 100)[source]

Bases: object

Simple LRU cache with configurable max size.

Uses OrderedDict for O(1) access and LRU eviction.

clear() → None[source]

Clear all cached items.

contains(key: str) → bool[source]

Check if key is in cache without updating LRU order.

get(key: str) → Any | None[source]

Get item from cache, moving to end (most recently used).

Parameters:

key – Cache key

Returns:

Cached value or None if not found

put(key: str, value: Any) → None[source]

Put item in cache, evicting oldest if at capacity.

Parameters:
  • key – Cache key

  • value – Value to cache

remove(key: str) → None[source]

Remove item from cache.

property size: int

Current cache size.

property stats: dict[str, Any]

Get cache statistics.