YARN-7742. [UI2] Duplicated containers are rendered per attempt. (Vasudevan Skm / Sunil G via wangda)

Change-Id: Ib2bb3c64d7f09a7c3488f498d0079bcd2e6ac023
This commit is contained in:
Wangda Tan 2018-01-26 15:46:06 +08:00
parent 75618c0dec
commit 8b5b045bd2
3 changed files with 12 additions and 11 deletions

View File

@ -30,6 +30,7 @@ export default Ember.Component.extend({
clusterMetrics: undefined, clusterMetrics: undefined,
modelArr: [], modelArr: [],
containerIdArr: [],
colors: d3.scale.category10().range(), colors: d3.scale.category10().range(),
_selected: undefined, _selected: undefined,
gridColumns: [], gridColumns: [],
@ -232,19 +233,21 @@ export default Ember.Component.extend({
// init tooltip // init tooltip
this.initTooltip(); this.initTooltip();
this.modelArr = []; this.modelArr = [];
this.containerIdArr = [];
// init model // init model
if (this.get("rmModel")) { if (this.get("rmModel")) {
this.get("rmModel").forEach(function(o) { this.get("rmModel").forEach(function(o) {
if(!this.modelArr.contains(o)) { if(!this.modelArr.contains(o)) {
this.modelArr.push(o); this.modelArr.push(o);
this.containerIdArr.push(o.id);
} }
}.bind(this)); }.bind(this));
} }
if (this.get("tsModel")) { if (this.get("tsModel")) {
this.get("tsModel").forEach(function(o) { this.get("tsModel").forEach(function(o) {
if(!this.modelArr.contains(o)) { if(!this.containerIdArr.contains(o.id)) {
this.modelArr.push(o); this.modelArr.push(o);
} }
}.bind(this)); }.bind(this));

View File

@ -23,12 +23,10 @@ import Converter from 'yarn-ui/utils/converter';
export default DS.JSONAPISerializer.extend({ export default DS.JSONAPISerializer.extend({
internalNormalizeSingleResponse(store, primaryModelClass, payload) { internalNormalizeSingleResponse(store, primaryModelClass, payload) {
var payloadEvents = payload.events, var payloadEvents = payload.events,
createdEvent = payloadEvents.filterBy('id', 'YARN_RM_CONTAINER_CREATED')[0], createdEvent = payloadEvents.filterBy('id', 'YARN_CONTAINER_CREATED')[0],
startedTime = createdEvent? createdEvent.timestamp : Date.now(), startedTime = createdEvent? createdEvent.timestamp : Date.now(),
finishedEvent = payloadEvents.filterBy('id', 'YARN_RM_CONTAINER_FINISHED')[0], finishedEvent = payloadEvents.filterBy('id', 'YARN_CONTAINER_FINISHED')[0],
finishedTime = finishedEvent? finishedEvent.timestamp : Date.now(), finishedTime = finishedEvent? finishedEvent.timestamp : Date.now()
containerExitStatus = finishedEvent? finishedEvent.info.YARN_CONTAINER_EXIT_STATUS : '',
containerState = finishedEvent? finishedEvent.info.YARN_CONTAINER_STATE : '';
var fixedPayload = { var fixedPayload = {
id: payload.id, id: payload.id,
@ -38,11 +36,11 @@ export default DS.JSONAPISerializer.extend({
allocatedVCores: payload.info.YARN_CONTAINER_ALLOCATED_VCORE, allocatedVCores: payload.info.YARN_CONTAINER_ALLOCATED_VCORE,
assignedNodeId: payload.info.YARN_CONTAINER_ALLOCATED_HOST, assignedNodeId: payload.info.YARN_CONTAINER_ALLOCATED_HOST,
priority: payload.info.YARN_CONTAINER_ALLOCATED_PRIORITY, priority: payload.info.YARN_CONTAINER_ALLOCATED_PRIORITY,
startedTime: Converter.timeStampToDate(startedTime), startedTime: Converter.timeStampToDate(payload.createdtime),
finishedTime: Converter.timeStampToDate(finishedTime), finishedTime: Converter.timeStampToDate(payload.info.YARN_CONTAINER_FINISHED_TIME),
nodeHttpAddress: payload.info.YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS, nodeHttpAddress: payload.info.YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS,
containerExitStatus: containerExitStatus, containerExitStatus: payload.info.YARN_CONTAINER_EXIT_STATUS,
containerState: containerState containerState: payload.info.YARN_CONTAINER_STATE
} }
}; };
return fixedPayload; return fixedPayload;

View File

@ -24,4 +24,4 @@ const getDefaultTimezone = () => {
}; };
export const convertTimestampWithTz = (timestamp, format = "YYYY/MM/DD") => export const convertTimestampWithTz = (timestamp, format = "YYYY/MM/DD") =>
moment.tz(timestamp, getDefaultTimezone()).format(format); moment.tz(parseInt(timestamp), getDefaultTimezone()).format(format);