YARN-7573. Gpu Information page could be empty for nodes without GPU. (Sunil G via wangda)

Change-Id: I7f614e5a589a09ce4e4286c84b706e05c29abd14
This commit is contained in:
Wangda Tan 2017-11-29 17:43:37 -08:00
parent 333ef303ff
commit c9a54aab6b
6 changed files with 12 additions and 8 deletions

View File

@ -519,9 +519,7 @@ public class NMWebServices {
}
}
throw new YarnException(
"Could not get detailed resource information for given resource-name="
+ resourceName);
return new NMResourceInfo();
}
private long parseLongParam(String bytes) {

View File

@ -97,7 +97,9 @@ export default DS.Model.extend({
var used = 0;
var ri;
var resourceInformations = this.get("usedResource").resourcesInformations;
const usedResource = this.get("usedResource");
const availableResource = this.get("availableResource");
var resourceInformations = usedResource ? usedResource.resourcesInformations : [];
for (var i = 0; i < resourceInformations.length; i++) {
ri = resourceInformations[i];
if (ri.name === "yarn.io/gpu") {
@ -106,7 +108,7 @@ export default DS.Model.extend({
}
var available = 0;
resourceInformations = this.get("availableResource").resourcesInformations;
resourceInformations = availableResource ? availableResource.resourcesInformations : [];
for (i = 0; i < resourceInformations.length; i++) {
ri = resourceInformations[i];
if (ri.name === "yarn.io/gpu") {

View File

@ -36,7 +36,7 @@
{{#link-to 'yarn-node-containers' nodeId nodeAddr}}List of Containers
{{/link-to}}
{{/link-to}}
{{#if nmGpuInfo}}
{{#if (and nmGpuInfo nmGpuInfo.info.totalGpuDevices)}}
{{#link-to 'yarn-node.yarn-nm-gpu' tagName="li"}}
{{#link-to 'yarn-node.yarn-nm-gpu' nodeId nodeAddr }}GPU Information
{{/link-to}}

View File

@ -20,7 +20,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
{{node-menu-panel path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
{{node-menu-panel path="yarn-node-apps" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id nmGpuInfo=model.nmGpuInfo}}
{{#if model.apps}}
<div class="col-md-10 container-fluid">
<table id="node-apps-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">

View File

@ -20,7 +20,7 @@
<div class="col-md-12 container-fluid">
<div class="row">
{{node-menu-panel path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id}}
{{node-menu-panel path="yarn-node-containers" nodeAddr=model.nodeInfo.addr nodeId=model.nodeInfo.id nmGpuInfo=model.nmGpuInfo}}
{{#if model.containers}}
<div class="col-md-10 container-fluid">
<table id="node-containers-table" class="display table table-striped table-bordered" cellspacing="0" width="100%">

View File

@ -23,6 +23,7 @@
{{node-menu-panel path="yarn-node" nodeId=model.rmNode.id
nodeAddr=model.node.id nmGpuInfo=model.nmGpuInfo}}
{{#if model.nmGpuInfo.info.totalGpuDevices}}
<div class="col-md-10 container-fluid">
<div class="panel panel-default">
@ -49,5 +50,8 @@
{{yarn-nm-gpu-info gpu=gpu}}
{{/each}}
</div>
{{else}}
<h4 align = "center">No GPUs are found on this node.</h4>
{{/if}}
</div>
</div>