Resource Manager
- class vivarium.engine.framework.resource.manager.ResourceManager[source]
Manages all the resources needed for population initialization.
- property sorted_nodes: list[Resource]
Returns a topological sort of the resource graph.
Notes
Topological sorts are not stable. Be wary of depending on order where you shouldn’t.
- setup(builder)[source]
Defines custom actions this manager needs to run during the setup lifecycle phase.
This method is intended to be overridden by subclasses to perform any necessary setup operations specific to the manager. By default, it does nothing.
- add_resource(resource)[source]
Adds managed resources to the resource pool.
- Return type:
- Parameters:
resource (Resource) – The resource being added
- Raises:
ResourceError – If there are multiple producers of the same resource.
- add_private_columns(initializer, columns, required_resources)[source]
Adds private column resources to the resource pool.
- Return type:
- Parameters:
initializer (Callable[[SimulantData], None]) – A method that will be called to initialize the state of new simulants.
columns (Iterable[str] | str) – The population state table private columns that the given initializer provides initial state information for.
required_resources (Iterable[str | Resource]) – The resources that the initializer requires to run. Strings are interpreted as attributes.