public abstract class AbstractYarnClient extends java.lang.Object implements YarnClient, org.springframework.beans.factory.InitializingBean
YarnClient
.Constructor and Description |
---|
AbstractYarnClient(ClientRmOperations clientRmOperations)
Constructs client with a given template.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
org.apache.hadoop.yarn.api.records.ApplicationReport |
getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Gets a report of the application.
|
ClientRmOperations |
getClientRmOperations()
Gets the client rm operations.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the
Configuration of this client. |
java.util.Map<java.lang.String,java.lang.String> |
getEnvironment()
Gets the environment variables.
|
protected org.apache.hadoop.yarn.api.records.ContainerLaunchContext |
getMasterContainerLaunchContext()
Gets the master container launch context.
|
protected org.apache.hadoop.fs.Path |
getStagingPath()
Gets the staging path.
|
protected org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext |
getSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Gets the submission context for application master.
|
void |
installApplication()
Installs the application known to
YarnClient instance into hdfs. |
void |
killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Requests a resource manager to kill the application.
|
java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
listApplications()
Gets a list of known applications.
|
java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
listApplications(java.lang.String type)
Gets a list of known applications filtered by an application type.
|
java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
listRunningApplications(java.lang.String type)
Gets a list of running applications filtered by an application type.
|
void |
setApplicationDirName(java.lang.String applicationDirName)
Sets the application dir name.
|
void |
setAppName(java.lang.String appName)
Sets the name for submitted application.
|
void |
setAppType(java.lang.String appType)
Sets the type for submitted application.
|
void |
setClientRmOperations(ClientRmOperations clientRmOperations)
Sets the
ClientRmOperations implementation for
accessing resource manager. |
void |
setCommands(java.util.List<java.lang.String> commands)
Sets the commands starting appmaster.
|
void |
setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Yarn configuration.
|
void |
setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Sets the environment for appmaster.
|
void |
setLabelExpression(java.lang.String labelExpression)
Sets the application label expression.
|
void |
setMemory(int memory)
Sets the memory.
|
void |
setPriority(int priority)
Sets the priority.
|
void |
setQueue(java.lang.String queue)
Sets the queue.
|
void |
setResourceLocalizer(ResourceLocalizer resourceLocalizer)
Sets the resource localizer for appmaster container.
|
void |
setStagingDirPath(java.lang.String stagingDirPath)
Sets the staging dir path.
|
void |
setVirtualcores(int virtualcores)
Sets the virtualcores.
|
org.apache.hadoop.yarn.api.records.ApplicationId |
submitApplication()
Submits the application known to
YarnClient instance. |
org.apache.hadoop.yarn.api.records.ApplicationId |
submitApplication(boolean distribute)
Submits the application known to
YarnClient instance. |
public AbstractYarnClient(ClientRmOperations clientRmOperations)
clientRmOperations
- the client to resource manager templatepublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public org.apache.hadoop.yarn.api.records.ApplicationId submitApplication()
YarnClient
YarnClient
instance.submitApplication
in interface YarnClient
ApplicationId
for submitted applicationpublic org.apache.hadoop.yarn.api.records.ApplicationId submitApplication(boolean distribute)
YarnClient
YarnClient
instance.submitApplication
in interface YarnClient
distribute
- if set to true files will also be copiedApplicationId
for submitted applicationpublic void installApplication()
YarnClient
YarnClient
instance into hdfs.installApplication
in interface YarnClient
public void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
YarnClient
killApplication
in interface YarnClient
applicationId
- the ApplicationId
public java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications()
YarnClient
listApplications
in interface YarnClient
ApplicationReport
spublic java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications(java.lang.String type)
YarnClient
listApplications
in interface YarnClient
type
- the yarn application typeApplicationReport
spublic java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listRunningApplications(java.lang.String type)
YarnClient
listRunningApplications
in interface YarnClient
type
- the yarn application typeApplicationReport
spublic org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
YarnClient
getApplicationReport
in interface YarnClient
applicationId
- the application idApplicationReport
public void setClientRmOperations(ClientRmOperations clientRmOperations)
ClientRmOperations
implementation for
accessing resource manager.clientRmOperations
- The client to resource manager implementationpublic ClientRmOperations getClientRmOperations()
public java.util.Map<java.lang.String,java.lang.String> getEnvironment()
public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
environment
- the environmentpublic void setCommands(java.util.List<java.lang.String> commands)
commands
- the commands starting appmasterpublic org.apache.hadoop.conf.Configuration getConfiguration()
Configuration
of this client. Internally
this method is called to get the configuration which
allows sub-classes to override and add additional settings.Configuration
public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
configuration
- the Yarn configurationpublic void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
resourceLocalizer
- the new resource localizerpublic void setAppName(java.lang.String appName)
appName
- the new application namepublic void setAppType(java.lang.String appType)
appType
- the new application typepublic void setPriority(int priority)
priority
- the new prioritypublic void setVirtualcores(int virtualcores)
virtualcores
- the new virtualcorespublic void setMemory(int memory)
memory
- the new memorypublic void setQueue(java.lang.String queue)
queue
- the new queuepublic void setLabelExpression(java.lang.String labelExpression)
labelExpression
- the new application label expressionpublic void setStagingDirPath(java.lang.String stagingDirPath)
stagingDirPath
- the new staging dir pathpublic void setApplicationDirName(java.lang.String applicationDirName)
applicationDirName
- the new application dir nameprotected org.apache.hadoop.fs.Path getStagingPath()
protected org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
applicationId
- application idprotected org.apache.hadoop.yarn.api.records.ContainerLaunchContext getMasterContainerLaunchContext()