Context
module crystallize.utils.context
Section titled “module crystallize.utils.context”class FrozenMetrics
Section titled “class FrozenMetrics”Immutable mapping of metric lists with safe append.
method FrozenMetrics.__init__
Section titled “method FrozenMetrics.__init__”__init__() → Nonemethod FrozenMetrics.add
Section titled “method FrozenMetrics.add”add(key: str, value: Any) → Nonemethod FrozenMetrics.as_dict
Section titled “method FrozenMetrics.as_dict”as_dict() → Mapping[str, Tuple[Any, ...]]class FrozenContext
Section titled “class FrozenContext”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.method FrozenContext.__init__
Section titled “method FrozenContext.__init__”__init__( initial: Mapping[str, Any], logger: Optional[logging.Logger] = None) → Nonemethod FrozenContext.add
Section titled “method FrozenContext.add”add(key: str, value: Any) → NoneAlias for __setitem__ providing a clearer API.
method FrozenContext.as_dict
Section titled “method FrozenContext.as_dict”as_dict() → Mapping[str, Any]method FrozenContext.get
Section titled “method FrozenContext.get”get(key: str, default: Optional[Any] = None) → AnyReturn the value for key if present else default.
class LoggingContext
Section titled “class LoggingContext”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.
method LoggingContext.__init__
Section titled “method LoggingContext.__init__”__init__( ctx: crystallize.utils.context.FrozenContext, logger: Optional[logging.Logger] = None)method LoggingContext.add
Section titled “method LoggingContext.add”add(key: str, value: Any) → Nonemethod LoggingContext.as_dict
Section titled “method LoggingContext.as_dict”as_dict() → Mapping[str, Any]method LoggingContext.get
Section titled “method LoggingContext.get”get(key: str, default: Optional[Any] = None) → Any