1
0
Просмотр исходного кода

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

Rohith Sharma K S 7 лет назад
Родитель
Сommit
c5bbd6418e

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-log.js

@@ -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",

+ 40 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js

@@ -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 ) {

+ 6 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-log.js

@@ -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;
   }
 });

+ 4 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/services/hosts.js

@@ -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"));
   }),

+ 1 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/config/default-config.js

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