Browse Source

AMBARI-5668. JobsDiagnostic|2.1.1: No job status and end time is shown for interrupted job. (akovalenko)

Aleksandr Kovalenko 11 years ago
parent
commit
c2d8a9a856

+ 11 - 1
ambari-web/app/mappers/jobs/hive_job_mapper.js

@@ -47,7 +47,17 @@ App.hiveJobMapper = App.QuickDataMapper.create({
       hiveJob.id = json.entity;
       hiveJob.name = hiveJob.id;
       hiveJob.startTime = json.starttime;
-      hiveJob.endTime = json.endtime;
+      if (json.endtime == undefined) {
+        var i = 0;
+        while (hiveJob.endTime == undefined && json.events[i]) {
+          if (json.events[i].eventtype == 'QUERY_COMPLETED') {
+            hiveJob.endTime = json.events[i].timestamp;
+          };
+          i++;
+        };
+      } else {
+        hiveJob.endTime = json.endtime;
+      };
       json.otherinfo.query = $.parseJSON(json.otherinfo.query);
       if (json.otherinfo.query && json.otherinfo.query.queryText) {
         hiveJob.query_text = json.otherinfo.query.queryText;

+ 1 - 0
ambari-web/app/messages.js

@@ -1998,6 +1998,7 @@ Em.I18n.translations = {
   'jobs.customDateFilter.error.date.order':'End Date must be after Start Date',
   'jobs.customDateFilter.startTime':'Start Time',
   'jobs.customDateFilter.endTime':'End Time',
+  'jobs.hive.failed':'JOB FAILED',
   'jobs.hive.more':'show more',
   'jobs.hive.less':'show less',
   'jobs.hive.query':'Hive Query',

+ 2 - 1
ambari-web/app/models/jobs/tez_dag.js

@@ -168,7 +168,8 @@ App.TezDagVertexState = {
   FAILED : "FAILED",
   KILLED : "KILLED",
   ERROR : "ERROR",
-  TERMINATING : "TERMINATING"
+  TERMINATING : "TERMINATING",
+  JOBFAILED: "JOB FAILED"
 };
 
 App.TezDagVertexType = {

+ 15 - 3
ambari-web/app/utils/jobs.js

@@ -59,7 +59,7 @@ module.exports = {
     var hiveJobId = hiveJob.get('id');
     // First refresh query
     var hiveQueriesUrl = App.testMode ? "/data/jobs/hive-query-2.json" : "/proxy?url=http://" + historyServerHostName
-        + ":" + ahsWebPort + "/ws/v1/timeline/HIVE_QUERY_ID/" + hiveJob.get('id') + "?fields=otherinfo";
+        + ":" + ahsWebPort + "/ws/v1/timeline/HIVE_QUERY_ID/" + hiveJob.get('id') + "?fields=events,otherinfo";
     App.HttpClient.get(hiveQueriesUrl, App.hiveJobMapper, {
       complete : function(jqXHR, textStatus) {
         // Now get the Tez DAG ID from the DAG name
@@ -177,15 +177,27 @@ module.exports = {
     var yarnService = App.YARNService.find().objectAt(0);
     var ahsWebPort = yarnService.get('ahsWebPort');
     var historyServerHostName = yarnService.get('appTimelineServerNode.hostName');
+    var tezDag = App.TezDag.find(tezDagId);
+    var hiveJob = App.HiveJob.find().findProperty('tezDag', tezDag);
+    var hiveJobFailed = hiveJob.get('failed');
+    var hiveJobEndTime = hiveJob.get('endTime');
     var sender = {
       loadTezDagVertexSuccess : function(data) {
         if (data && data.otherinfo) {
           var vertexRecord = App.TezDagVertex.find(tezDagId + "/" + data.otherinfo.vertexName);
           if (vertexRecord != null) {
             vertexRecord.set('startTime', data.otherinfo.startTime);
-            vertexRecord.set('endTime', data.otherinfo.endTime);
+            if (data.otherinfo.endTime == undefined && hiveJobFailed) {
+              vertexRecord.set('endTime', hiveJobEndTime);
+            } else {
+              vertexRecord.set('endTime', data.otherinfo.endTime);
+            };
             vertexRecord.set('tasksCount', data.otherinfo.numTasks);
-            vertexRecord.set('state', data.otherinfo.status);
+            if (data.otherinfo.status == null && hiveJobFailed) {
+              vertexRecord.set('state', Em.I18n.t('jobs.hive.failed'));
+            } else {
+              vertexRecord.set('state', data.otherinfo.status);
+            };
             if (data.otherinfo.counters && data.otherinfo.counters.counterGroups) {
               data.otherinfo.counters.counterGroups.forEach(function(cGroup) {
                 var cNameToPropetyMap = {};

+ 8 - 1
ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js

@@ -868,8 +868,12 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
       }).attr('class', function(n) {
         var classes = 'vertex-icon-text ';
         if (n.state != null) {
+          if (n.state == App.TezDagVertexState.JOBFAILED) {
+            classes += App.TezDagVertexState.FAILED.toLowerCase();
+          } else {
           classes += n.state.toLowerCase();
-        }
+          };
+        };
         return classes;
       });
     }
@@ -896,6 +900,9 @@ App.MainHiveJobDetailsTezDagView = Em.View.extend({
     case App.TezDagVertexState.TERMINATING:
       icon = '\uF141'; //icon-ellipsis-horizontal
       break;
+    case App.TezDagVertexState.JOBFAILED:
+      icon = '\uF05C'; //icon-remove-circle
+      break;
     }
     return icon;
   },