YARN-5650. Render Application Timeout value in web UI. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2016-12-20 11:03:57 +05:30
parent e9ce2df1f2
commit 238863c11b
2 changed files with 15 additions and 2 deletions

View File

@ -40,6 +40,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.LogAggregationStatus; import org.apache.hadoop.yarn.api.records.LogAggregationStatus;
@ -207,6 +208,14 @@ public class AppBlock extends HtmlBlock {
overviewTable._("Log Aggregation Status:", overviewTable._("Log Aggregation Status:",
root_url("logaggregationstatus", app.getAppId()), status.name()); root_url("logaggregationstatus", app.getAppId()), status.name());
} }
long timeout = appReport.getApplicationTimeouts()
.get(ApplicationTimeoutType.LIFETIME).getRemainingTime();
if (timeout < 0) {
overviewTable._("Application Timeout (Remaining Time):", "Unlimited");
} else {
overviewTable._("Application Timeout (Remaining Time):",
String.format("%d seconds", timeout));
}
} }
overviewTable._("Diagnostics:", overviewTable._("Diagnostics:",
app.getDiagnosticsInfo() == null ? "" : app.getDiagnosticsInfo()); app.getDiagnosticsInfo() == null ? "" : app.getDiagnosticsInfo());

View File

@ -259,8 +259,12 @@ public class AppInfo {
timeout.setTimeoutType(entry.getKey()); timeout.setTimeoutType(entry.getKey());
long timeoutInMillis = entry.getValue().longValue(); long timeoutInMillis = entry.getValue().longValue();
timeout.setExpiryTime(Times.formatISO8601(timeoutInMillis)); timeout.setExpiryTime(Times.formatISO8601(timeoutInMillis));
timeout.setRemainingTime(Math if (app.isAppInCompletedStates()) {
.max((timeoutInMillis - System.currentTimeMillis()) / 1000, 0)); timeout.setRemainingTime(0);
} else {
timeout.setRemainingTime(Math
.max((timeoutInMillis - System.currentTimeMillis()) / 1000, 0));
}
timeouts.add(timeout); timeouts.add(timeout);
} }
} }