public abstract class AbstractYarnClusterTests
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
protected org.apache.hadoop.conf.Configuration |
configuration |
protected YarnClient |
yarnClient |
protected YarnCluster |
yarnCluster |
Constructor and Description |
---|
AbstractYarnClusterTests() |
Modifier and Type | Method and Description |
---|---|
org.springframework.context.ApplicationContext |
getApplicationContext()
Gets the
ApplicationContext for tests. |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Gets the running cluster runtime
Configuration for tests. |
protected org.apache.hadoop.yarn.api.records.YarnApplicationState |
getState(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Get the current application state.
|
YarnClient |
getYarnClient()
Gets the
YarnClient . |
YarnCluster |
getYarnCluster()
Gets the running
YarnCluster for tests. |
protected void |
killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Kill the application.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the
Configuration . |
void |
setYarnClient(YarnClient yarnClient)
Sets the
YarnClient . |
void |
setYarnCluster(YarnCluster yarnCluster)
Sets the
YarnCluster |
protected org.apache.hadoop.yarn.api.records.ApplicationId |
submitApplication()
Submit an application.
|
protected ApplicationInfo |
submitApplicationAndWait()
Submits application and wait state.
|
protected ApplicationInfo |
submitApplicationAndWait(long timeout,
java.util.concurrent.TimeUnit unit)
Submits application and wait state.
|
protected ApplicationInfo |
submitApplicationAndWaitState(long timeout,
java.util.concurrent.TimeUnit unit,
org.apache.hadoop.yarn.api.records.YarnApplicationState... applicationStates)
Submits application and wait state.
|
protected org.apache.hadoop.yarn.api.records.YarnApplicationState |
waitState(org.apache.hadoop.yarn.api.records.ApplicationId applicationId,
long timeout,
java.util.concurrent.TimeUnit unit,
org.apache.hadoop.yarn.api.records.YarnApplicationState... applicationStates)
Waits state.
|
protected org.springframework.context.ApplicationContext applicationContext
protected org.apache.hadoop.conf.Configuration configuration
protected YarnCluster yarnCluster
protected YarnClient yarnClient
public org.springframework.context.ApplicationContext getApplicationContext()
ApplicationContext
for tests.public final void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public org.apache.hadoop.conf.Configuration getConfiguration()
Configuration
for tests.@Autowired public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Configuration
.configuration
- the Configurationpublic YarnCluster getYarnCluster()
YarnCluster
for tests.@Autowired public void setYarnCluster(YarnCluster yarnCluster)
YarnCluster
yarnCluster
- the Yarn clusterpublic YarnClient getYarnClient()
YarnClient
.@Autowired public void setYarnClient(YarnClient yarnClient)
YarnClient
.yarnClient
- the Yarn clientprotected ApplicationInfo submitApplicationAndWait() throws java.lang.Exception
java.lang.Exception
- if exception occurredApplicationInfo
,
submitApplicationAndWaitState(long, TimeUnit, YarnApplicationState...)
protected ApplicationInfo submitApplicationAndWait(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
timeout
- the timeout for waitunit
- the unit for timeoutjava.lang.Exception
- if exception occurredApplicationInfo
,
submitApplicationAndWaitState(long, TimeUnit, YarnApplicationState...)
protected ApplicationInfo submitApplicationAndWaitState(long timeout, java.util.concurrent.TimeUnit unit, org.apache.hadoop.yarn.api.records.YarnApplicationState... applicationStates) throws java.lang.Exception
NULL
if something failed or final known state after the wait/poll operations.
Array of application states can be used to return immediately from wait
loop if state is matched.timeout
- the timeout for waitunit
- the unit for timeoutapplicationStates
- the application states to waitjava.lang.Exception
- if exception occurredApplicationInfo
protected org.apache.hadoop.yarn.api.records.ApplicationId submitApplication()
ApplicationId
protected org.apache.hadoop.yarn.api.records.YarnApplicationState waitState(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, long timeout, java.util.concurrent.TimeUnit unit, org.apache.hadoop.yarn.api.records.YarnApplicationState... applicationStates) throws java.lang.Exception
NULL
if something failed or final known state after the wait/poll operations.
Array of application states can be used to return immediately from wait
loop if state is matched.applicationId
- the application idtimeout
- the timeout for waitunit
- the unit for timeoutapplicationStates
- the application states to waitNULL
if timeoutjava.lang.Exception
- if exception occurredprotected void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
applicationId
- the application idprotected org.apache.hadoop.yarn.api.records.YarnApplicationState getState(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
applicationId
- Yarn app application idNULL
if not found