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 @@ -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 @@ -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