resources¶
Methods to work with FABRIC resources.
- class fabrictestbed_extensions.fablib.resources.Resources(fablib_manager, force_refresh: bool = False)¶
- Parameters:
fablib_manager (fablib.FablibManager) – a
FablibManager
instance.force_refresh (bool) – force a refresh of available testbed resources.
- __str__() str ¶
Creates a tabulated string of all the available resources.
Intended for printing available resources.
- Returns:
Tabulated string of available resources
- Return type:
String
- get_component_allocated(site: str, component_model_name: str) int ¶
Gets gets number of currently allocated components on a the site by the component by model name.
- Parameters:
site (String or Node or NodeSliver) – site object or site name
component_model_name (String) – component model name
- Returns:
currently allocated component of this model
- Return type:
int
- get_component_available(site: str, component_model_name: str) int ¶
Gets gets number of currently available components on the site by the component by model name.
- Parameters:
site (String or Node or NodeSliver) – site object or site name
component_model_name (String) – component model name
- Returns:
currently available component of this model
- Return type:
int
- get_component_capacity(site: str, component_model_name: str) int ¶
Gets the total site capacity of a component by model name.
- Parameters:
site (String or Node or NodeSliver) – site object or sliver or site name
component_model_name (String) – component model name
- Returns:
total component capacity
- Return type:
int
- get_core_allocated(site: str) int ¶
Gets the number of currently allocated cores at the site
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
core count
- Return type:
int
- get_core_available(site: str) int ¶
Gets the number of currently available cores at the site
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
core count
- Return type:
int
- get_core_capacity(site: str) int ¶
Gets the total number of cores at the site
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
core count
- Return type:
int
- get_cpu_capacity(site: str) int ¶
Gets the total number of cpus at the site
- Parameters:
site (String or node.Node or NodeSliver) – site name or site object
- Returns:
cpu count
- Return type:
int
- get_disk_allocated(site: str) int ¶
Gets the amount of disk allocated the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
disk in GB
- Return type:
int
- get_disk_available(site: str) int ¶
Gets the amount of disk available the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
disk in GB
- Return type:
int
- get_disk_capacity(site: str) int ¶
Gets the total amount of disk available the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
disk in GB
- Return type:
int
- get_host_capacity(site: str) int ¶
Gets the number of worker hosts at the site
- Parameters:
site (String or Node or NodeSliver) – site name or site object
- Returns:
host count
- Return type:
int
- get_link_list(update: bool = False) List[str] ¶
Gets a list of all links by name
- Parameters:
update (bool) – (optional) set to True update available resources
- Returns:
list of link names
- Return type:
List[String]
- get_location_lat_long(site: str) Tuple[float, float] ¶
Gets gets location of a site in latitude and longitude
- Parameters:
site (String or Node or NodeSliver) – site name or site object
- Returns:
latitude and longitude of the site
- Return type:
Tuple(float,float)
- get_location_postal(site: str) str ¶
Gets the location of a site by postal address
- Parameters:
site (String or Node or NodeSliver) – site name or site object
- Returns:
postal address of the site
- Return type:
String
- get_ptp_capable(site: str) bool ¶
Gets the PTP flag of the site - if it has a native PTP capability :param site: site name or object :type site: String or Node or NodeSliver :return: boolean flag :rtype: bool
- get_ram_allocated(site: str) int ¶
Gets the amount of memory currently allocated the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
ram in GB
- Return type:
int
- get_ram_available(site: str) int ¶
Gets the amount of memory currently available the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
ram in GB
- Return type:
int
- get_ram_capacity(site: str) int ¶
Gets the total amount of memory at the site in GB
- Parameters:
site (String or Node or NodeSliver) – site name or object
- Returns:
ram in GB
- Return type:
int
- get_site_list(update: bool = False) List[str] ¶
Gets a list of all sites by name
- Parameters:
update (bool) – (optional) set to True update available resources
- Returns:
list of site names
- Return type:
List[String]
- get_site_names() List[str] ¶
Gets a list of all currently available site names
- Returns:
list of site names
- Return type:
List[String]
- get_state(site: str) str ¶
Gets the maintenance state of the node
- Parameters:
site (String or Node or NodeSliver) – site Node or NodeSliver object or name
- Returns:
str(MaintenanceState)
- get_topology(update: bool = False) AdvertizedTopology ¶
Not intended for API use
- get_topology_site(site_name: str) Node ¶
Not recommended for most users.
- show_site(site_name: str, output: str | None = None, fields: list[str] | None = None, quiet: bool = False, pretty_names=True, latlon=True) str ¶
Creates a tabulated string of all the available resources at a specific site.
Intended for printing available resources at a site.
- Parameters:
site_name (String) – site name
- Returns:
Tabulated string of available resources
- Return type:
String
- site_to_dict(site: str, latlon=True)¶
Convert site information into a dictionary
- Parameters:
site – site name or site object
latlon – convert address to latlon (makes online call to openstreetmaps.org)
- update(force_refresh: bool = False)¶
Update the available resources by querying the FABRIC services