Skip to content

Context


Immutable mapping of metric lists with safe append.

__init__() → None

add(key: str, value: Any) → None

as_dict() → Mapping[str, Tuple[Any, ...]]

Immutable execution context shared between pipeline steps.

Once a key is set its value cannot be modified. Attempting to do so raises :class:ContextMutationError. This immutability guarantees deterministic provenance during pipeline execution.

Attributes:

- <b>`metrics`</b>: :class:`FrozenMetrics` used to accumulate lists of metric values. artifacts: :class:`ArtifactLog` collecting binary artifacts to be saved
- <b>`by `</b>: class:`~crystallize.plugins.plugins.ArtifactPlugin`. logger: :class:`logging.Logger` used for debug and info messages.
__init__(
initial: Mapping[str, Any],
logger: Optional[logging.Logger] = None
) → None

add(key: str, value: Any) → None

Alias for __setitem__ providing a clearer API.


as_dict() → Mapping[str, Any]

get(key: str, default: Optional[Any] = None) → Any

Return the value for key if present else default.


A FrozenContext proxy that records every key read and emits DEBUG lines.

Parameters ---------- ctx: The original, immutable context created by the Experiment runner. logger: The logger to use for DEBUG instrumentation.

__init__(
ctx: crystallize.utils.context.FrozenContext,
logger: Optional[logging.Logger] = None
)

add(key: str, value: Any) → None

as_dict() → Mapping[str, Any]

get(key: str, default: Optional[Any] = None) → Any