Browse Source

HUE-710. Oozie error shows up as 500 in jobsub

bc Wong 13 years ago
parent
commit
ee5218ad29

+ 2 - 2
apps/jobsub/src/jobsub/templates/workflow.mako

@@ -192,12 +192,12 @@ ${layout.menubar(section='history')}
 
         ## Tab: Definition
         <div class="tab-pane" id="definition">
-            <pre>${workflow.definition|h}</pre>
+            <pre>${definition|h}</pre>
         </div>
 
         ## Tab: Log
         <div class="tab-pane" id="log">
-            <pre>${workflow.log|h}</pre>
+            <pre>${log|h}</pre>
         </div>
     </ul>
   </div>

+ 14 - 4
apps/jobsub/src/jobsub/views.py

@@ -35,6 +35,7 @@ from django.core import urlresolvers
 from django.shortcuts import redirect
 
 from desktop.lib.django_util import render, PopupException, extract_field_data
+from desktop.lib.rest.http_client import RestException
 from desktop.log.access import access_warn
 
 from jobsub import models, submit
@@ -48,10 +49,17 @@ LOG = logging.getLogger(__name__)
 
 def oozie_job(request, jobid):
   """View the details about this job."""
-  workflow = get_oozie().get_job(jobid)
-  _check_permission(request, workflow.user,
-                    "Access denied: view job %s" % (jobid,),
-                    allow_root=True)
+  try:
+    workflow = get_oozie().get_job(jobid)
+    _check_permission(request, workflow.user,
+                      "Access denied: view job %s" % (jobid,),
+                      allow_root=True)
+    # Accessing log and definition will trigger Oozie API calls
+    log = workflow.log
+    definition = workflow.definition
+  except RestException, ex:
+    raise PopupException("Error accessing Oozie job %s" % (jobid,),
+                         detail=ex.message)
 
   # Cross reference the submission history (if any)
   design_link = None
@@ -67,6 +75,8 @@ def oozie_job(request, jobid):
   return render('workflow.mako', request, {
     'workflow': workflow,
     'design_link': design_link,
+    'definition': definition,
+    'log': log,
   })
 
 

+ 1 - 1
desktop/core/src/desktop/lib/rest/http_client.py

@@ -168,7 +168,7 @@ class HttpClient(object):
     self.logger.debug("%s %s" % (http_method, url))
     try:
       return self._opener.open(request)
-    except urllib2.HTTPError, ex:
+    except (urllib2.HTTPError, urllib2.URLError), ex:
       raise self._exc_class(ex)
 
   def _make_url(self, path, params):

+ 1 - 1
desktop/core/src/desktop/templates/popup_error.mako

@@ -26,7 +26,7 @@ ${commonheader(title, "", "60px")}
 			<p><strong>${smart_unicode(message) | h}</strong></p>
 
 			% if detail:
-			<p>${smart_unicode(detail) or ""}</p>
+			<p>${smart_unicode(detail) or "" | h}</p>
 			% endif
 
 			<div class="alert-actions">