Repository: tez Updated Branches: refs/heads/branch-0.7 01ad2a7ce -> b725d0b34
TEZ-2842. Tez UI: Update Tez App details page while in-progress (sree) (cherry picked from commit 7a1696159acfb1475114c6d5a801f661cc97eaa3) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/b725d0b3 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/b725d0b3 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/b725d0b3 Branch: refs/heads/branch-0.7 Commit: b725d0b343b909acca540d051f4d11afbb2cb0bd Parents: 01ad2a7 Author: Sreenath Somarajapuram <[email protected]> Authored: Tue Sep 22 15:05:01 2015 +0530 Committer: Sreenath Somarajapuram <[email protected]> Committed: Tue Sep 22 15:09:23 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/b725d0b3/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 0f4789c..8512758 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,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-2812. Preemption sometimes does not respect heartbeats between preemptions http://git-wip-us.apache.org/repos/asf/tez/blob/b725d0b3/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/b725d0b3/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.
