YARN-7753. [UI2] Application logs has to be pulled from ATS 1.5 instead of ATS2. Contributed by Sunil G.

This commit is contained in:
Rohith Sharma K S 2018-01-19 15:48:16 +05:30
parent 9e4f52d323
commit c5bbd6418e
5 changed files with 52 additions and 2 deletions

View File

@ -19,7 +19,7 @@
import AbstractAdapter from './abstract';
export default AbstractAdapter.extend({
address: "timelineWebAddress",
address: "timelineV1WebAddress",
// restNameSpace: "timelineV2", // Use ATSv2 when it supports log APIs.
restNameSpace: "timeline", //Using ATSv1.5 now, would be supported by ATSv2 very soon.
serverName: "ATS",

View File

@ -25,7 +25,16 @@ function getTimeLineURL(rmhost) {
(ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost;
url += '/conf?name=yarn.timeline-service.reader.webapp.address';
Ember.Logger.log("Get Timeline Address URL: " + url);
Ember.Logger.log("Get Timeline V2 Address URL: " + url);
return url;
}
function getTimeLineV1URL(rmhost) {
var url = window.location.protocol + '//' +
(ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost;
url += '/conf?name=yarn.timeline-service.webapp.address';
Ember.Logger.log("Get Timeline V1 Address URL: " + url);
return url;
}
@ -70,6 +79,36 @@ function updateConfigs(application) {
Ember.Logger.log("Timeline Address: " + ENV.hosts.timelineWebAddress);
application.advanceReadiness();
}
if(!ENV.hosts.timelineV1WebAddress) {
var timelinehost = "";
$.ajax({
type: 'GET',
dataType: 'json',
async: true,
context: this,
url: getTimeLineV1URL(rmhost),
success: function(data) {
timelinehost = data.property.value;
ENV.hosts.timelineV1WebAddress = timelinehost;
var address = timelinehost.split(":")[0];
var port = timelinehost.split(":")[1];
Ember.Logger.log("Timeline V1 Address from RM: " + timelinehost);
if(address === "0.0.0.0" || address === "localhost") {
var updatedAddress = hostname + ":" + port;
ENV.hosts.timelineV1WebAddress = updatedAddress;
Ember.Logger.log("Timeline V1 Updated Address: " + updatedAddress);
}
application.advanceReadiness();
}
});
} else {
Ember.Logger.log("Timeline V1 Address: " + ENV.hosts.timelineV1WebAddress);
application.advanceReadiness();
}
}
export function initialize( application ) {

View File

@ -43,6 +43,12 @@ export default DS.JSONAPISerializer.extend({
payload.containerLogsInfo.containerId, payload.containerLogsInfo.nodeId);
});
}
if (payload && payload[0] && payload[0].containerLogInfo) {
normalizedArrayResponse.data = payload[0].containerLogInfo.map((paylog) => {
return this.internalNormalizeSingleResponse(store, primaryModelClass, paylog,
payload[0].containerId, payload[0].nodeId);
});
}
return normalizedArrayResponse;
}
});

View File

@ -72,6 +72,10 @@ export default Ember.Service.extend({
return this.normalizeURL(this.get("env.app.hosts.timelineWebAddress"));
}),
timelineV1WebAddress: Ember.computed(function () {
return this.normalizeURL(this.get("env.app.hosts.timelineV1WebAddress"));
}),
rmWebAddress: Ember.computed(function () {
return this.normalizeURL(this.get("env.app.hosts.rmWebAddress"));
}),

View File

@ -20,6 +20,7 @@ module.exports = { // YARN UI App configurations
hosts: {
localBaseAddress: "",
timelineWebAddress: "localhost:8188",
timelineV1WebAddress: "localhost:8188",
rmWebAddress: "localhost:8088",
protocolScheme: "http:"
},