Pārlūkot izejas kodu

HUE-1531 [jobbrowser] Avoid 500 when trying to open a log that doesn't exist yet

Showing a line on the logs that TaskTracker is not ready
Enrico Berti 12 gadi atpakaļ
vecāks
revīzija
03b66cf
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      apps/jobbrowser/src/jobbrowser/views.py

+ 4 - 0
apps/jobbrowser/src/jobbrowser/views.py

@@ -44,6 +44,8 @@ from jobbrowser import conf
 from jobbrowser.api import get_api
 from jobbrowser.models import Job, JobLinkage, Tracker, Cluster
 
+import urllib2
+
 
 def check_job_permission(view_func):
   """
@@ -357,6 +359,8 @@ def single_task_attempt_logs(request, job, taskid, attemptid):
     # Four entries,
     # for diagnostic, stdout, stderr and syslog
     logs = [_("Failed to retrieve log. TaskTracker not found.")] * 4
+  except urllib2.URLError:
+    logs = [_("Failed to retrieve log. TaskTracker not ready.")] * 4
 
   context = {
       "attempt": attempt,