You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by pr...@apache.org on 2020/02/20 15:04:43 UTC
[hadoop] branch trunk updated: YARN-10119. Option to reset AM
failure count for YARN Service
This is an automated email from the ASF dual-hosted git repository.
prabhujoseph pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 181e6d0 YARN-10119. Option to reset AM failure count for YARN Service
181e6d0 is described below
commit 181e6d033ea764012b5d52757bafcf19713fd20a
Author: Prabhu Joseph <pr...@apache.org>
AuthorDate: Thu Feb 20 20:33:59 2020 +0530
YARN-10119. Option to reset AM failure count for YARN Service
Contributed by kyungwan nam.
---
.../hadoop/yarn/service/client/ServiceClient.java | 4 ++
.../hadoop/yarn/service/conf/YarnServiceConf.java | 3 ++
.../yarn/service/TestYarnNativeServices.java | 43 ++++++++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
index 46bfa7a..b3ac7bb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
@@ -1000,6 +1000,10 @@ public class ServiceClient extends AppAdminClient implements SliderExitCodes,
submissionContext.setMaxAppAttempts(YarnServiceConf
.getInt(YarnServiceConf.AM_RESTART_MAX, DEFAULT_AM_RESTART_MAX, app
.getConfiguration(), conf));
+ submissionContext.setAttemptFailuresValidityInterval(YarnServiceConf
+ .getLong(YarnServiceConf.AM_FAILURES_VALIDITY_INTERVAL,
+ DEFAULT_AM_FAILURES_VALIDITY_INTERVAL, app.getConfiguration(),
+ conf));
setLogAggregationContext(app, conf, submissionContext);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
index 58fe70b..86c4de2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
@@ -44,6 +44,9 @@ public class YarnServiceConf {
public static final String AM_RESTART_MAX = "yarn.service.am-restart.max-attempts";
public static final int DEFAULT_AM_RESTART_MAX = 20;
+ public static final String AM_FAILURES_VALIDITY_INTERVAL =
+ "yarn.service.am-failure.validity-interval-ms";
+ public static final long DEFAULT_AM_FAILURES_VALIDITY_INTERVAL = -1;
public static final String AM_RESOURCE_MEM = "yarn.service.am-resource.memory";
public static final long DEFAULT_KEY_AM_RESOURCE_MEM = 1024;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
index b33972e..4ede8cf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
@@ -938,4 +938,47 @@ public class TestYarnNativeServices extends ServiceTestUtils {
Assert.assertEquals("Restarted service state should be STABLE",
ServiceState.STABLE, service.getState());
}
+
+ @Test(timeout = 200000)
+ public void testAMFailureValidity() throws Exception {
+ setupInternal(NUM_NMS);
+ ServiceClient client = createClient(getConf());
+ Service exampleApp = new Service();
+ exampleApp.setName("example-app");
+ exampleApp.setVersion("v1");
+ exampleApp.addComponent(createComponent("compa", 2, "sleep 1000"));
+ Configuration serviceConfig = new Configuration();
+ serviceConfig.setProperty(AM_RESTART_MAX, "2");
+ serviceConfig.setProperty(AM_FAILURES_VALIDITY_INTERVAL, "1000");
+ exampleApp.setConfiguration(serviceConfig);
+ client.actionCreate(exampleApp);
+ waitForServiceToBeStable(client, exampleApp);
+
+ Service appStatus1 = client.getStatus(exampleApp.getName());
+ ApplicationId exampleAppId = ApplicationId.fromString(appStatus1.getId());
+ YarnClient yarnClient = createYarnClient(getConf());
+
+ // kill AM1
+ ApplicationReport applicationReport = yarnClient.getApplicationReport(
+ exampleAppId);
+ ApplicationAttemptReport attemptReport = yarnClient
+ .getApplicationAttemptReport(applicationReport
+ .getCurrentApplicationAttemptId());
+ yarnClient.signalToContainer(attemptReport.getAMContainerId(),
+ SignalContainerCommand.GRACEFUL_SHUTDOWN);
+ waitForServiceToBeStable(client, exampleApp);
+ Assert.assertEquals(ServiceState.STABLE, client.getStatus(
+ exampleApp.getName()).getState());
+
+ // kill AM2 after 'yarn.service.am-failure.validity-interval-ms'
+ Thread.sleep(2000);
+ applicationReport = yarnClient.getApplicationReport(exampleAppId);
+ attemptReport = yarnClient.getApplicationAttemptReport(applicationReport
+ .getCurrentApplicationAttemptId());
+ yarnClient.signalToContainer(attemptReport.getAMContainerId(),
+ SignalContainerCommand.GRACEFUL_SHUTDOWN);
+ waitForServiceToBeStable(client, exampleApp);
+ Assert.assertEquals(ServiceState.STABLE, client.getStatus(
+ exampleApp.getName()).getState());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org