Selaa lähdekoodia

HUE-2850 [jb] Check that Spark Jobs 1.4+ can be viewed

As reported in https://github.com/cloudera/hue/issues/219 this avoids errors due to Spark YARN jobs that are missing expected metadata attributes.
Jenny Kim 10 vuotta sitten
vanhempi
commit
5bd1b676e7

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

@@ -168,7 +168,7 @@ def massage_job_for_json(job, request):
     'durationFormatted': hasattr(job, 'durationFormatted') and job.durationFormatted or '',
     'durationMs': hasattr(job, 'durationInMillis') and job.durationInMillis or 0,
     'canKill': can_kill_job(job, request.user),
-    'killUrl': job.jobId and reverse('jobbrowser.views.kill_job', kwargs={'job': job.jobId}) or ''
+    'killUrl': job.jobId and reverse('jobbrowser.views.kill_job', kwargs={'job': job.jobId}) or '',
   }
   return job
 

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

@@ -74,6 +74,10 @@ class Application(object):
     setattr(self, 'desiredReduces', None)
     setattr(self, 'durationFormatted', format_duration_in_millis(self.durationInMillis))
 
+    for attr in ['preemptedResourceVCores', 'vcoreSeconds', 'memorySeconds', 'diagnostics']:
+      if not hasattr(self, attr):
+        setattr(self, attr, 'N/A')
+
     if not hasattr(self, 'acls'):
       setattr(self, 'acls', {})