Browse Source

[jb] Show kill job icon on single job page if Sentry is enabled

Look at the modify-acls
Do not show the button on the main list of applications
Romain Rigaux 11 years ago
parent
commit
361f40dffe

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

@@ -48,7 +48,7 @@ def can_modify_job(username, job):
 
 def get_acls(job):
   if job.is_mr2:
-    return dict([(acl['name'], acl['value']) for acl in job.acls])
+    return job.acls
   else:
     return job.full_job_conf
 

+ 8 - 3
apps/jobbrowser/src/jobbrowser/yarn_models.py

@@ -71,6 +71,8 @@ class Application:
     setattr(self, 'desiredReduces', None)
     setattr(self, 'durationFormatted', format_duration_in_millis(self.durationInMillis))
 
+    if not hasattr(self, 'acls'):
+      setattr(self, 'acls', {})
 
 class Job(object):
 
@@ -102,9 +104,6 @@ class Job(object):
     setattr(self, 'finishedReduces', self.reducesCompleted)
     setattr(self, 'desiredReduces', None)
 
-    if not hasattr(self, 'acls'):
-      setattr(self, 'acls', {})
-
   def kill(self):
     return self.api.kill(self.id)
 
@@ -116,6 +115,12 @@ class Job(object):
     else:
       return None
 
+  @property
+  def acls(self):
+    if not hasattr(self, '_acls'):
+      self._acls = dict([(name, self.conf_keys[name]) for name in self.conf_keys if 'acl' in name])
+    return self._acls
+
   @property
   def full_job_conf(self):
     if not hasattr(self, '_full_job_conf'):