Skip to content

TEZ-4231: SimpleHistoryParser doesn't merge events correctly - #123

Merged
abstractdog merged 3 commits into
apache:masterfrom
abstractdog:TEZ-4231
Aug 9, 2021
Merged

TEZ-4231: SimpleHistoryParser doesn't merge events correctly#123
abstractdog merged 3 commits into
apache:masterfrom
abstractdog:TEZ-4231

Conversation

@abstractdog

@abstractdogabstractdog commented May 18, 2021

Copy link
Copy Markdown
Contributor

Problems fixed:

  1. DagInfo.getEvents() returns an array with only 1 element
  2. All of the events (DagInfo.getEvents(), VertexInfo,getEvents()) have "0" as timestamp
    3. HistoryEventProtoJsonConversion: TASK_FINISHED event and VERTEX_FINISHED events don't contain starTime, only timeTaken, so as timeTaken is fix, startTime should be derivated from that, not the opposite way (this caused non-sense task durations in analyzers while parsing proto history files)
  3. Fix an NPE in TaskAttemptResultStatisticsAnalyzer
  4. float truncation problem in SkewAnalyzer
  5. counters format workaround for TEZ-4324

Refactoring:
removed configuration object from analyzers as TezAnalyzerBase is already a Configured class

New analyzers:
InputReadErrorAnalyzer
DagOverviewAnalyzer
TaskHangAnalyzer

attached example excel sheets generated with the analyzers to jira

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

@rbalamohan: could you please take a look? new analyzers + minor bugfixes

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

@rbalamohan : ping, if you have some cycles to review this fix/improvement :)

@hadoop-yetus

This comment has been minimized.

@hadoop-yetus

This comment has been minimized.

@rbalamohanrbalamohan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @abstractdog for the patch. Added review comments.

}

// attempt_1599682376162_0006_27_00_000086_1
int attemptNumber = Integer.parseInt(attempt.getTaskAttemptId().split("_")[6]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Replace with "TezTaskAttemptID.fromString(attempt.getTaskAttemptId()).getId()}" ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

oh, right, what a hack this parseInt was :)

