Skip to content

YARN-9880. In YARN ui2 attempts tab, The running Application Attempt's ElapsedTime is incorrect. #1626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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 @@ -27,6 +27,7 @@

import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState;
import org.apache.hadoop.yarn.util.Times;

@Public
@Evolving
Expand All @@ -44,6 +45,7 @@ public class AppAttemptInfo {
protected String amContainerId;
protected long startedTime;
protected long finishedTime;
protected long elapsedTime;

public AppAttemptInfo() {
// JAXB needs this
Expand All @@ -62,6 +64,7 @@ public AppAttemptInfo(ApplicationAttemptReport appAttempt) {
}
startedTime = appAttempt.getStartTime();
finishedTime = appAttempt.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime);
}

public String getAppAttemptId() {
Expand Down Expand Up @@ -104,4 +107,8 @@ public long getFinishedTime() {
return finishedTime;
}

public long getElapsedTime() {
return elapsedTime;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
import org.apache.hadoop.yarn.util.Times;
import org.apache.hadoop.yarn.webapp.util.WebAppUtils;

@XmlRootElement(name = "appAttempt")
Expand All @@ -37,6 +38,7 @@ public class AppAttemptInfo {
protected int id;
protected long startTime;
protected long finishedTime;
protected long elapsedTime;
protected String containerId;
protected String nodeHttpAddress;
protected String nodeId;
Expand All @@ -62,6 +64,8 @@ public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
this.id = attempt.getAppAttemptId().getAttemptId();
this.startTime = attempt.getStartTime();
this.finishedTime = attempt.getFinishTime();
this.elapsedTime =
Times.elapsed(attempt.getStartTime(), attempt.getFinishTime());
Container masterContainer = attempt.getMasterContainer();
if (masterContainer != null) {
this.containerId = masterContainer.getId().toString();
Expand Down Expand Up @@ -104,6 +108,10 @@ public long getFinishedTime() {
return this.finishedTime;
}

public long getElapsedTime() {
return this.elapsedTime;
}

public String getNodeHttpAddress() {
return this.nodeHttpAddress;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ The capacity scheduler supports hierarchical queues. This one request will print

| Item | Data Type | Description |
|:---- |:---- |:---- |
| memory | int | The amount of memory used (in MB) |
| memory | long | The amount of memory used (in MB) |
| vCores | int | The number of virtual cores |

### Elements of the health object in schedulerInfo:
Expand Down Expand Up @@ -1162,7 +1162,7 @@ Response Body:

| Item | Data Type | Description |
|:---- |:---- |:---- |
| memory | int | The amount of memory used (in MB) |
| memory | long | The amount of memory used (in MB) |
| vCores | int | The number of virtual cores |

#### Response Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default DS.Model.extend({
startTime: DS.attr('string'),
startedTime: DS.attr('string'),
finishedTime: DS.attr('string'),
elapsedTimeMs: DS.attr('string'),
containerId: DS.attr('string'),
amContainerId: DS.attr('string'),
nodeHttpAddress: DS.attr('string'),
Expand Down Expand Up @@ -117,11 +118,7 @@ export default DS.Model.extend({
}.property("logsLink"),

elapsedTime: function() {
var elapsedMs = this.get("finishedTs") - this.get("startTs");
if (elapsedMs <= 0) {
elapsedMs = Date.now() - this.get("startTs");
}
return Converter.msToElapsedTimeUnit(elapsedMs);
return Converter.msToElapsedTimeUnit(this.get("elapsedTimeMs"));
}.property(),

tooltipLabel: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default DS.JSONAPISerializer.extend({
startTime: Converter.timeStampToDate(payload.startTime),
startedTime: Converter.timeStampToDate(payload.startedTime),
finishedTime: Converter.timeStampToDate(payload.finishedTime),
elapsedTimeMs: payload.elapsedTime,
containerId: payload.containerId,
amContainerId: payload.amContainerId,
nodeHttpAddress: payload.nodeHttpAddress,
Expand Down