mynameborat commented on a change in pull request #1422:
URL: https://github.com/apache/samza/pull/1422#discussion_r480367391
##########
File path:
samza-yarn/src/main/scala/org/apache/samza/job/yarn/SamzaYarnAppMasterLifecycle.scala
##########
@@ -68,8 +71,17 @@ class SamzaYarnAppMasterLifecycle(containerMem: Int,
containerCpu: Int, samzaApp
//allowing the RM to restart it (potentially on a different host)
if(samzaAppStatus != SamzaAppStatus.UNDEFINED) {
info("Unregistering AM from the RM.")
- amClient.unregisterApplicationMaster(yarnStatus, shutdownMessage, null)
- info("Unregister complete.")
+ try {
+ amClient.unregisterApplicationMaster(yarnStatus, shutdownMessage, null)
+ info("Unregister complete.")
+ } catch {
+ case ex: InvalidApplicationMasterRequestException =>
+ // Once the AM dies, the corresponding app attempt ID is removed
from the RM cache so that the RM can spin up a new AM and its containers.
Review comment:
AM isn't dead yet right? Shouldn't this be `once the NM dies` Which
brings up another interesting question. Have you validated the behavior when
`yarn.nodemanager.recovery.enabled` is set to `true` vs `false`?
##########
File path:
samza-yarn/src/test/java/org/apache/samza/job/yarn/TestYarnClusterResourceManager.java
##########
@@ -19,28 +19,36 @@
package org.apache.samza.job.yarn;
+import java.io.IOException;
import java.time.Duration;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import
org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
+import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.samza.clustermanager.ClusterResourceManager;
+import org.apache.samza.clustermanager.SamzaApplicationState;
import org.apache.samza.clustermanager.SamzaResource;
import org.apache.samza.config.Config;
import org.junit.Assert;
import org.junit.Test;
+import org.mockito.Mockito;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyObject;
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.any;
import static org.mockito.Mockito.*;
Review comment:
nit: avoid `*` imports and import explicitly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]