manager#
- class ResourceManager(config: CanaryConfig)#
Bases:
objectOwns the concrete resource pool for a Canary configuration.
The parent process may discover resources through plugins. Subprocesses should receive the resolved resource pool through the config snapshot and reconstruct it locally without rerunning discovery.
- config#
- clear() None#
- invalidate() None#
- reset() None#
- get_pool() ResourcePool#
Return the resource pool, constructing it lazily if needed.
- get_property(name: str) Any#
- refresh() ResourcePool#
Force rediscovery/reconstruction of the resource pool.
This should generally only be used in the parent process.
- snapshot() dict[str, Any]#
Return resource-manager state suitable for a Config snapshot.
This snapshots the resource pool as it exists at the time of snapshot. The returned state is plain JSON/YAML-compatible data.
- load_snapshot(snapshot: dict[str, Any]) None#
Load resource-manager state from a Config snapshot.
After this, get_pool() reconstructs from the snapshot instead of running discovery hooks.
- describe() str#
- types() list[str]#
- count(type: str) int#
- count_per_node(type: str) int#
- checkout(request: list[dict[str, Any]], **kwds: Any) dict[str, dict]#
- checkin(allocation: dict[str, dict]) None#