model_weights_keys
Where a process's model memo gets its host cache key from.
A background DAG run installs a key source before any step runs, and the model memo asks it once, at its first lookup, for the model-memo purpose key and the scope naming the host that key belongs to. A process with no source installed, or one whose source has no key to give, keeps its model weights to itself.
This module imports only the standard library, so the DAG-run side that
installs a source (flows/dag/child_auth.py) never imports the step packages
that consume it.
Module
Functions
install_key_source
def install_key_source(source: ModelMemoKeySource | None) ‑> None:Installs source as this process's model memo key source.
Arguments
source: The source to ask, orNonefor a process with nobody to ask.
installed_key_source
def installed_key_source( ,) ‑> ModelMemoKeySource | None:Returns this process's model memo key source.
Returns
The installed source, or None when none is installed.
Classes
MemoKeyResult
class MemoKeyResult( key: bytes | None, scope: str | None, reason: HostCacheKeyReason | None, fetch_seconds: float | None,):The outcome of asking for the model memo's host cache key.
Attributes
key: The 32-byte model-memo purpose key, orNonewhen there is none. Kept out ofrepr.scope: The<pid>-<create ms>scope of the host the key belongs to, orNonewhen there is no key.reason: Why there is no key, orNonewhen there is one.fetch_seconds: How long asking for the key took, orNonewhen nothing was asked.
Variables
-
fetch_seconds : float | None
-
key : bytes | None
-
reason : HostCacheKeyReason | None
-
scope : str | None
ModelMemoKeySource
class ModelMemoKeySource(*args, **kwargs):Something the model memo can ask for its host cache key.
Ancestors
Methods
memo_key
def memo_key(self) ‑> MemoKeyResult:Returns the model memo's host cache key, or why there is none.
Never raises: a source that cannot produce a key says why in the result.