You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ji...@apache.org on 2017/01/11 10:34:29 UTC

eagle git commit: [EAGLE-858] JPM support task attempt info

Repository: eagle
Updated Branches:
  refs/heads/master 0d4f109fa -> 2adbbf59f


[EAGLE-858] JPM support task attempt info

In JPM job detail UI, support display attempt info of failure job.

Author: zombieJ <sm...@gmail.com>

Closes #771 from zombieJ/EAGLE-858.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/2adbbf59
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/2adbbf59
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/2adbbf59

Branch: refs/heads/master
Commit: 2adbbf59f23b7088cf60fa4e82540b4017c3693d
Parents: 0d4f109
Author: zombieJ <sm...@gmail.com>
Authored: Wed Jan 11 18:34:21 2017 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Wed Jan 11 18:34:21 2017 +0800

----------------------------------------------------------------------
 .../main/webapp/app/apps/jpm/ctrl/detailCtrl.js | 19 ++++++++
 .../app/apps/jpm/partials/job/detail.html       | 50 ++++++++++++++++++++
 .../app/dev/public/js/components/sortTable.js   |  3 +-
 .../app/dev/public/js/components/widget.js      |  8 +++-
 4 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/2adbbf59/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/detailCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/detailCtrl.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/detailCtrl.js
index be7631f..905f270 100644
--- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/detailCtrl.js
+++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/detailCtrl.js
@@ -123,6 +123,25 @@
 				$scope.endTimestamp = $scope.job.endTime;
 				$scope.isRunning = !$scope.job.currentState || ($scope.job.currentState || "").toUpperCase() === 'RUNNING';
 
+
+				// =============================== task attempt ===============================
+				if ($scope.job.currentState === 'FAILED') {
+					$scope.taskAttemptList = JPM.list('TaskAttemptErrorCategoryService', {
+						site: $scope.job.tags.site,
+						jobId: $scope.job.tags.jobId
+					},
+						Time($scope.startTimestamp).subtract(1, 'day'),
+						Time($scope.endTimestamp).add(1, 'day'));
+					$scope.taskAttemptCategories = {};
+					$scope.taskAttemptList._promise.then(function () {
+						$.each($scope.taskAttemptList, function (i, attempt) {
+							$scope.taskAttemptCategories[attempt.tags.errorCategory] =
+								($scope.taskAttemptCategories[attempt.tags.errorCategory] || 0) + 1;
+						});
+					});
+				}
+
+				// ================================ dashboards ================================
 				// Dashboard 1: Allocated MB
 				metric_allocatedMB = JPM.metrics(jobCond, "hadoop.job.allocatedmb", startTime, endTime);
 

http://git-wip-us.apache.org/repos/asf/eagle/blob/2adbbf59/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/job/detail.html
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/job/detail.html b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/job/detail.html
index fb8f7b8..359b043 100644
--- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/job/detail.html
+++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/job/detail.html
@@ -170,6 +170,56 @@
 	</div>
 </div>
 
+<!-- Task attempt -->
+<div class="box box-primary collapsed-box" ng-if="job.currentState === 'FAILED'">
+	<div class="box-header with-border">
+		<h3 class="box-title">
+			Error Task Attempts
+
+			<small>
+				(<span ng-repeat="(category, count) in taskAttemptCategories track by $index" class="text-primary">
+					<span ng-if="$index !== 0">, </span>
+					{{category}}: {{count}}
+				</span>)
+			</small>
+
+			<span ng-show="!taskAttemptList._done" class="fa fa-refresh fa-spin no-animate"></span>
+		</h3>
+		<div class="box-tools pull-right">
+			<button type="button" class="btn btn-box-tool" data-widget="collapse">
+				<i class="fa fa-plus"></i>
+			</button>
+		</div>
+	</div>
+	<div class="box-body">
+		<div sort-table="taskAttemptList" is-sorting="isSorting" class="table-responsive" max-size="7" ng-show="taskAttemptList._done">
+			<table class="table table-bordered">
+				<thead>
+				<tr>
+					<th sortpath="startTime">Start Time</th>
+					<th sortpath="endTime">End Time</th>
+					<th sortpath="tags.hostname">Host</th>
+					<th sortpath="tags.taskType">Type</th>
+					<th sortpath="tags.taskType">Attempt</th>
+					<th sortpath="tags.errorCategory">Error Category</th>
+				</tr>
+				</thead>
+				<tbody>
+				<tr ng-repeat="item in jobList">
+					<td>{{Time.format(item.startTime)}}</td>
+					<td>{{Time.format(item.endTime)}}</td>
+					<td>{{item.tags.hostname || "-"}}</td>
+					<td>{{item.tags.taskType || "-"}}</td>
+					<td>{{item.tags.taskAttemptId || "-"}}</td>
+					<td>{{item.tags.errorCategory || "-"}}</td>
+				</tr>
+				</tbody>
+			</table>
+		</div>
+	</div>
+</div>
+
+<!-- Dashboard -->
 <div class="box box-primary">
 	<div class="box-header with-border">
 		<h3 class="box-title">

http://git-wip-us.apache.org/repos/asf/eagle/blob/2adbbf59/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
index a1e91df..7a312c9 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
@@ -37,6 +37,7 @@
 			 * @param {string?} $attrs.scope			Will bind parent variable of current scope
 			 * @param {string?} $attrs.sortpath			Default sort path
 			 * @param {[]?} $attrs.searchPathList		Filter search path list
+			 * @param {string?} $attrs.maxSize			Set max display size of page
 			 */
 			controller: function($scope, $element, $attrs) {
 				var sortmatch;
@@ -49,7 +50,7 @@
 				// Initialization
 				$scope.pageNumber = 1;
 				$scope.pageSize = 10;
-				$scope.maxSize = 10;
+				$scope.maxSize = $attrs.maxSize || 10;
 				$scope.search = "";
 				$scope.orderKey = "";
 				$scope.orderAsc = true;

http://git-wip-us.apache.org/repos/asf/eagle/blob/2adbbf59/eagle-server/src/main/webapp/app/dev/public/js/components/widget.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/components/widget.js b/eagle-server/src/main/webapp/app/dev/public/js/components/widget.js
index bc59b3c..cbb4e2b 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/components/widget.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/components/widget.js
@@ -29,13 +29,19 @@
 			controller: function($scope, $element, $attrs) {
 			},
 			compile: function ($element) {
-				$element.contents().remove();
+				var $content = $element.contents().remove();
 
 				return {
 					post: function preLink($scope, $element) {
 						var widget = $scope.widget;
 						$scope.site = Site.current();
 
+						// If not set widget, skip dynamic render. (AdminLTE use `data-widget` as attr key)
+						if (!widget) {
+							$element.append($content);
+							return;
+						}
+
 						if(widget.renderFunc) {
 							// Prevent auto compile if return false
 							if(widget.renderFunc($element, $scope, $compile) !== false) {