diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/request-table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/request-table.js new file mode 100644 index 0000000..4b741b8 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/request-table.js @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; + +export default Ember.Component.extend({ +}); \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js index a96c17c..fc94497 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js @@ -46,9 +46,10 @@ export default DS.Model.extend({ preemptedResourceVCores: DS.attr('number'), numNonAMContainerPreempted: DS.attr('number'), numAMContainerPreempted: DS.attr('number'), + requests: DS.hasMany('YarnRequest'), isFailed: function() { - return this.get('finalStatus') == "FAILED" + return this.get('finalStatus') == "FAILED"; }.property("finalStatus"), validatedFinishedTs: function() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-request.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-request.js new file mode 100644 index 0000000..1866731 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-request.js @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DS from 'ember-data'; + +export default DS.Model.extend({ + memory: DS.attr('number'), + virtualCores: DS.attr('number'), + executionType: DS.attr('string'), + nodeLabelExpression: DS.attr('string'), + numContainers: DS.attr('number'), + priority: DS.attr('number'), + relaxLocality: DS.attr('string'), + resourceName: DS.attr('string') +}); \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js index ba8c1f4..2a7105a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-app.js @@ -25,7 +25,36 @@ export default DS.JSONAPISerializer.extend({ if (payload.app) { payload = payload.app; } - + + var includedData = []; + var relationshipRequestData = []; + + if (payload.resourceRequests) { + var i = 0; + payload.resourceRequests.forEach(function(u) { + includedData.push({ + type: "YarnRequest", + id: id + "_" + i, + attributes: { + memory: u.capability.memory, + virtualCores: u.capability.virtualCores, + executionType: u.executionType || "", + nodeLabelExpression: u.nodeLabelExpression, + numContainers: u.numContainers, + priority: u.priority.priority, + relaxLocality: u.relaxLocality, + resourceName: u.resourceName, + } + }); + + relationshipRequestData.push({ + type: "YarnRequest", + id: id + "_" + i, + }) + i = i+1; + }); + } + var fixedPayload = { id: id, type: primaryModelClass.modelName, // yarn-app @@ -54,36 +83,60 @@ export default DS.JSONAPISerializer.extend({ preemptedResourceMB: payload.preemptedResourceMB, preemptedResourceVCores: payload.preemptedResourceVCores, numNonAMContainerPreempted: payload.numNonAMContainerPreempted, - numAMContainerPreempted: payload.numAMContainerPreempted + numAMContainerPreempted: payload.numAMContainerPreempted, + }, + //Relationships + relationships: { + requests: { + data: relationshipRequestData + } } }; - return fixedPayload; + return { + fixedPayload: fixedPayload, + includedData: includedData + } }, normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) { var p = this.internalNormalizeSingleResponse(store, primaryModelClass, payload, id, requestType); - return { data: p }; + + var tmp = { + data: this._super(store, primaryModelClass, p.fixedPayload, id, requestType), + includedData: p.includedData + } + + return tmp; }, normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) { // return expected is { data: [ {}, {} ] } var normalizedArrayResponse = {}; + var data = []; + var included = []; // payload has apps : { app: [ {},{},{} ] } // need some error handling for ex apps or app may not be defined. if(payload.apps) { - normalizedArrayResponse.data = payload.apps.app.map(singleApp => { - return this.internalNormalizeSingleResponse(store, primaryModelClass, - singleApp, singleApp.id, requestType); - }, this); + for(var j = 0, l = payload.apps.app.length; j < l; j++) { + var singleApp = payload.apps.app[j]; + var result = this.normalizeSingleResponse(store, primaryModelClass, singleApp, singleApp.id, requestType); + data.push(result.data); + included = included.concat(result.includedData); + } } else { normalizedArrayResponse.data = []; + normalizedArrayResponse.included = []; } + normalizedArrayResponse.data = data; + normalizedArrayResponse.included = included; + + // console.log(normalizedArrayResponse); return normalizedArrayResponse; } }); \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/request-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/request-table.hbs new file mode 100644 index 0000000..5bbcbfd --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/request-table.hbs @@ -0,0 +1,49 @@ +{{! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +}} + + +
Pending Resources Requests
+ + + + + + + + + + + + + + {{#if arr}} + {{#each arr as |request|}} + + + + + + + + + + {{/each}} + {{/if}} + +
PriorityResourceNameMemoryVirtualCoresNumContainersRelaxLocalityNodeLabelExpression
{{request.priority}}{{request.resourceName}}<{{request.memory}}>{{request.virtualCores}}{{request.numContainers}}{{request.relaxLocality}}{{request.nodeLabelExpression}}
+ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs index 2bc20f2..ee87595 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs @@ -116,6 +116,12 @@ + {{#if model.app.requests}} + {{request-table table-id="requests-table" arr=model.app.requests}} + {{else}} +

Could not find any pending resource requests from this cluster

+ {{/if}} +