accasim.base.resource_manager_class module¶
MIT License
Copyright (c) 2017 cgalleguillosm
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
class
accasim.base.resource_manager_class.ResourceManager(_resource)[source]¶ Bases:
object-
allocate_event(event, node_names)[source]¶ Method for job allocation. It uses the event request to determine the resources to be allocated.
Parameters: - event – Job event object.
- node_names – List of nodes where the job will be allocated.
Returns: Tuple: First element True if the event was allocated, False otherwise. Second element a message.
-
get_total_resources(*args)[source]¶ Return the total system resource for the required argument. The resource have to exist in the system. If no arguments is proportioned all resources are returned.
Parameters: *args – Depends on the system configuration. But at least it must have (‘core’, ‘mem’) resources. Returns: Dictionary of the resources and its values.
-
groups_available_resource(_key=None)[source]¶ Parameters: _key – None for values of all types for all groups. Giving a specific key will return the resource for the specific type Returns: Dictionary of {group{type: value}}
-
remove_event(id)[source]¶ Method for job release. It release the allocated resources on the specific nodes.
Parameters: id – Job Id
-
-
class
accasim.base.resource_manager_class.Resources(groups, resources, **kwargs)[source]¶ Bases:
objectresources class: Stablish the resources, allocate and release their use.
-
OFF= 0¶
-
ON= 1¶
-
allocate(node_name, **kwargs)[source]¶ Method for job allocation. It receives the node name and the resources to be used.
Parameters: - node_name – Name of the node to be updated.
- **kwargs – Dictionary of the system resources and its values to be used.
-
availability()[source]¶ System availablity calculation
Returns: Return a dictionary with the system availability. In terms of {node: {resource: value}}
-
available_resource_key(_key)[source]¶ Generate the resource key names
Parameters: _key – Name of the resource Returns: Return the Resource key name.
-
define_group(_groups, name, group)[source]¶ Internal method for defining groups of resources.
Parameters: - name – Name of the group
- group – Values of the group. As defined in the system config.
-
release(node_name, **kwargs)[source]¶ Method for allocation release. It receives the node name and the resources to be released.
Parameters: - node_name – Name of the node to be updated.
- **kwargs – Dictionary of the system resources and its values to be released.
-
resource_manager()[source]¶ Instantiation of the resource manager object
Returns: Resource manager object.
-
system_capacity(type='total')[source]¶ Parameters: type – ‘total’ to return the total per resource type ‘nodes’ to return the capacity of nodes Returns: Return system capacity
-