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

abstractdog 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 214c544  TEZ-4143: Provide an option to disable DAG graph (.dot) 
generation for latency sensitive jobs (László Bodor reviewed by Rajesh 
Balamohan)
214c544 is described below

commit 214c544472f80997755b62c382f016fbe8373177
Author: László Bodor <[email protected]>
AuthorDate: Wed Apr 15 08:18:34 2020 +0200

    TEZ-4143: Provide an option to disable DAG graph (.dot) generation for 
latency sensitive jobs (László Bodor reviewed by Rajesh Balamohan)
    
    Signed-off-by: Laszlo Bodor <[email protected]>
---
 .../java/org/apache/tez/dag/app/DAGAppMaster.java  | 36 ++++++++++++----------
 .../org/apache/tez/dag/app/dag/impl/DAGImpl.java   |  5 ++-
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java 
b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index 18cffad..7e5a7a9 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -1038,28 +1038,32 @@ public class DAGAppMaster extends AbstractService {
       LOG.warn("Failed to generate json for DAG", e);
     }
 
-    Utils.generateDAGVizFile(newDag, dagPB, logDirs, newDag.getDAGScheduler());
-    writePBTextFile(newDag);
+    writeDebugArtifacts(dagPB, newDag);
     return newDag;
   } // end createDag()
 
+  private void writeDebugArtifacts(DAGPlan dagPB, DAGImpl newDag) {
+    boolean debugArtifacts =
+        
newDag.getConf().getBoolean(TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS,
+            TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS_DEFAULT);
+    if (debugArtifacts) {
+      Utils.generateDAGVizFile(newDag, dagPB, logDirs, 
newDag.getDAGScheduler());
+      writePBTextFile(newDag);
+    }
+  }
 
   private void writePBTextFile(DAG dag) {
-    if (dag.getConf().getBoolean(TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS,
-        TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS_DEFAULT)) {
+    String logFile = logDirs[new Random().nextInt(logDirs.length)] + 
File.separatorChar
+        + dag.getID().toString() + "-" + TezConstants.TEZ_PB_PLAN_TEXT_NAME;
 
-      String logFile = logDirs[new Random().nextInt(logDirs.length)] + 
File.separatorChar +
-          dag.getID().toString()  + "-" + TezConstants.TEZ_PB_PLAN_TEXT_NAME;
-
-      LOG.info("Writing DAG plan to: " + logFile);
-      File outFile = new File(logFile);
-      try {
-        PrintWriter printWriter = new PrintWriter(outFile, "UTF-8");
-        
printWriter.println(TezUtilsInternal.convertDagPlanToString(dag.getJobPlan()));
-        printWriter.close();
-      } catch (IOException e) {
-        LOG.warn("Failed to write TEZ_PLAN to " + outFile.toString(), e);
-      }
+    LOG.info("Writing DAG plan to: " + logFile);
+    File outFile = new File(logFile);
+    try {
+      PrintWriter printWriter = new PrintWriter(outFile, "UTF-8");
+      
printWriter.println(TezUtilsInternal.convertDagPlanToString(dag.getJobPlan()));
+      printWriter.close();
+    } catch (IOException e) {
+      LOG.warn("Failed to write TEZ_PLAN to " + outFile.toString(), e);
     }
   }
 
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java 
b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
index b8bdcc9..b20a4f6 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
@@ -1648,7 +1648,10 @@ public class DAGImpl implements 
org.apache.tez.dag.app.dag.DAG,
 
     // This is going to override the previously generated file
     // which didn't have the priorities
-    Utils.generateDAGVizFile(this, jobPlan, dagScheduler);
+    if (getConf().getBoolean(TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS,
+        TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS_DEFAULT)) {
+      Utils.generateDAGVizFile(this, jobPlan, dagScheduler);
+    }
     return DAGState.INITED;
   }
 

Reply via email to