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

View File

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

View File

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