YARN-4498. Application level node labels stats to be available in REST (addendum patch). Contributed by Bibin A Chundatt.
This commit is contained in:
parent
59ee8b7a88
commit
edbee9e609
|
@ -111,7 +111,7 @@ public class AppInfo {
|
||||||
protected String appNodeLabelExpression;
|
protected String appNodeLabelExpression;
|
||||||
protected String amNodeLabelExpression;
|
protected String amNodeLabelExpression;
|
||||||
|
|
||||||
protected ResourcesInfo resourceInfo;
|
protected ResourcesInfo resourceInfo = null;
|
||||||
|
|
||||||
public AppInfo() {
|
public AppInfo() {
|
||||||
} // JAXB needs this
|
} // JAXB needs this
|
||||||
|
@ -232,7 +232,7 @@ public class AppInfo {
|
||||||
.getApplicationAttempt(attempt.getAppAttemptId());
|
.getApplicationAttempt(attempt.getAppAttemptId());
|
||||||
resourceInfo = null != ficaAppAttempt
|
resourceInfo = null != ficaAppAttempt
|
||||||
? new ResourcesInfo(ficaAppAttempt.getSchedulingResourceUsage())
|
? new ResourcesInfo(ficaAppAttempt.getSchedulingResourceUsage())
|
||||||
: new ResourcesInfo();
|
: null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
@ -153,10 +154,13 @@ public class TestRMWebServiceAppsNodelabel extends JerseyTestBase {
|
||||||
JSONObject json = response.getEntity(JSONObject.class);
|
JSONObject json = response.getEntity(JSONObject.class);
|
||||||
JSONObject apps = json.getJSONObject("apps");
|
JSONObject apps = json.getJSONObject("apps");
|
||||||
assertEquals("incorrect number of elements", 1, apps.length());
|
assertEquals("incorrect number of elements", 1, apps.length());
|
||||||
JSONObject jsonObject =
|
try {
|
||||||
apps.getJSONArray("app").getJSONObject(0).getJSONObject("resourceInfo");
|
apps.getJSONArray("app").getJSONObject(0).getJSONObject("resourceInfo");
|
||||||
Iterator<?> keys = jsonObject.keys();
|
fail("resourceInfo object shouldnt be available for finished apps");
|
||||||
assertEquals("For finshed app no values expected", false, keys.hasNext());
|
} catch (Exception e) {
|
||||||
|
assertTrue("resourceInfo shouldn't be available for finished apps",
|
||||||
|
true);
|
||||||
|
}
|
||||||
rm.stop();
|
rm.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue