Example usage for org.apache.hadoop.yarn.api.records ApplicationSubmissionContext getAttemptFailuresValidityInterval

List of usage examples for org.apache.hadoop.yarn.api.records ApplicationSubmissionContext getAttemptFailuresValidityInterval

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records ApplicationSubmissionContext getAttemptFailuresValidityInterval.

Prototype

@Public
@Stable
public abstract long getAttemptFailuresValidityInterval();

Source Link

Document

Get the attemptFailuresValidityInterval in milliseconds for the application

Usage

From source file:org.apache.slider.core.launch.TestAppMasterLauncherWithAmReset.java

License:Apache License

@Test
public void testExtractYarnResourceManagerAmRetryCountWindowMs() throws Exception {
    Map<String, String> options = new HashMap<String, String>();
    final String expectedInterval = Integer.toString(120000);
    options.put(ResourceKeys.YARN_RESOURCEMANAGER_AM_RETRY_COUNT_WINDOW_MS, expectedInterval);
    EasyMock.replay(mockYarnClient, yarnClientApp);

    appMasterLauncher = new AppMasterLauncher("am1", SliderKeys.APP_TYPE, null, null, mockYarnClient, false,
            null, options, tags, null);//from w  w  w .  j av  a 2s. c o m

    ApplicationSubmissionContext ctx = appMasterLauncher.application.getApplicationSubmissionContext();
    String retryIntervalWindow = Long.toString(ctx.getAttemptFailuresValidityInterval());
    Assert.assertEquals(expectedInterval, retryIntervalWindow);
}

From source file:org.apache.slider.core.launch.TestAppMasterLauncherWithAmReset.java

License:Apache License

@Test
public void testExtractYarnResourceManagerAmRetryCountWindowMsDefaultValue() throws Exception {
    Map<String, String> options = new HashMap<String, String>();
    EasyMock.replay(mockYarnClient, yarnClientApp);

    appMasterLauncher = new AppMasterLauncher("am1", SliderKeys.APP_TYPE, null, null, mockYarnClient, false,
            null, options, tags, null);// w ww.  j a  v a 2s.c o  m

    ApplicationSubmissionContext ctx = appMasterLauncher.application.getApplicationSubmissionContext();
    long retryIntervalWindow = ctx.getAttemptFailuresValidityInterval();
    Assert.assertEquals(ResourceKeys.DEFAULT_AM_RETRY_COUNT_WINDOW_MS, retryIntervalWindow);
}