YARN-5650. Render Application Timeout value in web UI. Contributed by Akhil PB.
This commit is contained in:
parent
e9ce2df1f2
commit
238863c11b
|
@ -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.ApplicationId;
|
||||
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.FinalApplicationStatus;
|
||||
import org.apache.hadoop.yarn.api.records.LogAggregationStatus;
|
||||
|
@ -207,6 +208,14 @@ public class AppBlock extends HtmlBlock {
|
|||
overviewTable._("Log Aggregation Status:",
|
||||
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:",
|
||||
app.getDiagnosticsInfo() == null ? "" : app.getDiagnosticsInfo());
|
||||
|
|
|
@ -259,8 +259,12 @@ public class AppInfo {
|
|||
timeout.setTimeoutType(entry.getKey());
|
||||
long timeoutInMillis = entry.getValue().longValue();
|
||||
timeout.setExpiryTime(Times.formatISO8601(timeoutInMillis));
|
||||
timeout.setRemainingTime(Math
|
||||
.max((timeoutInMillis - System.currentTimeMillis()) / 1000, 0));
|
||||
if (app.isAppInCompletedStates()) {
|
||||
timeout.setRemainingTime(0);
|
||||
} else {
|
||||
timeout.setRemainingTime(Math
|
||||
.max((timeoutInMillis - System.currentTimeMillis()) / 1000, 0));
|
||||
}
|
||||
timeouts.add(timeout);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue