cobald.interfaces package
Interfaces for primitives of the cobald model
Each Pool provides a varying number of resources.
A Controller adjusts the number of resources that
a Pool must provide.
Several Pools can be combined in a single
CompositePool to appear as one.
To modify how a Pool presents or digests data,
any number of PoolDecorator may proceed it.
- class cobald.interfaces.CompositePool[source]
Bases:
PoolConcatenation of multiple providers for a number of indistinguishable resources
- abstract property allocation: float
Fraction of the provided resources which are assigned for usage
- abstract property demand
The volume of resources to be provided by this pool
- abstract property supply
The volume of resources that is provided by this pool
- class cobald.interfaces.Controller(target: Pool)[source]
Bases:
objectController adjusting the demand in a
Pool- Parameters:
target – the resource pool for which demand is adjusted
- class cobald.interfaces.Partial(ctor: Type[C_co], *args, __leaf__, **kwargs)[source]
Bases:
Generic[C_co]Partial application and chaining of Pool
Controllers andDecoratorsThis class acts similar to
functools.partial, but allows for repeated application (currying) and explicit binding via the>>operator.# incrementally prepare controller parameters control = Partial(Controller, rate=10, interval=10) control = control(low_utilisation=0.5, high_allocation=0.9) # apply target by chaining pipeline = control >> Decorator() >> Pool()
- Note:
The keyword argument
__leaf__is reserved for internal usage.- Note:
Binding
Controllers andDecorators creates a temporaryPartialBind. Only binding to aPoolas the last element creates a concrete binding.
- args
- ctor
- kwargs
- leaf
- class cobald.interfaces.Pool[source]
Bases:
objectIndividual provider for a number of indistinguishable resources
- abstract property allocation: float
Fraction of the provided resources which are assigned for usage
- class cobald.interfaces.PoolDecorator(target: Pool)[source]
Bases:
PoolDecorator modifying how a pool provides resources
- Parameters:
target – the resource pool for which demand is adjusted
- property demand
The volume of resources to be provided by this site
- classmethod s(*args, **kwargs) Partial[C][source]
Create an unbound prototype of this class, partially applying arguments
decorator = Buffer.s(window=20) pipeline = controller >> decorator >> pool
- property supply
The volume of resources that is provided by this site