Browse Source

HUE-454. TaskTrackerNotFound error popup when viewing individual attempt

bc Wong 15 years ago
parent
commit
308916d6ab

+ 4 - 3
apps/jobbrowser/src/jobbrowser/models.py

@@ -391,9 +391,10 @@ class TaskAttempt(object):
       return tracker
     except ttypes.TaskTrackerNotFoundException, e:
       LOGGER.warn("Tracker %s not found: %s" % (self.taskTrackerId, e))
-      all_trackers = self.task.jt.all_task_trackers()
-      for t in all_trackers.trackers:
-        LOGGER.debug("Available tracker: %s" % t.trackerName)
+      if LOGGER.isEnabledFor(logging.DEBUG):
+        all_trackers = self.task.jt.all_task_trackers()
+        for t in all_trackers.trackers:
+          LOGGER.debug("Available tracker: %s" % (t.trackerName,))
       raise ttypes.TaskTrackerNotFoundException(
                           "Cannot lookup TaskTracker '%s'" % (self.taskTrackerId,))
 

+ 6 - 1
apps/jobbrowser/src/jobbrowser/views.py

@@ -31,6 +31,7 @@ from django.http import HttpResponseRedirect
 from desktop.log.access import access_warn, access_log_level
 from desktop.views import register_status_bar_view
 from hadoop.api.jobtracker.ttypes import ThriftJobPriority
+from hadoop.api.jobtracker.ttypes import TaskTrackerNotFoundException
 
 from jobbrowser.models import Job, JobLinkage, TaskList, Tracker, Cluster
 
@@ -196,7 +197,11 @@ def single_task_attempt(request, jobid, taskid, attemptid):
   except KeyError:
     raise KeyError("Cannot find attempt '%s' in task" % (attemptid,))
 
-  logs = [ section.strip() for section in attempt.get_task_log() ]
+  try:
+    logs = [ section.strip() for section in attempt.get_task_log() ]
+  except TaskTrackerNotFoundException:
+    # Three entries for stdout, stderr and syslog
+    logs = [ "Failed to retrieve log. TaskTracker not found." ] * 3
   return render("attempt.mako", request,
     {
       "attempt":attempt,