Home | Trees | Indices | Help |
---|
|
A quantity of resources
This class is used to represent a quantity of resources, such as those required by a lease. For example, if a lease needs a single node with 1 CPU and 1024 MB of memory, a single Capacity object would be used containing that information.
Resources in a Capacity object can be multi-instance, meaning that several instances of the same type of resources can be specified. For example, if a node requires 2 CPUs, then this is represented as two instances of the same type of resource. Most resources, however, will be "single instance" (e.g., a physical node only has "one" memory).
Note: This class is similar, but distinct from, the ResourceTuple class in the slottable module. The ResourceTuple class can contain the same information, but uses a different internal representation (which is optimized for long-running simulations) and is tightly coupled to the SlotTable class. The Capacity and ResourceTuple classes are kept separate so that the slottable module remains independent from the rest of Haizea (in case we want to switch to a different slottable implementation in the future).
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
Constructs an empty Capacity object. All resource types are initially set to be single-instance, with a quantity of 0 for each resource. Argument: types -- List of resource types. e.g., ["CPU", "Memory"]
|
Gets the number of instances for a resource type Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) |
Gets the quantity of a single-instance resource Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) |
Gets the quantity of a specific instance of a multi-instance resource. Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) instance -- The instance. Note that instances are numbered from 1. |
Sets the quantity of a single-instance resource Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) amount -- The amount to set the resource to. |
Sets the quantity of a specific instance of a multi-instance resource. Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) instance -- The instance. Note that instances are numbered from 1. amount -- The amount to set the instance of the resource to. |
Changes the number of instances of a resource type. Note that changing the number of instances will initialize all the instances' amounts to zero. This method should only be called right after constructing a Capacity object. Argument: type -- The type of resource (using the same name passed when constructing the Capacity object) ninstance -- The number of instances |
Returns a string representation of the Capacity
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Dec 17 10:59:20 2009 | http://epydoc.sourceforge.net |