Repository: tez
Updated Branches:
  refs/heads/master 0aa31af23 -> 7a1696159


TEZ-2842. Tez UI: Update Tez App details page while in-progress (sree)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/7a169615
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/7a169615
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/7a169615

Branch: refs/heads/master
Commit: 7a1696159acfb1475114c6d5a801f661cc97eaa3
Parents: 0aa31af
Author: Sreenath Somarajapuram <[email protected]>
Authored: Tue Sep 22 15:05:01 2015 +0530
Committer: Sreenath Somarajapuram <[email protected]>
Committed: Tue Sep 22 15:05:01 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../scripts/controllers/tez-app-controller.js   | 46 ++++++++++++++++++++
 .../main/webapp/app/scripts/helpers/pollster.js |  6 +++
 3 files changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/7a169615/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b4b91ac..8ae7057 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -189,6 +189,7 @@ Release 0.7.1: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES
+  TEZ-2842. Tez UI: Update Tez App details page while in-progress
   TEZ-2834. Make Tez preemption resilient to incorrect free resource reported
   by YARN
   TEZ-2775. Improve and consolidate logging in Runtime components.

http://git-wip-us.apache.org/repos/asf/tez/blob/7a169615/tez-ui/src/main/webapp/app/scripts/controllers/tez-app-controller.js
----------------------------------------------------------------------
diff --git 
a/tez-ui/src/main/webapp/app/scripts/controllers/tez-app-controller.js 
b/tez-ui/src/main/webapp/app/scripts/controllers/tez-app-controller.js
index eb1d16b..33561af 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/tez-app-controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/tez-app-controller.js
@@ -27,6 +27,52 @@ App.TezAppController = 
Em.ObjectController.extend(App.Helpers.DisplayHelper, App
     this.set('loading', false);
   }.observes('content'),
 
+  pollster: App.Helpers.Pollster.create(),
+
+  init: function () {
+    this._super();
+    this.get('pollster').setProperties({
+      onPoll: this.load.bind(this)
+    });
+  },
+
+  setup: function () {
+    this.set('isActive', true);
+  },
+  reset: function () {
+    this.set('isActive', false);
+  },
+
+  pollsterControl: function () {
+    if(this.get('appDetail.finalAppStatus') == 'UNDEFINED' &&
+        this.get('isActive')) {
+      this.get('pollster').start();
+    }
+    else {
+      this.get('pollster').stop();
+    }
+  }.observes('appDetail.finalAppStatus', 'isActive'),
+
+  load: function () {
+    var tezApp = this.get('content'),
+        store  = this.get('store');
+
+      tezApp.reload().then(function (tezApp) {
+        var appId = tezApp.get('appId');
+        if(!appId) return tezApp;
+        App.Helpers.misc.removeRecord(store, 'appDetail', appId);
+        return store.find('appDetail', appId).then(function (appDetails){
+          tezApp.set('appDetail', appDetails);
+          return tezApp;
+        });
+      }).catch(function (error) {
+        Em.Logger.error(error);
+        var err = App.Helpers.misc.formatError(error, defaultErrMsg);
+        var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+        App.Helpers.ErrorBar.getInstance().show(msg, err.details);
+      });
+  },
+
   childDisplayViews: [
     Ember.Object.create({title: 'App Details', linkTo: 'tez-app.index'}),
     Ember.Object.create({title: 'DAGs', linkTo: 'tez-app.dags'}),

http://git-wip-us.apache.org/repos/asf/tez/blob/7a169615/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js 
b/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js
index af8dd70..ee72f64 100644
--- a/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js
+++ b/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js
@@ -23,8 +23,13 @@ App.Helpers.Pollster = Ember.Object.extend({
   // Schedules the function `f` to be executed every `interval` time.
   // if runImmediate is set first run is scheduled immedietly
   schedule: function(f, runImmediete) {
+    var timer = this.get('timer');
+    if(timer) {
+      return timer;
+    }
     return Ember.run.later(this, function() {
       f.apply(this);
+      this.set('timer', null);
       this.set('timer', this.schedule(f));
     }, this.get('interval'));
   },
@@ -32,6 +37,7 @@ App.Helpers.Pollster = Ember.Object.extend({
   // Stops the pollster
   stop: function() {
     Ember.run.cancel(this.get('timer'));
+    this.set('timer', null);
   },
 
   // Starts the pollster, i.e. executes the `onPoll` function every interval.

Reply via email to