public class ResourceUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MAXIMUM_ALLOCATION |
static String |
MINIMUM_ALLOCATION |
static String |
TYPE |
static String |
UNITS |
Modifier and Type | Method and Description |
---|---|
static Resource |
fetchMaximumAllocationFromConfig(org.apache.hadoop.conf.Configuration conf)
Get maximum allocation from config, *THIS WILL NOT UPDATE INTERNAL DATA*
|
static String |
getDefaultUnit(String resourceType)
Get default unit by given resource type.
|
static Map<String,ResourceInformation> |
getNodeResourceInformation(org.apache.hadoop.conf.Configuration conf)
Function to get the resources for a node.
|
static int |
getNumberOfKnownResourceTypes() |
static List<ResourceInformation> |
getRequestedResourcesFromConfig(org.apache.hadoop.conf.Configuration configuration,
String prefix)
From a given configuration get all entries representing requested
resources: entries that match the {prefix}{resourceName}={value}[{units}]
pattern.
|
static List<ResourceTypeInfo> |
getResourcesTypeInfo()
Get all resource types information from known resource types.
|
static Map<String,Integer> |
getResourceTypeIndex()
Get associate index of resource types such memory, cpu etc.
|
static Map<String,ResourceInformation> |
getResourceTypes()
Get the resource types to be supported by the system.
|
static ResourceInformation[] |
getResourceTypesArray() |
static Resource |
getResourceTypesMaximumAllocation()
Get a Resource object with for the maximum allocation possible.
|
static Resource |
getResourceTypesMinimumAllocation() |
static String |
getUnits(String resourceValue) |
static void |
initializeResourcesFromResourceInformationMap(Map<String,ResourceInformation> resourceInformationMap)
This method is visible for testing, unit test can construct a
resourceInformationMap and pass it to this method to initialize multiple resources.
|
static void |
resetNodeResources() |
static Map<String,ResourceInformation> |
resetResourceTypes(org.apache.hadoop.conf.Configuration conf) |
public static final String UNITS
public static final String TYPE
public static final String MINIMUM_ALLOCATION
public static final String MAXIMUM_ALLOCATION
public static Resource fetchMaximumAllocationFromConfig(org.apache.hadoop.conf.Configuration conf)
conf
- configpublic static void initializeResourcesFromResourceInformationMap(Map<String,ResourceInformation> resourceInformationMap)
resourceInformationMap
- constructed resource information map.public static Map<String,Integer> getResourceTypeIndex()
public static Map<String,ResourceInformation> getResourceTypes()
public static ResourceInformation[] getResourceTypesArray()
public static int getNumberOfKnownResourceTypes()
public static Map<String,ResourceInformation> resetResourceTypes(org.apache.hadoop.conf.Configuration conf)
public static Map<String,ResourceInformation> getNodeResourceInformation(org.apache.hadoop.conf.Configuration conf)
YarnConfiguration.NODE_RESOURCES_CONFIGURATION_FILE
to
determine the node resources.conf
- configuration filepublic static void resetNodeResources()
public static Resource getResourceTypesMinimumAllocation()
public static Resource getResourceTypesMaximumAllocation()
public static String getDefaultUnit(String resourceType)
resourceType
- resourceTypepublic static List<ResourceTypeInfo> getResourcesTypeInfo()
public static List<ResourceInformation> getRequestedResourcesFromConfig(org.apache.hadoop.conf.Configuration configuration, String prefix)
configuration
- The configurationprefix
- Keys with this prefix are considered from the configurationCopyright © 2019 Apache Software Foundation. All Rights Reserved.