cobald.composite.factory module
- class cobald.composite.factory.FactoryPool(*args, **kwargs)[source]
Bases:
CompositePoolComposition that adds and removes pools to satisfy demand
- Parameters:
factory – a callable that produces a new
Poolinterval – how often to adjust the number of children
Adjustment uses two extensions that children must respond to adequately:
When spawned via
factory(), children shall already be set to their expecteddemand.When disabled via
demand=0, children shall shut down and free any resources and tasks.
Once spawned, children are free to adjust their demand if required. A child may disable itself permanently by setting its own
demand = 0. TheFactoryPoolinspects the demand for all its children before spawning or disabling any children.Any child which satisfies
supply > 0ordemand > 0is considered active and contributes to theFactoryPoolsupply,demand,allocation, andutilisation. TheFactoryPoolmakes no assumption about the validity or fitness of active children. It is the responsibility of children to report their status accordingly. For example, if a child shuts down and does not allocate itssupplyfurther, it should scale its reportedallocationaccordingly.- property allocation
Fraction of the provided resources which are assigned for usage
- property children
The individual resource providers making up this pool
- property demand
The volume of resources to be provided by this pool
- property supply
The volume of resources that is provided by this pool
- property utilisation
Fraction of the provided resources which are actively used