You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/08/20 17:33:20 UTC

git commit: AMBARI-6943. Jobs View: Link to YARN application not being shown for Hive job (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 53ec9ed43 -> 3b2bb3343


AMBARI-6943. Jobs View: Link to YARN application not being shown for Hive job (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b2bb334
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b2bb334
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b2bb334

Branch: refs/heads/trunk
Commit: 3b2bb3343ed36e34648b29648d339215cf89a22e
Parents: 53ec9ed
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 20 18:28:02 2014 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 20 18:28:23 2014 +0300

----------------------------------------------------------------------
 .../resources/ui/app/scripts/helpers/jobs.js    |  2 ++
 .../mappers/application_status_mapper.js        | 29 ++++++++++++++++----
 .../ui/app/scripts/models/jobs/tez_dag.js       |  2 ++
 .../main/resources/ui/app/templates/job/job.hbs |  2 +-
 4 files changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b2bb334/contrib/views/jobs/src/main/resources/ui/app/scripts/helpers/jobs.js
----------------------------------------------------------------------
diff --git a/contrib/views/jobs/src/main/resources/ui/app/scripts/helpers/jobs.js b/contrib/views/jobs/src/main/resources/ui/app/scripts/helpers/jobs.js
index 63f8b2e..9255603 100644
--- a/contrib/views/jobs/src/main/resources/ui/app/scripts/helpers/jobs.js
+++ b/contrib/views/jobs/src/main/resources/ui/app/scripts/helpers/jobs.js
@@ -115,6 +115,7 @@ App.Helpers.jobs = {
     var self = this,
       yarnService = App.HiveJob.store.getById('service', 'YARN'),
       historyServerHostName = App.HiveJob.store.getById('component', 'APP_TIMELINE_SERVER').get('hostName'),
+      resourceManagerHostName = App.HiveJob.store.getById('component', 'RESOURCEMANAGER').get('hostName'),
       ahsWebPort = yarnService.get('ahsWebPort'),
       tezDag = App.HiveJob.store.getById('tezDag', tezDagId);
     if (tezDag) {
@@ -125,6 +126,7 @@ App.Helpers.jobs = {
               var app_id = Em.get(data, 'otherinfo.applicationId');
               if (!Em.isNone(app_id)) {
                 tezDag.set('yarnApplicationId', app_id);
+                tezDag.set('yarnApplicationLink', 'http://'+resourceManagerHostName+':8088/cluster/app/'+app_id);
               }
               if (data.relatedentities && data.relatedentities.TEZ_VERTEX_ID != null) {
                 var count = data.relatedentities.TEZ_VERTEX_ID.length;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b2bb334/contrib/views/jobs/src/main/resources/ui/app/scripts/mappers/application_status_mapper.js
----------------------------------------------------------------------
diff --git a/contrib/views/jobs/src/main/resources/ui/app/scripts/mappers/application_status_mapper.js b/contrib/views/jobs/src/main/resources/ui/app/scripts/mappers/application_status_mapper.js
index 2f71c48..aa17bd5 100644
--- a/contrib/views/jobs/src/main/resources/ui/app/scripts/mappers/application_status_mapper.js
+++ b/contrib/views/jobs/src/main/resources/ui/app/scripts/mappers/application_status_mapper.js
@@ -60,7 +60,7 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
   },
 
   /**
-   * Is ATS host loaded
+   * Is ATS and RESOURCEMANAGER hosts loaded
    * @type {bool}
    */
   hostForComponentIsLoaded: false,
@@ -72,6 +72,15 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
   portIsLoaded: false,
 
   /**
+   * Array of component names that need to be loaded
+   * @type {Array}
+   */
+  componentsToLoad: [
+    "APP_TIMELINE_SERVER",
+    "RESOURCEMANAGER"
+  ],
+
+  /**
    * Start mapping when <code>App.clusterName</code> is loaded
    * @method mapInit
    */
@@ -91,7 +100,9 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
     this.getServices().then(function() {
       self.getComponents().then(function() {
         if (!self.get('hostForComponentIsLoaded'))
-          self.getHostsForComponents();
+          self.get('componentsToLoad').forEach(function (componentName) {
+            self.getHostsForComponents(componentName);
+          })
         if (!self.get('portIsLoaded'))
           self.getDesiredConfigs();
       });
@@ -181,6 +192,7 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
       ats = data.items.findBy('ServiceComponentInfo.component_name', 'APP_TIMELINE_SERVER'),
       atsModel = Em.isNone(ats) ? {id: 'APP_TIMELINE_SERVER'} : Em.JsonMapper.map(ats, map);
     App.HiveJob.store.push('component', atsModel);
+    App.HiveJob.store.push('component', {id: 'RESOURCEMANAGER'});
   },
 
   /**
@@ -190,6 +202,7 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
    */
   getComponentsErrorCallback: function() {
     App.HiveJob.store.push('component', {id: 'APP_TIMELINE_SERVER'});
+    App.HiveJob.store.push('component', {id: 'RESOURCEMANAGER'});
   },
 
   /**
@@ -197,12 +210,12 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
    * @returns {$.ajax}
    * @method getHostsForComponents
    */
-  getHostsForComponents: function() {
+  getHostsForComponents: function(componentName) {
     return App.ajax.send({
       name: 'components_hosts',
       sender: this,
       data: {
-        componentName: 'APP_TIMELINE_SERVER'
+        componentName: componentName
       },
       success: 'getHostsForComponentsSuccessCallback'
     });
@@ -215,8 +228,12 @@ App.ApplicationStatusMapper = Em.Object.createWithMixins(App.RunPeriodically, {
    * @method getHostsForComponentsSuccessCallback
    */
   getHostsForComponentsSuccessCallback: function(data) {
-    App.HiveJob.store.getById('component', 'APP_TIMELINE_SERVER').set('hostName', Em.get(data.items[0], 'Hosts.host_name'));
-    this.set('hostForComponentIsLoaded', true);
+    App.HiveJob.store.getById('component', arguments[2].componentName).set('hostName', Em.get(data.items[0], 'Hosts.host_name'));
+    this.set('componentsToLoad', this.get('componentsToLoad').without(arguments[2].componentName))
+
+    if(this.get('componentsToLoad').length === 0){
+      this.set('hostForComponentIsLoaded', true);
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b2bb334/contrib/views/jobs/src/main/resources/ui/app/scripts/models/jobs/tez_dag.js
----------------------------------------------------------------------
diff --git a/contrib/views/jobs/src/main/resources/ui/app/scripts/models/jobs/tez_dag.js b/contrib/views/jobs/src/main/resources/ui/app/scripts/models/jobs/tez_dag.js
index cd6178b..5797120 100644
--- a/contrib/views/jobs/src/main/resources/ui/app/scripts/models/jobs/tez_dag.js
+++ b/contrib/views/jobs/src/main/resources/ui/app/scripts/models/jobs/tez_dag.js
@@ -26,6 +26,8 @@ App.TezDag = DS.Model.extend({
 
   yarnApplicationId: DS.attr('string'),
 
+  yarnApplicationLink: DS.attr('string'),
+
   stage: DS.attr('string'),
 
   vertices: DS.hasMany('tezDagVertex'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b2bb334/contrib/views/jobs/src/main/resources/ui/app/templates/job/job.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/jobs/src/main/resources/ui/app/templates/job/job.hbs b/contrib/views/jobs/src/main/resources/ui/app/templates/job/job.hbs
index 46a6a35..e294f9a 100644
--- a/contrib/views/jobs/src/main/resources/ui/app/templates/job/job.hbs
+++ b/contrib/views/jobs/src/main/resources/ui/app/templates/job/job.hbs
@@ -33,7 +33,7 @@
           </tr>
           <tr>
             <td>{{t jobs.hive.yarnApplication}}</td>
-            <td>{{view.content.tezDag.yarnApplicationId}}</td>
+            <td><a target="_blank" {{bind-attr href=view.content.tezDag.yarnApplicationLink}}>{{view.content.tezDag.yarnApplicationId}}</a></td>
           </tr>
           <tr>
             <td>{{t jobs.hive.stages}}</td>