You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by rb...@apache.org on 2014/12/03 03:04:08 UTC
tez git commit: TEZ-1813. display loading and other error messages in
tez-ui (Prakash Ramachandran via Rajesh Balamohan)
Repository: tez
Updated Branches:
refs/heads/TEZ-8 51a4f49cb -> 3ec89d6b9
TEZ-1813. display loading and other error messages in tez-ui (Prakash Ramachandran via Rajesh Balamohan)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/3ec89d6b
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/3ec89d6b
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/3ec89d6b
Branch: refs/heads/TEZ-8
Commit: 3ec89d6b97cc66577a7fc52870c1e99365333ab4
Parents: 51a4f49
Author: Rajesh Balamohan <rb...@hortonworks.com>
Authored: Wed Dec 3 07:33:52 2014 +0530
Committer: Rajesh Balamohan <rb...@hortonworks.com>
Committed: Wed Dec 3 07:33:52 2014 +0530
----------------------------------------------------------------------
.../scripts/controllers/dag_index_controller.js | 8 +-----
.../webapp/app/scripts/controllers/dag_tasks.js | 8 +++---
.../app/scripts/controllers/dags_controller.js | 8 +++---
.../controllers/vertex_tasks_controller.js | 6 +++--
.../src/main/webapp/app/scripts/helpers/misc.js | 16 ++++++++++++
.../app/scripts/mixins/paginated_content.js | 26 +++++++++++---------
tez-ui/src/main/webapp/app/scripts/router.js | 16 +++++++++++-
tez-ui/src/main/webapp/app/templates/error.hbs | 18 ++++++++++++++
tez-ui/src/main/webapp/app/templates/error_.hbs | 22 -----------------
9 files changed, 78 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
index 5549a84..a7eb3ea 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_index_controller.js
@@ -50,12 +50,6 @@ App.DagIndexController = Em.ObjectController.extend({
failedTasksLink: function() {
return '#tasks?status=FAILED&parentType=TEZ_DAG_ID&parentID=' + this.get('id');
- }.property(),
-
- actions: {
- showFailedTasks: function() {
- alert('not implemented');
- }
- },
+ }.property()
});
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
index f78f926..f6d2c2c 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
@@ -68,9 +68,11 @@ App.DagTasksController = Em.ObjectController.extend(App.PaginatedContentMixin, A
Em.RSVP.allSettled(pivotLoaders).then(function(){
that.set('loading', false);
});
- }).catch(function(jqXHR){
- if(console) console.log(jqXHR);
- alert('failed');
+ }).catch(function(error){
+ Em.Logger.error(error);
+ var err = App.Helpers.misc.formatError(error);
+ var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+ App.Helpers.ErrorBar.getInstance().show(msg, error.details);
});
},
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
index 7f3029c..2ded68e 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
@@ -99,9 +99,11 @@ App.DagsController = Em.ObjectController.extend(App.PaginatedContentMixin, App.C
Em.RSVP.allSettled(loaders).then(function(){
that.set('loading', false);
});
- }).catch(function(jqXHR){
- if(console) console.log(jqXHR);
- alert('failed');
+ }).catch(function(error){
+ Em.Logger.error(error);
+ var err = App.Helpers.misc.formatError(error);
+ var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+ App.Helpers.ErrorBar.getInstance().show(msg, err.details);
});
},
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
index c55715b..42f79a9 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
@@ -66,8 +66,10 @@ App.VertexTasksController = Em.ObjectController.extend(App.PaginatedContentMixin
that.set('loading', false);
});
}).catch(function(jqXHR){
- if(console) console.log(jqXHR);
- alert('failed');
+ Em.Logger.error(error);
+ var err = App.Helpers.misc.formatError(error);
+ var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+ App.Helpers.ErrorBar.getInstance().show(msg, err.details);
});
},
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
index d737549..d9c9fdd 100644
--- a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
+++ b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
@@ -129,6 +129,22 @@ App.Helpers.misc = {
return value;
},
+ /*
+ * returns a formatted message, the real cause is unknown and the error object details
+ * depends on the error cause. the function tries to handle ajax error or a native errors
+ */
+ formatError: function(error) {
+ var msg = error.statusText || error.message || '';
+ if (error.responseText) {
+ msg += error.responseText;
+ }
+ return {
+ errCode: error.status || 'Unknown',
+ msg: msg,
+ details: error.stack
+ };
+ },
+
dagStatusUIOptions: [
{ label: 'All', id: null },
{ label: 'Submitted', id: 'SUBMITTED' },
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
index 01a9f5e..66eb558 100644
--- a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
+++ b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js
@@ -45,21 +45,23 @@ App.PaginatedContentMixin = Em.Mixin.create({
return sorted.slice(0, this.count);
}.property('entities', 'numEntities'),
- loadEntities: function() {
- var that = this;
- var childEntityType = this.get('childEntityType');
+ loadEntities: function() {
+ var that = this;
+ var childEntityType = this.get('childEntityType');
that.set('loading', true);
- this.get('store').unloadAll(childEntityType);
- this.get('store').findQuery(childEntityType, this.getFilterProperties()).then(function(entities){
- that.set('entities', entities);
- that.set('loading', false);
- }).catch(function(jqXHR){
- if(console) console.log(jqXHR);
- alert('failed');
- });
- },
+ this.get('store').unloadAll(childEntityType);
+ this.get('store').findQuery(childEntityType, this.getFilterProperties()).then(function(entities){
+ that.set('entities', entities);
+ that.set('loading', false);
+ }).catch(function(jqXHR){
+ Em.Logger.error(error);
+ var err = App.Helpers.misc.formatError(error);
+ var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+ App.Helpers.ErrorBar.getInstance().show(msg, err.details);
+ });
+ },
setFiltersAndLoadEntities: function(filters) {
this._paginationFilters = filters;
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/scripts/router.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/router.js b/tez-ui/src/main/webapp/app/scripts/router.js
index a67b91f..7521e4a 100644
--- a/tez-ui/src/main/webapp/app/scripts/router.js
+++ b/tez-ui/src/main/webapp/app/scripts/router.js
@@ -51,7 +51,7 @@ App.Router.map(function() {
this.resource('taskAttempt', {path: '/task_attempt/:task_attempt_id'}, function() {
this.route('counters');
});
- //this.resource('error', {path:$ '/error'});
+ this.resource('error', {path: '/error'});
});
/* --- Router helper functions --- */
@@ -102,6 +102,20 @@ function setupControllerFactory(format) {
};
}
+App.ApplicationRoute = Em.Route.extend({
+ actions: {
+ willTransition: function(transition) {
+ App.Helpers.ErrorBar.getInstance().hide();
+ },
+ error: function(error, transition, originRoute) {
+ this.replaceWith('error');
+ Em.Logger.error(error);
+ var err = App.Helpers.misc.formatError(error);
+ var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg);
+ App.Helpers.ErrorBar.getInstance().show(msg, error.details);
+ }
+ }
+});
/* --- Dag related routes --- */
App.DagsRoute = Em.Route.extend({
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/templates/error.hbs b/tez-ui/src/main/webapp/app/templates/error.hbs
new file mode 100644
index 0000000..47e7cd5
--- /dev/null
+++ b/tez-ui/src/main/webapp/app/templates/error.hbs
@@ -0,0 +1,18 @@
+{{!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+}}
+<h1>An Error Occurred</h1>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tez/blob/3ec89d6b/tez-ui/src/main/webapp/app/templates/error_.hbs
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/templates/error_.hbs b/tez-ui/src/main/webapp/app/templates/error_.hbs
deleted file mode 100644
index 31fe3e3..0000000
--- a/tez-ui/src/main/webapp/app/templates/error_.hbs
+++ /dev/null
@@ -1,22 +0,0 @@
-{{!
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-}}
-
-<div>An error occurred while loading {{err.target}}</div>
-<div>Error was {{err.statusText}}</div>
-<div>details:<br/>{{err.responseText}}</div>
-