You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/10/02 20:39:54 UTC
[43/50] [abbrv] ambari git commit: AMBARI-22096.Entries related to
hive query are found in RM UI after killing or stopping the execution of the
query.(Venkata Sairam)
AMBARI-22096.Entries related to hive query are found in RM UI after killing or stopping the execution of the query.(Venkata Sairam)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a66e2deb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a66e2deb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a66e2deb
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: a66e2deba88aeaa33af868551b31128bcc2b4ce8
Parents: 7e6910f7
Author: Venkata Sairam <ve...@gmail.com>
Authored: Sat Sep 30 18:07:30 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Sat Sep 30 18:07:30 2017 +0530
----------------------------------------------------------------------
.../resources/ui/app/routes/queries/query.js | 13 ++++++--
.../src/main/resources/ui/app/services/jobs.js | 31 ++++++++++++++++++--
2 files changed, 38 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a66e2deb/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
index 01e1497..3e5adc1 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
@@ -405,6 +405,7 @@ export default Ember.Route.extend(UILoggerMixin, {
self.get('controller.model').set('currentJobData', data);
self.get('controller.model').set('queryFile', data.job.queryFile);
self.get('controller.model').set('logFile', data.job.logFile);
+ self.get('controller').set('currentJobId', data.job.id);
self.get('controller.model').set('currentJobId', data.job.id);
ctrlrModel.set('isJobCreated',true);
ctrlr.set('isJobCreated',true);
@@ -442,9 +443,15 @@ export default Ember.Route.extend(UILoggerMixin, {
},
stopQuery(){
- let jobId = this.get('controller.model').get('currentJobId');
- this.get('jobs').stopJob(jobId)
- .then( data => this.get('controller').set('isJobCancelled', true));
+ Ember.run.later(() => {
+ let jobId = this.get('controller').get('currentJobId'), self = this, ctrlr = self.get('controller'), ctrlrModel = self.get('controller.model');
+ this.get('jobs').stopJob(jobId)
+ .then( data => {
+ this.get('controller').set('isJobCancelled', true);
+ }).catch(function (response) {
+ self.get('controller').set('isJobCancelled', true);
+ });
+ }, 1000);
},
showVisualExplain(payloadTitle){
http://git-wip-us.apache.org/repos/asf/ambari/blob/a66e2deb/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
index 36abf49..dd9db00 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
@@ -20,6 +20,7 @@ import Ember from 'ember';
export default Ember.Service.extend({
store: Ember.inject.service(),
+ isCurrentQueryCancelled: false,
getQuery(jobId) {
let job = this.get('store').peekRecord('job', jobId);
if (job) {
@@ -31,6 +32,11 @@ export default Ember.Service.extend({
return new Ember.RSVP.Promise((resolve, reject) => {
Ember.run.later(() => {
+ if(this.get('isCurrentQueryCancelled')) {
+ this.resetCurrentQueryStatus();
+ reject('error');
+ return;
+ }
this.get('store').findRecord('job', jobId, {reload: true})
.then((job) => {
let status = job.get('status').toLowerCase();
@@ -64,10 +70,29 @@ export default Ember.Service.extend({
},
stopJob : function(jobId) {
- return this.get('store').findRecord('job', jobId)
- .then(job => job.destroyRecord());
+ this.setCurrentQueryAsCancelled();
+ return new Ember.RSVP.Promise((resolve, reject) => {
+ let job = this.get('store').peekRecord('job', jobId);
+ if(job) {
+ job.destroyRecord();
+ }
+ else {
+ this.get('store').findRecord('job', jobId, { reload: true })
+ .then(job => {
+ job.deleteRecord();
+ return resolve("");
+ }).catch(function (response) {
+ return resolve("");
+ });
+ }
+ });
+ },
+ setCurrentQueryAsCancelled() {
+ this.set('isCurrentQueryCancelled', true);
+ },
+ resetCurrentQueryStatus() {
+ this.set('isCurrentQueryCancelled', false);
},
-
_fetchDummyResult(jobId) {
this.get('store').adapterFor('job').fetchResult(jobId);
},