Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class TezConstants {
public static final String TEZ_PB_BINARY_CONF_NAME = "tez-conf.pb";
public static final String TEZ_PB_PLAN_BINARY_NAME = "tez-dag.pb";
public static final String TEZ_PB_PLAN_TEXT_NAME = "tez-dag.pb.txt";
public static final String TEZ_PB_PLAN_JSON_NAME = "tez-dag.pb.json";

/*
* Logger properties
Expand Down
16 changes: 16 additions & 0 deletions tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ private void writeDebugArtifacts(DAGPlan dagPB, DAGImpl newDag) {
if (debugArtifacts) {
Utils.generateDAGVizFile(newDag, dagPB, logDirs, newDag.getDAGScheduler());
writePBTextFile(newDag);
writePBJsonFile(dagPB, newDag);
}
}

Expand All @@ -1056,6 +1057,21 @@ private void writePBTextFile(DAG dag) {
}
}

private void writePBJsonFile(DAGPlan dagPB, DAGImpl newDag) {
String logFile = logDirs[new Random().nextInt(logDirs.length)] + File.separatorChar + newDag.getID() + "-"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think other files like TEZ_PB_PLAN_TEXT_NAME are in tezSysStagingPath, should we keep these files also there?

public static Path getTezTextPlanStagingPath(Path tezSysStagingPath, String strAppId,
String dagPBName) {
String fileName = strAppId + "-" + dagPBName + "-" + TezConstants.TEZ_PB_PLAN_TEXT_NAME;
return new Path(tezSysStagingPath, fileName);

+ TezConstants.TEZ_PB_PLAN_JSON_NAME;

LOG.info("Writing DAG JSON plan to: " + logFile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use placeholders

    LOG.info("Writing DAG JSON plan to: {}", logFile);

File outFile = new File(logFile);
try {
PrintWriter printWriter = new PrintWriter(outFile, "UTF-8");
printWriter.println(DAGUtils.generateSimpleJSONPlan(dagPB));
printWriter.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this close should be in finally block or we should use try-with-resource for printWriter, else if printWriter.println(DAGUtils.generateSimpleJSONPlan(dagPB)); this throws exception, we won't be closing the printWritter

} catch (IOException | JSONException e) {
LOG.warn("Failed to write TEZ_PLAN JSON to " + outFile, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should change to:

 LOG.warn("Failed to write TEZ_PLAN JSON to {}", outFile, e);

}
}

protected void addIfService(Object object, boolean addDispatcher) {
if (object instanceof Service) {
Service service = (Service) object;
Expand Down