You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ep...@apache.org on 2019/06/04 19:04:10 UTC
[hadoop] branch branch-2 updated: YARN-8625. Aggregate Resource
Allocation for each job is not present in ATS. Contributed by Prabhu
Joseph.
This is an automated email from the ASF dual-hosted git repository.
epayne pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 441339a YARN-8625. Aggregate Resource Allocation for each job is not present in ATS. Contributed by Prabhu Joseph.
441339a is described below
commit 441339a716b3b6c0ccfa795012cda012948824f4
Author: Eric E Payne <er...@verizonmedia.com>
AuthorDate: Tue Jun 4 18:57:44 2019 +0000
YARN-8625. Aggregate Resource Allocation for each job is not present in ATS. Contributed by Prabhu Joseph.
---
.../webapp/TestAHSWebServices.java | 5 +++
.../hadoop/yarn/server/webapp/dao/AppInfo.java | 39 +++++++++++++++-------
2 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
index 1dd0dad..c1c014b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
@@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -408,6 +409,10 @@ public class TestAHSWebServices extends JerseyTestBase {
assertEquals(FinalApplicationStatus.UNDEFINED.toString(),
app.get("finalAppStatus"));
assertEquals(YarnApplicationState.FINISHED.toString(), app.get("appState"));
+ assertNotNull("Aggregate resource allocation is null",
+ app.get("aggregateResourceAllocation"));
+ assertNotNull("Aggregate Preempted Resource Allocation is null",
+ app.get("aggregatePreemptedResourceAllocation"));
}
@Test
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java
index c4de022..27469a8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
+import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.util.Times;
@@ -67,6 +68,8 @@ public class AppInfo {
protected boolean unmanagedApplication;
private String appNodeLabelExpression;
private String amNodeLabelExpression;
+ private String aggregateResourceAllocation;
+ private String aggregatePreemptedResourceAllocation;
public AppInfo() {
// JAXB needs this
@@ -97,19 +100,23 @@ public class AppInfo {
if (app.getPriority() != null) {
priority = app.getPriority().getPriority();
}
- if (app.getApplicationResourceUsageReport() != null) {
- runningContainers = app.getApplicationResourceUsageReport()
- .getNumUsedContainers();
- if (app.getApplicationResourceUsageReport().getUsedResources() != null) {
- allocatedCpuVcores = app.getApplicationResourceUsageReport()
- .getUsedResources().getVirtualCores();
- allocatedMemoryMB = app.getApplicationResourceUsageReport()
- .getUsedResources().getMemorySize();
- reservedCpuVcores = app.getApplicationResourceUsageReport()
- .getReservedResources().getVirtualCores();
- reservedMemoryMB = app.getApplicationResourceUsageReport()
- .getReservedResources().getMemorySize();
+ ApplicationResourceUsageReport usageReport =
+ app.getApplicationResourceUsageReport();
+ if (usageReport != null) {
+ runningContainers = usageReport.getNumUsedContainers();
+ if (usageReport.getUsedResources() != null) {
+ allocatedCpuVcores = usageReport.getUsedResources().getVirtualCores();
+ allocatedMemoryMB = usageReport.getUsedResources().getMemorySize();
+ reservedCpuVcores = usageReport.getReservedResources().
+ getVirtualCores();
+ reservedMemoryMB = usageReport.getReservedResources().getMemorySize();
}
+ aggregateResourceAllocation = usageReport.getMemorySeconds()
+ + " MB-seconds, " + usageReport.getVcoreSeconds()
+ + " vcore-seconds";
+ aggregatePreemptedResourceAllocation = usageReport.
+ getPreemptedMemorySeconds() + " MB-seconds, " +
+ usageReport.getPreemptedVcoreSeconds() + " vcore-seconds";
}
progress = app.getProgress() * 100; // in percent
if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
@@ -235,4 +242,12 @@ public class AppInfo {
public String getAmNodeLabelExpression() {
return amNodeLabelExpression;
}
+
+ public String getAggregateResourceAllocation() {
+ return aggregateResourceAllocation;
+ }
+
+ public String getAggregatePreemptedResourceAllocation() {
+ return aggregatePreemptedResourceAllocation;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org