[rhmessaging-commits] rhmessaging commits: r2389 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Sep 3 12:13:28 EDT 2008


Author: eallen
Date: 2008-09-03 12:13:28 -0400 (Wed, 03 Sep 2008)
New Revision: 2389

Modified:
   mgmt/trunk/cumin/python/cumin/model.py
Log:
Implemented Justin's suggestion for AdProperties
Added a few ad properties

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2008-09-03 13:27:06 UTC (rev 2388)
+++ mgmt/trunk/cumin/python/cumin/model.py	2008-09-03 16:13:28 UTC (rev 2389)
@@ -10,8 +10,8 @@
 from util import *
 from formats import *
 from parameters import *
+from job import *
 
-
 log = getLogger("cumin.model")
 
 class CuminModel(object):
@@ -100,6 +100,19 @@
     def show_main(self, session):
         return self.app.main_page.show_main(session)
 
+class AdProperty(object):
+    def __init__(self, cls, name):
+        self.cumin_model = cls.cumin_model
+        self.cumin_class = cls
+
+        self.name = name
+        self.writable = True
+        self.example = None
+        self.renderer = None
+        self.description = None
+
+        self.cumin_class.add_ad_property(self)
+
 class CuminProperty(object):
     def __init__(self, cls, name):
         self.cumin_model = cls.cumin_model
@@ -350,6 +363,8 @@
         self.ad_properties_by_name = dict()
         self.stats = list()
         self.actions = list()
+        self.ad_properties = list()
+        self.ad_properties_by_name = dict()
 
         self.cumin_model.add_class(self)
 
@@ -361,6 +376,10 @@
         self.ad_properties.append(prop)
         self.ad_properties_by_name[prop.name] = prop
  
+    def add_ad_property(self, prop):
+        self.ad_properties.append(prop)
+        self.ad_properties_by_name[prop.name] = prop
+    
     def add_stat(self, stat):
         self.stats.append(stat)
         setattr(self, stat.name, stat)
@@ -1458,6 +1477,20 @@
         prop = AdProperty(self, "CondorVersion")
         prop.writable = False
 
+        prop = AdProperty(self, "Owner")
+        prop.writable = False
+
+        prop = AdProperty(self, "Args")
+        prop.description = "Arguments passed to job Cmd"
+
+        prop = AdProperty(self, "BufferBlockSize")
+        prop.example = "<span class=\"prop_example\">32768</span>"
+
+        prop = self.JobStatusProperty(self, "JobStatus")
+        prop.writable = False
+        prop.renderer = prop.render_status
+        prop.description = "The current job status"
+
         #prop = self.SchedulerProperty(self, "Scheduler")
         #prop.title = "Scheduler"
         #prop.summary = True
@@ -1532,6 +1565,10 @@
     def show_object(self, session, job):
         return self.cumin_model.show_main(session).show_job(session, job)
 
+    class JobStatusProperty(AdProperty):
+        def render_status(self, session, status):
+            return JobStatusInfo.get_status_string(status)            
+            
     class SubmitterProperty(CuminProperty):
         def value(self, session, job):
             value = super(CuminJob.SubmitterProperty, self).value(session, job)




More information about the rhmessaging-commits mailing list