| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
ENV_PREFIX, GC_OPTS, JVM_HEAP, JVM_OPTS, ROLE_ACTUAL_INSTANCES, ROLE_ADDITIONAL_ARGS, ROLE_FAILED_INSTANCES, ROLE_FAILED_RECENTLY_INSTANCES, ROLE_FAILED_STARTING_INSTANCES, ROLE_NAME, ROLE_NODE_FAILED_INSTANCES, ROLE_PENDING_AA_INSTANCES, ROLE_PREEMPTED_INSTANCES, ROLE_RELEASING_INSTANCES, ROLE_REQUESTED_INSTANCES| Constructor and Description |
|---|
ProviderUtils(org.slf4j.Logger log)
Create an instace
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addAgentTar(Object provider,
String tarName,
SliderFileSystem sliderFileSystem,
org.apache.hadoop.fs.Path agentDir)
Add/overwrite the agent tarball (overwritten every time application is restarted)
|
static void |
addAllDependencyJars(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources,
SliderFileSystem sliderFileSystem,
org.apache.hadoop.fs.Path tempPath,
String libDir,
String libLocalSrcDir)
Loads all dependency jars from the default path
|
static void |
addDependencyJars(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources,
SliderFileSystem sliderFileSystem,
org.apache.hadoop.fs.Path tempPath,
String libdir,
String[] resources,
Class[] classes)
Add a set of dependencies to the provider resources being built up,
by copying them from the local classpath to the remote one, then
registering them
|
static boolean |
addProviderJar(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources,
Object provider,
String jarName,
SliderFileSystem sliderFileSystem,
org.apache.hadoop.fs.Path tempPath,
String libdir,
boolean miniClusterTestRun)
Add oneself to the classpath.
|
String |
buildPathToHomeDir(AggregateConf instanceDefinition,
String bindir,
String script)
Build the image dir.
|
String |
buildPathToHomeDir(String imagePath,
String applicationHome,
String bindir,
String script) |
String |
buildPathToScript(AggregateConf instance,
String bindir,
String script)
Build the image dir.
|
String |
buildPathToScript(ConfTreeOperations internal,
String bindir,
String script)
Build the image dir.
|
String |
buildScriptPath(String bindir,
String script,
String homedir) |
static String |
convertToAppRelativePath(File file) |
static String |
convertToAppRelativePath(String path) |
File |
findBinScriptInExpandedArchive(File base,
String bindir,
String script)
Find a script in an expanded archive
|
static String |
getAdditionalArgs(Map<String,String> roleOptions)
Return any additional arguments (argv) to provide when starting this role
|
String |
getLogdir()
build the log directory
|
int |
getRoleResourceRequirement(String val,
int defVal,
int maxVal) |
String |
getUserName()
get the user name
|
void |
propagateOption(MapOperations global,
String optionKey,
Map<String,String> sitexml,
String siteKey)
Propagate an option from the cluster specification option map
to the site XML map, using the site key for the name
|
void |
propagateSiteOptions(ClusterDescription clusterSpec,
Map<String,String> sitexml)
copy all options beginning site.
|
void |
propagateSiteOptions(Map<String,String> options,
Map<String,String> sitexml) |
void |
propagateSiteOptions(Map<String,String> options,
Map<String,String> sitexml,
String configName) |
void |
propagateSiteOptions(Map<String,String> options,
Map<String,String> sitexml,
String configName,
Map<String,String> tokenMap) |
void |
validateNodeCount(AggregateConf instanceDescription,
String name,
int min,
int max) |
void |
validateNodeCount(String name,
int count,
int min,
int max)
Validate the node count and heap size values of a node class
|
static void |
validatePathReferencesLocalDir(String meaning,
String path) |
public ProviderUtils(org.slf4j.Logger log)
log - log directory to use -usually the providerpublic static boolean addProviderJar(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources, Object provider, String jarName, SliderFileSystem sliderFileSystem, org.apache.hadoop.fs.Path tempPath, String libdir, boolean miniClusterTestRun) throws IOException, SliderException
providerResources - map of provider resources to add these entries toprovider - provider to addjarName - name of the jar to usesliderFileSystem - target filesystemtempPath - path in the cluster FS for temp fileslibdir - relative directory to place resourcesminiClusterTestRun - FileNotFoundException - if the JAR was not found and this is NOT
a mini cluster test runIOException - IO problemsSliderException - any Slider problempublic static boolean addAgentTar(Object provider, String tarName, SliderFileSystem sliderFileSystem, org.apache.hadoop.fs.Path agentDir) throws IOException
provider - tarName - sliderFileSystem - agentDir - IOExceptionpublic static void addDependencyJars(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources, SliderFileSystem sliderFileSystem, org.apache.hadoop.fs.Path tempPath, String libdir, String[] resources, Class[] classes) throws IOException, SliderException
providerResources - map of provider resources to add these entries tosliderFileSystem - target filesystemtempPath - path in the cluster FS for temp fileslibdir - relative directory to place resourcesresources - list of resource names (e.g. "hbase.jar"classes - list of classes where classes[i] refers to a class in
resources[i]IOException - IO problemsSliderException - any Slider problempublic static void addAllDependencyJars(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> providerResources, SliderFileSystem sliderFileSystem, org.apache.hadoop.fs.Path tempPath, String libDir, String libLocalSrcDir) throws IOException, SliderException
providerResources - map of provider resources to add these entries tosliderFileSystem - target filesystemtempPath - path in the cluster FS for temp fileslibDir - relative directory to place resourceslibLocalSrcDir - explicitly supplied local libs dirIOExceptionSliderExceptionpublic String getLogdir() throws IOException
IOExceptionpublic void validateNodeCount(AggregateConf instanceDescription, String name, int min, int max) throws BadCommandArgumentsException
BadCommandArgumentsExceptionpublic void validateNodeCount(String name, int count, int min, int max) throws BadCommandArgumentsException
If max <= 0: min <= count If max > 0: min <= count <= max
name - node class namecount - requested node countmin - requested heap sizemax - maximum value.BadCommandArgumentsException - if the values are out of rangepublic void propagateSiteOptions(ClusterDescription clusterSpec, Map<String,String> sitexml)
clusterSpec - cluster specificationsitexml - map for XML file to build uppublic void propagateSiteOptions(Map<String,String> options, Map<String,String> sitexml)
public void propagateSiteOptions(Map<String,String> options, Map<String,String> sitexml, String configName)
public void propagateSiteOptions(Map<String,String> options, Map<String,String> sitexml, String configName, Map<String,String> tokenMap)
public void propagateOption(MapOperations global, String optionKey, Map<String,String> sitexml, String siteKey) throws BadConfigException
global - global config specoptionKey - key in the option mapsitexml - map for XML file to build upsiteKey - key to assign the value to in the site XMLBadConfigException - if the option is missing from the cluster specpublic String buildPathToHomeDir(AggregateConf instanceDefinition, String bindir, String script) throws FileNotFoundException, BadConfigException
instanceDefinition - instance definitionbindir - bin subdirscript - script in bin subdirFileNotFoundException - if a file is not found, or it is not a directory*BadConfigExceptionpublic String buildPathToHomeDir(String imagePath, String applicationHome, String bindir, String script) throws FileNotFoundException
FileNotFoundExceptionpublic String buildPathToScript(AggregateConf instance, String bindir, String script) throws FileNotFoundException
instance - instance optionsbindir - bin subdirscript - script in bin subdirFileNotFoundException - if a file is not found, or it is not a directory*public String buildPathToScript(ConfTreeOperations internal, String bindir, String script) throws FileNotFoundException
internal - internal optionsbindir - bin subdirscript - script in bin subdirFileNotFoundException - if a file is not found, or it is not a directory*public static void validatePathReferencesLocalDir(String meaning, String path) throws BadConfigException
BadConfigExceptionpublic String getUserName() throws IOException
IOExceptionpublic File findBinScriptInExpandedArchive(File base, String bindir, String script) throws FileNotFoundException
base - base directorybindir - bin subdirscript - script in bin subdirFileNotFoundException - if a file is not found, or it is not a directorypublic static String getAdditionalArgs(Map<String,String> roleOptions)
roleOptions - The options for this rolepublic int getRoleResourceRequirement(String val, int defVal, int maxVal)
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.