Browse Source

AMBARI-4995. Mirroring: "write" interface needs to be set appropriately on the Falcon cluster. (akovalenko)

Aleksandr Kovalenko 11 years ago
parent
commit
719fa21840

+ 0 - 10
ambari-web/app/controllers/main/mirroring/jobs_controller.js

@@ -21,16 +21,6 @@ var App = require('app');
 App.MainDatasetJobsController = Em.Controller.extend({
   name: 'mainDatasetJobsController',
 
-  isLoaded: function () {
-    return App.router.get('mainMirroringController.isLoaded');
-  }.property('App.router.mainMirroringController.isLoaded'),
-
-  jobs: function () {
-    var datasetName = this.get('content.name');
-    return (this.get('isLoaded') && datasetName) ?
-        App.Dataset.find().findProperty('name', datasetName).get('datasetJobs') : [];
-  }.property('content', 'isLoaded'),
-
   suspend: function () {
     App.ajax.send({
       name: 'mirroring.suspend_entity',

+ 4 - 2
ambari-web/app/controllers/main/mirroring/manage_clusters_controller.js

@@ -47,6 +47,7 @@ App.MainMirroringManageClustersController = Em.ArrayController.extend({
           name: cluster.get('name'),
           execute: cluster.get('execute'),
           workflow: cluster.get('workflow'),
+          write: cluster.get('write'),
           readonly: cluster.get('readonly'),
           staging: cluster.get('staging'),
           working: cluster.get('working'),
@@ -80,6 +81,7 @@ App.MainMirroringManageClustersController = Em.ArrayController.extend({
             name: clusterName,
             execute: '',
             workflow: '',
+            write: '',
             readonly: '',
             staging: '',
             working: '',
@@ -172,8 +174,8 @@ App.MainMirroringManageClustersController = Em.ArrayController.extend({
         '" xmlns="uri:falcon:cluster:0.1"><interfaces><interface type="readonly" endpoint="' + cluster.get('readonly') +
         '" version="2.2.0" /><interface type="execute" endpoint="' + cluster.get('execute') +
         '" version="2.2.0" /><interface type="workflow" endpoint="' + cluster.get('workflow') +
-        '" version="4.0.0" />' + '<interface type="messaging" endpoint="tcp://' + App.get('falconServerURL') +':61616?daemon=true" version="5.1.6" />' +
-        '<interface type="write" endpoint="hdfs://'+ App.get('falconServerURL') +':8020" version="2.2.0" />' +
+        '" version="4.0.0" />' + '<interface type="messaging" endpoint="tcp://' + App.get('falconServerURL') + ':61616?daemon=true" version="5.1.6" />' +
+        '<interface type="write" endpoint="' + cluster.get('write') + '" version="2.2.0" />' +
         '</interfaces><locations><location name="staging" path="' + cluster.get('staging') +
         '" /><location name="temp" path="' + cluster.get('temp') +
         '" /><location name="working" path="' + cluster.get('working') +

+ 36 - 1
ambari-web/app/controllers/main/mirroring_controller.js

@@ -209,11 +209,13 @@ App.MainMirroringController = Em.ArrayController.extend({
         });
       }, this);
     } else {
+      var defaultFS = this.loadDefaultFS();
       var sourceCluster = Ember.Object.create({
         name: App.get('clusterName'),
         execute: App.HostComponent.find().findProperty('componentName', 'RESOURCEMANAGER').get('host.hostName') + ':8050',
         readonly: 'hftp://' + App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('host.hostName') + ':50070',
         workflow: 'http://' + App.HostComponent.find().findProperty('componentName', 'OOZIE_SERVER').get('host.hostName') + ':11000/oozie',
+        write: defaultFS,
         staging: '/apps/falcon/sandbox/staging',
         working: '/apps/falcon/sandbox/working',
         temp: '/tmp'
@@ -234,6 +236,37 @@ App.MainMirroringController = Em.ArrayController.extend({
     }
   },
 
+  /**
+   * Return fs.defaultFS config property loaded from server
+   * @return {String}
+   */
+  loadDefaultFS: function () {
+    App.ajax.send({
+      name: 'config.tags.sync',
+      sender: this,
+      success: 'onLoadConfigTagsSuccess',
+      error: 'onLoadConfigTagsError'
+    });
+    var configs = App.router.get('configurationController').getConfigsByTags([
+      {
+        siteName: "core-site",
+        tagName: this.get('tag')
+      }
+    ]);
+    return configs[0].properties['fs.defaultFS'];
+  },
+
+  // Loaded core-site tag version
+  tag: null,
+
+  onLoadConfigTagsSuccess: function (data) {
+    this.set('tag', data.Clusters.desired_configs['core-site'].tag);
+  },
+
+  onLoadConfigTagsError: function () {
+    console.error('Error in loading fs.defaultFS');
+  },
+
   onLoadClustersListError: function () {
     console.error('Failed to load clusters list.');
   },
@@ -261,6 +294,7 @@ App.MainMirroringController = Em.ArrayController.extend({
           execute: interfaces.findProperty('@attributes.type', 'execute')['@attributes'].endpoint,
           readonly: interfaces.findProperty('@attributes.type', 'readonly')['@attributes'].endpoint,
           workflow: interfaces.findProperty('@attributes.type', 'workflow')['@attributes'].endpoint,
+          write: interfaces.findProperty('@attributes.type', 'write')['@attributes'].endpoint,
           staging: staging && staging['@attributes'].path,
           working: working && working['@attributes'].path,
           temp: temp && temp['@attributes'].path
@@ -278,7 +312,8 @@ App.MainMirroringController = Em.ArrayController.extend({
   },
 
   onDataLoad: function () {
-    if (this.get('isLoaded') && App.router.get('currentState.name') === 'index') {
+    // Open default dataset job route if mirroring route is opened
+    if (this.get('isLoaded') && App.router.get('currentState.parentState.name') === 'mirroring') {
       App.router.send('gotoShowJobs');
     }
   }.observes('isLoaded'),

+ 1 - 0
ambari-web/app/mappers/target_cluster_mapper.js

@@ -24,6 +24,7 @@ App.targetClusterMapper = App.QuickDataMapper.create({
     name: 'name',
     execute: 'execute',
     workflow: 'workflow',
+    write: 'write',
     readonly: 'readonly',
     staging: 'staging',
     working: 'working',

+ 1 - 0
ambari-web/app/messages.js

@@ -1852,6 +1852,7 @@ Em.I18n.translations = {
   'mirroring.manageClusters.execute':'Execute',
   'mirroring.manageClusters.readonly':'Readonly',
   'mirroring.manageClusters.workflow':'Workflow',
+  'mirroring.manageClusters.write':'Write',
   'mirroring.manageClusters.staging':'Staging',
   'mirroring.manageClusters.working':'Working',
   'mirroring.manageClusters.temp':'Temp',

+ 1 - 0
ambari-web/app/models/target_cluster.js

@@ -23,6 +23,7 @@ App.TargetCluster = DS.Model.extend({
   name: DS.attr('string'),
   execute: DS.attr('string'),
   workflow: DS.attr('string'),
+  write: DS.attr('string'),
   readonly: DS.attr('string'),
   staging: DS.attr('string'),
   working: DS.attr('string'),

+ 2 - 2
ambari-web/app/templates/main/mirroring/jobs.hbs

@@ -96,7 +96,7 @@
     </tr>
     </thead>
     <tbody>
-    {{#if controller.isLoaded}}
+    {{#if view.isLoaded}}
       {{#if view.pageContent}}
         {{#each job in view.pageContent}}
           {{#view view.JobView contentBinding="job"}}
@@ -152,7 +152,7 @@
     {{/if}}
     </tbody>
   </table>
-  {{#if controller.isLoaded}}
+  {{#if view.isLoaded}}
     <div class="page-bar">
       <div class="items-on-page">
         <label>{{t common.show}}

+ 4 - 0
ambari-web/app/templates/main/mirroring/manage_clusters.hbs

@@ -40,6 +40,10 @@
             <label class="control-label-manage-clusters">{{t mirroring.manageClusters.workflow}}</label>
             {{view Ember.TextField class="span8" valueBinding="controller.selectedCluster.workflow" disabledBinding="controller.isEditDisabled"}}
           </div>
+          <div class="control-group">
+            <label class="control-label-manage-clusters">{{t mirroring.manageClusters.write}}</label>
+            {{view Ember.TextField class="span8" valueBinding="controller.selectedCluster.write" disabledBinding="controller.isEditDisabled"}}
+          </div>
         </div>
         <div class="accordion control-group" id="advanced-fields">
           <div class="accordion-group">

+ 9 - 2
ambari-web/app/views/main/mirroring/jobs_view.js

@@ -22,9 +22,16 @@ var sort = require('views/common/sort_view');
 
 App.MainDatasetJobsView = App.TableView.extend({
   templateName: require('templates/main/mirroring/jobs'),
+
+  isLoaded: function () {
+    return App.router.get('mainMirroringController.isLoaded');
+  }.property('App.router.mainMirroringController.isLoaded'),
+
   content: function () {
-    return this.get('controller.jobs');
-  }.property('controller.jobs', 'controller.jobs.length'),
+    var datasetName = this.get('controller.content.name');
+    return (this.get('isLoaded') && datasetName) ?
+        App.Dataset.find().findProperty('name', datasetName).get('datasetJobs') : [];
+  }.property('controller.content', 'isLoaded'),
 
   dataset: function () {
     return this.get('controller.content');