// attempt_1599682376162_0006_27_00_000086_1
int attemptNumber = Integer.parseInt(attempt.getTaskAttemptId().split("_")[6]);
if (attemptNumber == numAttemptsForTask - 1) {
thisTaskData.put("last_attempt_id", attempt.getTaskAttemptId());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Declare as static final Strings?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

sure


// attempt_1599682376162_0006_27_00_000086_1
int attemptNumber = Integer.parseInt(attempt.getTaskAttemptId().split("_")[6]);
if (attemptNumber == numAttemptsForTask - 1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sometimes all the attempts may get scheduled on the same node and fail. It will be good to understand that as well. Would you like to refactor it such that, it can provide all id/status and respective node details?.

While providing final detail, it can be a concatenated string as well (to make it readable and printable easily)

It will be nice to provide the info in this analyzer itself; (Without this info, user may have to co-relate with results of TaskAssignmentAnalyzer for node analysis).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

okay, adding status in "id/status" format to the "last_attempt_id" column
node info is already there in the last column: "last_attempt_node"


@Override
public String getDescription() {
return "TaskHandAnalyzer can give quick insights about hanging tasks/task attempts"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

fixing to simply "hanging task attempts"

/**
* Get the Task assignments on different nodes of the cluster.
*/
public class TaskHangAnalyzer extends TezAnalyzerBase implements Analyzer {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename as "HungTaskAnalyzer" ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

okay, makes sense

import java.util.Map;

/**
* Get the Task assignments on different nodes of the cluster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix comments as this analyser is related to hung task analysis

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

sure

/**
* This analyzer is support to collect which nodes can be blamed for shuffle read errors.
*/
public class InputReadErrorAnalyzer extends TezAnalyzerBase implements Analyzer {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

thanks, also I'm fixing "is support to collect", now it doesn't seem to be correct somehow


JSONObject otherInfo = new JSONObject();
otherInfo.put(ATSConstants.START_TIME, startTime);
otherInfo.put(ATSConstants.START_TIME, event.getEventTime() - timeTaken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC, there were corner cases where events will not be properly populated. May be in cases, where vertices were shutdown due to errors or so (need to check).

In such cases, this would have returned "-ve" value earlier.

Current patch seem to change the start_time, depending on getEventTime. This could give a perspective that the task/vertex was there for very short time.

Can you plz share more info on prev error? Were you getting -ve values earlier for which this is being modified?

@abstractdogabstractdogAug 6, 2021

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

actually, I saw this for all protobuf history files, that's why I'm not suspecting corner case
I found that in case of a TASK_FINISHED finished event, there is always an event time (which is the end time obviously) and timeTaken in event_data, but there is no startTime there

this string is what the debugger writes for a HistoryLoggerProtos$HistoryEventProto instance while doing this conversion:

event_type: "TASK_FINISHED"
event_time: 1628149977709
app_id: "application_1628051798891_0030"
dag_id: "dag_1628051798891_0030_1"
vertex_id: "vertex_1628051798891_0030_1_00"
task_id: "task_1628051798891_0030_1_00_000001"
event_data {
key: "timeTaken"
value: "4193"
}
event_data {
key: "status"
value: "SUCCEEDED"
}
event_data {
key: "numFailedTaskAttempts"
value: "0"
}
event_data {
key: "successfulAttemptId"
value: "attempt_1628051798891_0030_1_00_000001_0"
}
event_data {
key: "diagnostics"
value: ""
}
event_data {
key: "counters"
value: "..."
}

the root cause of this behavior would be:
https://github.com/apache/tez/blob/master/tez-plugins/tez-protobuf-history-plugin/src/main/java/org/apache/tez/dag/history/logging/proto/HistoryEventProtoConverter.java#L392

 private HistoryEventProto convertTaskFinishedEvent(TaskFinishedEvent event) {
HistoryEventProto.Builder builder = makeBuilderForEvent(event, event.getFinishTime(),
null, null, null, null, event.getTaskID(), null, null);
addEventData(builder, ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime()));

here I can see the builder consumes only event.getFinishTime() for the "time" parameter, and startTime is shipped indirectly...according to blame, this code part is unchanged since the introduction of proto history logger (TEZ-3915)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the note. Earlier code didn't populate START_TIME (& had only timeTaken) causing the issue.

// if DAG_PLAN is not filled already, let's try to fetch it from other
dagJson.getJSONObject(ATSConstants.OTHER_INFO).put(ATSConstants.DAG_PLAN, jsonObject
.getJSONObject(ATSConstants.OTHER_INFO).getJSONObject(ATSConstants.DAG_PLAN));
} else{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: fix indent

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

sure


public class DagOverviewAnalyzer extends TezAnalyzerBase implements Analyzer {
private final String[] headers =
{ "name", "id", "event_type", "status", "event_time", "event_time_str", "diagnostics" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be possible to include the number of tasks assigned in the vertex as well (can be added in another field called "comments" or "additional info" which can be populated optionally).
e.g "numTasks: " vertex.getNumTasks() + ", failedTasks: " + vertex.getFailedTasks().size()
+ ", completedTasks: " + vertex.getCompletedTasksCount()

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

makes sense, I'm adding a "vertex_task_stats" before diagnostics column for better readability

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@hadoop-yetus

This comment has been minimized.

@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 33sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+0 🆗mvndep4m 21sMaven dependency ordering for branch
+1 💚mvninstall8m 52smaster passed
+1 💚compile1m 32smaster passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚compile1m 29smaster passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚checkstyle1m 27smaster passed
+1 💚javadoc1m 31smaster passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javadoc1m 17smaster passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+0 🆗spotbugs0m 44sUsed deprecated FindBugs config; considering switching to SpotBugs.
+0 🆗findbugs0m 42stez-tools/analyzers/job-analyzer in master has 4 extant findbugs warnings.
-0 ⚠️patch1m 4sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+0 🆗mvndep0m 9sMaven dependency ordering for patch
+1 💚mvninstall1m 7sthe patch passed
+1 💚compile0m 50sthe patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javac0m 50sthe patch passed
+1 💚compile0m 46sthe patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚javac0m 46sthe patch passed
-0 ⚠️checkstyle0m 10stez-tools/analyzers/job-analyzer: The patch generated 1 new + 66 unchanged - 2 fixed = 67 total (was 68)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 38sthe patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚javadoc0m 35sthe patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚findbugs1m 47sthe patch passed
_ Other Tests _
+1 💚unit0m 29stez-protobuf-history-plugin in the patch passed.
+1 💚unit2m 15stez-history-parser in the patch passed.
+1 💚unit2m 33sjob-analyzer in the patch passed.
+1 💚asflicense0m 29sThe patch does not generate ASF License warnings.
37m 11s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-123/5/artifact/out/Dockerfile
GITHUB PR#123
JIRA IssueTEZ-4231
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux ac8c6fb7724f 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 464d86d
Default JavaPrivate Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-123/5/artifact/out/diff-checkstyle-tez-tools_analyzers_job-analyzer.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-123/5/testReport/
Max. process+thread count877 (vs. ulimit of 5500)
modulesC: tez-plugins/tez-protobuf-history-plugin tez-plugins/tez-history-parser tez-tools/analyzers/job-analyzer U: .
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-123/5/console
versionsgit=2.25.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@rbalamohanrbalamohan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Latest patch LGTM. +1


JSONObject otherInfo = new JSONObject();
otherInfo.put(ATSConstants.START_TIME, startTime);
otherInfo.put(ATSConstants.START_TIME, event.getEventTime() - timeTaken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the note. Earlier code didn't populate START_TIME (& had only timeTaken) causing the issue.

@abstractdog
abstractdog merged commit 3f541d0 into apache:masterAug 9, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@abstractdog@hadoop-yetus@rbalamohan