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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Aug 28 16:08:58 EDT 2008


Author: justi9
Date: 2008-08-28 16:08:58 -0400 (Thu, 28 Aug 2008)
New Revision: 2365

Added:
   mgmt/trunk/cumin/python/cumin/scheduler.py
   mgmt/trunk/cumin/python/cumin/scheduler.strings
Modified:
   mgmt/trunk/cumin/python/cumin/model.py
   mgmt/trunk/cumin/python/cumin/parameters.py
   mgmt/trunk/cumin/python/cumin/pool.py
Log:
Add basic scheduler views and navigation

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2008-08-28 18:40:49 UTC (rev 2364)
+++ mgmt/trunk/cumin/python/cumin/model.py	2008-08-28 20:08:58 UTC (rev 2365)
@@ -21,8 +21,9 @@
 
         self.classes = list()
         self.invocations = set()
-        
-        CuminSystem(self)
+
+        # Messaging
+
         CuminBroker(self)
         CuminQueue(self)
         CuminExchange(self)
@@ -36,8 +37,17 @@
 
         CuminBrokerRegistration(self)
         CuminBrokerGroup(self)
+
+        # Grid
+
+        CuminScheduler(self)
+
         CuminPool(self)
 
+        # Systems
+
+        CuminSystem(self)
+
     def check(self):
         self.data.check()
 
@@ -1422,6 +1432,28 @@
     def show_object(self, session, pool):
         return self.cumin_model.show_main(session).show_pool(session, pool)
 
+class CuminScheduler(RemoteClass):
+    def __init__(self, model):
+        super(CuminScheduler, self).__init__(model, "scheduler",
+                                             Scheduler, SchedulerStats)
+
+    def get_title(self, session):
+        return "Scheduler"
+
+    def get_object_name(self, sched):
+        return sched.Name
+
+    def show_object(self, session, sched):
+        # XXX temporary solution
+        for pool in Pool.selectBy(name="main"):
+            break
+
+        frame = self.cumin_model.show_main(session)
+        frame = frame.show_pool(session, pool)
+        frame = frame.show_scheduler(session, sched).show_view(session)
+
+        return frame
+
 class ModelPage(Page):
     def __init__(self, app, name):
         super(ModelPage, self).__init__(app, name)

Modified: mgmt/trunk/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py	2008-08-28 18:40:49 UTC (rev 2364)
+++ mgmt/trunk/cumin/python/cumin/parameters.py	2008-08-28 20:08:58 UTC (rev 2365)
@@ -86,6 +86,13 @@
     def do_marshal(self, queue):
         return str(queue.id)
 
+class SchedulerParameter(Parameter):
+    def do_unmarshal(self, string):
+        return Scheduler.get(int(string))
+
+    def do_marshal(self, sched):
+        return str(sched.id)
+
 class SessionParameter(Parameter):
     def do_unmarshal(self, string):
         return Session.get(int(string))

Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py	2008-08-28 18:40:49 UTC (rev 2364)
+++ mgmt/trunk/cumin/python/cumin/pool.py	2008-08-28 20:08:58 UTC (rev 2365)
@@ -12,6 +12,7 @@
 from formats import *
 from util import *
 from job import JobSet
+from scheduler import SchedulerSet, SchedulerFrame
 
 strings = StringCatalog(__file__)
 log = logging.getLogger("cumin.pool")
@@ -49,9 +50,17 @@
         self.add_mode(view)
         self.set_view_mode(view)
 
+        self.__sched = SchedulerFrame(app, "sched")
+        self.add_mode(self.__sched)
+
     def show_job(self, session, job):
         return self
 
+    def show_scheduler(self, session, sched):
+        self.__sched.set_object(session, sched)
+        self.page.set_current_frame(session, self.__sched)
+        return self.show_mode(session, self.__sched)
+
 class PoolView(CuminView):
     def __init__(self, app, name):
         super(PoolView, self).__init__(app, name)
@@ -65,9 +74,15 @@
         jobs = self.JobsTab(app, "jobs")
         self.__tabs.add_tab(jobs)
 
+        scheds = self.SchedulersTab(app, "scheds")
+        self.__tabs.add_tab(scheds)
+
     class JobsTab(JobSet):
         pass
 
+    class SchedulersTab(SchedulerSet):
+        pass
+
 class PoolStatus(CuminStatus):
     pass
 

Added: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py	                        (rev 0)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py	2008-08-28 20:08:58 UTC (rev 2365)
@@ -0,0 +1,62 @@
+import logging
+
+from wooly import *
+from wooly.widgets import *
+from wooly.forms import *
+from wooly.resources import *
+from wooly.tables import *
+
+from stat import *
+from widgets import *
+from parameters import *
+from formats import *
+from util import *
+
+strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.scheduler")
+
+class SchedulerSet(CuminTable):
+    def __init__(self, app, name):
+        super(SchedulerSet, self).__init__(app, name)
+
+        col = self.NameColumn(app, "name")
+        self.add_column(col)
+
+        self.set_default_column(col)
+
+    def render_title(self, session):
+        return "Schedulers %s" % fmt_count(Scheduler.select().count())
+
+    class NameColumn(SqlTableColumn):
+        def render_title(self, session, data):
+            return "Name"
+
+        def render_content(self, session, data):
+            sched = Identifiable(data["id"])
+            branch = session.branch()
+            self.frame.show_scheduler(branch, sched).show_view(branch)
+            return fmt_olink(branch, sched, name=data["name"])
+
+class SchedulerFrame(CuminFrame):
+    def __init__(self, app, name):
+        super(SchedulerFrame, self).__init__(app, name)
+
+        self.object = SchedulerParameter(app, "id")
+        self.add_parameter(self.object)
+
+        view = SchedulerView(app, "view")
+        self.add_mode(view)
+        self.set_view_mode(view)
+
+class SchedulerView(CuminView):
+    def __init__(self, app, name):
+        super(SchedulerView, self).__init__(app, name)
+
+        status = SchedulerStatus(app, "status")
+        self.add_child(status)
+
+        self.__tabs = TabbedModeSet(app, "tabs")
+        self.add_child(self.__tabs)
+
+class SchedulerStatus(CuminStatus):
+    pass

Added: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings	                        (rev 0)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings	2008-08-28 20:08:58 UTC (rev 2365)
@@ -0,0 +1,8 @@
+[SchedulerSet.sql]
+select
+  s.id,
+  s.name
+from scheduler as s
+
+[SchedulerSet.count_sql]
+select count(*) from scheduler




More information about the rhmessaging-commits mailing list