This is an automated email from the ASF dual-hosted git repository.

ayushsaxena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a9211e4d TEZ-4559: Fix Retry logic in case of Recovery (#353). 
(Laszlo Bodor, reviewed by Ayush Saxena)
7a9211e4d is described below

commit 7a9211e4da789cddc00a70ce6933962d3c69c13d
Author: Bodor Laszlo <bodorlaszlo0...@gmail.com>
AuthorDate: Tue May 7 10:13:30 2024 +0200

    TEZ-4559: Fix Retry logic in case of Recovery (#353). (Laszlo Bodor, 
reviewed by Ayush Saxena)
---
 .../main/java/org/apache/tez/dag/api/client/DAGClientImpl.java | 10 ++++++++--
 .../java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java  |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGClientImpl.java 
b/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGClientImpl.java
index 727719ecc..2913d08c4 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGClientImpl.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/client/DAGClientImpl.java
@@ -410,8 +410,14 @@ public class DAGClientImpl extends DAGClient {
       LOG.info("DAG is no longer running - application not found by YARN", e);
       dagCompleted = true;
     } catch (NoCurrentDAGException e) {
-      LOG.info("Got NoCurrentDAGException from AM, returning a failed DAG", e);
-      return dagLost();
+      if (conf.getBoolean(TezConfiguration.DAG_RECOVERY_ENABLED,
+          TezConfiguration.DAG_RECOVERY_ENABLED_DEFAULT)) {
+        LOG.info("Got NoCurrentDAGException from AM, going on as recovery is 
enabled", e);
+      } else {
+        // if recovery is disabled, we're not expecting the DAG to be finished 
any time in the future
+        LOG.info("Got NoCurrentDAGException from AM, returning a failed DAG as 
recovery is disabled", e);
+        return dagLost();
+      }
     } catch (TezException e) {
       // can be either due to a n/w issue or due to AM completed.
       LOG.info("Cannot retrieve DAG Status due to TezException: {}", 
e.getMessage());
diff --git 
a/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java 
b/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
index 662de982f..8d52aaf3b 100644
--- a/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
+++ b/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
@@ -715,6 +715,7 @@ public class TestDAGClient {
   @Test
   public void testDagClientReturnsFailedDAGOnNoCurrentDAGException() throws 
Exception {
     TezConfiguration tezConf = new TezConfiguration();
+    tezConf.setBoolean(TezConfiguration.DAG_RECOVERY_ENABLED, false);
 
     try (DAGClientImplForTest dagClientImpl = new 
DAGClientImplForTest(mockAppId, dagIdStr, tezConf, null)) {
 

Reply via email to