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 br...@apache.org on 2021/02/18 15:00:24 UTC
[hadoop] 01/02: YARN-9301. Too many InvalidStateTransitionException
with SLS. Contributed by Bilwa S T.
This is an automated email from the ASF dual-hosted git repository.
brahma pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 5be3a1dc7b58449ea8472bc3423ffac347da7f59
Author: Inigo Goiri <in...@apache.org>
AuthorDate: Tue May 12 08:20:03 2020 -0700
YARN-9301. Too many InvalidStateTransitionException with SLS. Contributed by Bilwa S T.
(cherry picked from commit 9cbd0cd2a9268ff2e8fed0af335e9c4f91c5f601)
---
.../yarn/sls/resourcemanager/MockAMLauncher.java | 61 ++++++++++++----------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/resourcemanager/MockAMLauncher.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/resourcemanager/MockAMLauncher.java
index 208629a..24c795b 100644
--- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/resourcemanager/MockAMLauncher.java
+++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/resourcemanager/MockAMLauncher.java
@@ -82,36 +82,39 @@ public class MockAMLauncher extends ApplicationMasterLauncher
@Override
@SuppressWarnings("unchecked")
public void handle(AMLauncherEvent event) {
- if (AMLauncherEventType.LAUNCH == event.getType()) {
- ApplicationId appId =
- event.getAppAttempt().getAppAttemptId().getApplicationId();
-
- // find AMSimulator
- AMSimulator ams = appIdAMSim.get(appId);
- if (ams != null) {
- try {
- Container amContainer = event.getAppAttempt().getMasterContainer();
-
- setupAMRMToken(event.getAppAttempt());
-
- // Notify RMAppAttempt to change state
- super.context.getDispatcher().getEventHandler().handle(
- new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(),
- RMAppAttemptEventType.LAUNCHED));
-
- ams.notifyAMContainerLaunched(
- event.getAppAttempt().getMasterContainer());
- LOG.info("Notify AM launcher launched:" + amContainer.getId());
-
- se.getNmMap().get(amContainer.getNodeId())
- .addNewContainer(amContainer, 100000000L);
-
- return;
- } catch (Exception e) {
- throw new YarnRuntimeException(e);
- }
+ ApplicationId appId =
+ event.getAppAttempt().getAppAttemptId().getApplicationId();
+ // find AMSimulator
+ AMSimulator ams = appIdAMSim.get(appId);
+ if (ams == null) {
+ throw new YarnRuntimeException(
+ "Didn't find any AMSimulator for applicationId=" + appId);
+ }
+ Container amContainer = event.getAppAttempt().getMasterContainer();
+ switch (event.getType()) {
+ case LAUNCH:
+ try {
+ setupAMRMToken(event.getAppAttempt());
+ // Notify RMAppAttempt to change state
+ super.context.getDispatcher().getEventHandler().handle(
+ new RMAppAttemptEvent(event.getAppAttempt().getAppAttemptId(),
+ RMAppAttemptEventType.LAUNCHED));
+
+ ams.notifyAMContainerLaunched(
+ event.getAppAttempt().getMasterContainer());
+ LOG.info("Notify AM launcher launched:" + amContainer.getId());
+
+ se.getNmMap().get(amContainer.getNodeId())
+ .addNewContainer(amContainer, -1);
+ return;
+ } catch (Exception e) {
+ throw new YarnRuntimeException(e);
}
-
+ case CLEANUP:
+ se.getNmMap().get(amContainer.getNodeId())
+ .cleanupContainer(amContainer.getId());
+ break;
+ default:
throw new YarnRuntimeException(
"Didn't find any AMSimulator for applicationId=" + appId);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org