Skip to content
Merged
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
12 changes: 12 additions & 0 deletions tez-dag/findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,16 @@
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
</Match>

<!-- TEZ-4281 -->
<Match>
<Class name="org.apache.tez.dag.app.dag.impl.DAGImpl"/>
<Method name="getLogDirs"/>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Class name="org.apache.tez.dag.app.dag.impl.DAGImpl"/>
<Method name="setLogDirs"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>

</FindBugsFilter>
18 changes: 3 additions & 15 deletions tez-dag/src/main/java/org/apache/tez/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

import javax.annotation.Nullable;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.event.Event;
import org.apache.tez.common.TezCommonUtils;
import org.apache.tez.dag.api.records.DAGProtos;
import org.apache.tez.dag.app.AppContext;
import org.apache.tez.dag.app.dag.DAG;
Expand Down Expand Up @@ -109,19 +107,6 @@ public static void processNonFatalServiceErrorReport(String entityString,
}
}

/**
* Generate a visualization file.
* @param dag DAG.
* @param dagPB DAG plan.
* @param scheduler scheduler that provide the priorities of the vertexes.
*/
public static void generateDAGVizFile(final DAG dag,
final DAGProtos.DAGPlan dagPB, @Nullable final DAGScheduler scheduler) {
generateDAGVizFile(dag, dagPB, TezCommonUtils.getTrimmedStrings(
System.getenv(ApplicationConstants.Environment.LOG_DIRS.name())),
scheduler);
}

/**
* Generate a visualization file.
* @param dag DAG.
Expand Down Expand Up @@ -217,6 +202,9 @@ public static void generateDAGVizFile(final DAG dag,
if (logDirs != null && logDirs.length != 0) {
outputFile += logDirs[0];
outputFile += File.separator;
} else {
LOG.warn("DAGVizFile will be created under current (.) directory: {},"
+ " which is not expected and recommended", new File(".").getAbsolutePath());
}
outputFile += dagId.toString();
// Means we have set the priorities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ DAGImpl createDAG(DAGPlan dagPB, TezDAGID dagId) {
new DAGImpl(dagId, amConf, dagPB, dispatcher.getEventHandler(),
taskCommunicatorManager, dagCredentials, clock,
appMasterUgi.getShortUserName(),
taskHeartbeatHandler, context);
taskHeartbeatHandler, context).setLogDirs(logDirs);

try {
if (LOG.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.state.InvalidStateTransitonException;
Expand All @@ -67,6 +68,7 @@
import org.apache.hadoop.yarn.util.Clock;
import org.apache.tez.common.ATSConstants;
import org.apache.tez.common.ReflectionUtils;
import org.apache.tez.common.TezCommonUtils;
import org.apache.tez.common.counters.AggregateTezCounters;
import org.apache.tez.common.counters.DAGCounter;
import org.apache.tez.common.counters.TezCounters;
Expand Down Expand Up @@ -225,6 +227,7 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
private TaskSpecificLaunchCmdOption taskSpecificLaunchCmdOption;

private static final DagStateChangedCallback STATE_CHANGED_CALLBACK = new DagStateChangedCallback();
private String[] logDirs;

@VisibleForTesting
Map<OutputKey, ListenableFuture<Void>> commitFutures
Expand Down Expand Up @@ -1662,7 +1665,7 @@ DAGState initializeDAG() {
// which didn't have the priorities
if (getConf().getBoolean(TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS,
TezConfiguration.TEZ_GENERATE_DEBUG_ARTIFACTS_DEFAULT)) {
Utils.generateDAGVizFile(this, jobPlan, dagScheduler);
Utils.generateDAGVizFile(this, jobPlan, logDirs, dagScheduler);
}
return DAGState.INITED;
}
Expand Down Expand Up @@ -2510,4 +2513,17 @@ public void onFailure(Throwable t) {
eventHandler.handle(new DAGEventCommitCompleted(dagId, outputKey, false, t));
}
}

public String[] getLogDirs() {
if (logDirs == null) {
logDirs = TezCommonUtils
.getTrimmedStrings(System.getenv(ApplicationConstants.Environment.LOG_DIRS.name()));
}
return logDirs;
}

public DAGImpl setLogDirs(String[] logDirs) {
this.logDirs = logDirs;
return this;
}
}