Author: eallen
Date: 2008-09-30 11:38:50 -0400 (Tue, 30 Sep 2008)
New Revision: 2554
Added:
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/parameters.py
mgmt/trunk/cumin/python/cumin/pool.py
Log:
Adding Collector tab under Pool
Added: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-09-30 15:38:50 UTC (rev 2554)
@@ -0,0 +1,72 @@
+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 *
+from job import *
+
+strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.collector")
+
+class CollectorSet(CuminTable):
+ def __init__(self, app, name):
+ super(CollectorSet, self).__init__(app, name)
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+
+ self.set_default_column(col)
+
+ def render_title(self, session):
+ return "Collectors %s" % fmt_count(Collector.select().count())
+
+ class NameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
+
+ def render_content(self, session, data):
+ sub = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame.show_collector(branch, sub).show_view(branch)
+ return fmt_olink(branch, sub, name=data["name"])
+
+class CollectorFrame(CuminFrame, JobSetFrame):
+ def __init__(self, app, name):
+ super(CollectorFrame, self).__init__(app, name)
+
+ self.object = CollectorParameter(app, "id")
+ self.add_parameter(self.object)
+
+ view = CollectorView(app, "view")
+ self.add_mode(view)
+ self.set_view_mode(view)
+
+
+class CollectorView(CuminView):
+ def __init__(self, app, name):
+ super(CollectorView, self).__init__(app, name)
+
+ status = CollectorStatus(app, "status")
+ self.add_child(status)
+
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
+
+ details = CuminDetails(app, "details")
+ self.__tabs.add_tab(details)
+
+ def render_script(self, session, sched):
+ data = "model.xml?class=scheduler;id=%i" % sched.id
+ return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" %
data
+
+class CollectorStatus(CuminStatus):
+ pass
+
Added: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-09-30 15:38:50 UTC (rev 2554)
@@ -0,0 +1,25 @@
+[CollectorSet.sql]
+select
+ c.id,
+ c.name
+from collector as c
+
+[CollectorSet.count_sql]
+select count(1) from collector
+
+[CollectorView.javascript]
+function updateCollector(data) {
+ var model = data.objectify();
+ var colls = model.collector;
+ var col;
+
+ for (var key in colls) {
+ col = colls[key];
+ break;
+ }
+
+ cumin.runModelListeners(model);
+ cumin.runObjectListeners(col);
+
+ //throw new Error();
+}
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-09-30 15:17:23 UTC (rev 2553)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-09-30 15:38:50 UTC (rev 2554)
@@ -50,6 +50,7 @@
CuminLimit(self)
CuminPool(self)
+ CuminCollector(self)
# Systems
@@ -2042,6 +2043,30 @@
return frame
+class CuminCollector(RemoteClass):
+ def __init__(self, model):
+ super(CuminCollector, self).__init__(model, "collector",
+ Collector, CollectorStats)
+
+ prop = CuminProperty(self, "Name")
+ prop.title = "Name"
+
+ prop = CuminProperty(self, "PublicNetworkIpAddr")
+ prop.title = "IP Address"
+
+ def get_title(self, session):
+ return "Collector"
+
+ def get_object_name(self, coll):
+ return coll.Name
+
+ def show_object(self, session, coll):
+ frame = self.cumin_model.show_main(session)
+ frame = frame.children_by_name["pool"]
+ frame = frame.show_collector(session, coll).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-09-30 15:17:23 UTC (rev 2553)
+++ mgmt/trunk/cumin/python/cumin/parameters.py 2008-09-30 15:38:50 UTC (rev 2554)
@@ -150,6 +150,13 @@
def do_marshal(self, sub):
return str(sub.id)
+class CollectorParameter(Parameter):
+ def do_unmarshal(self, string):
+ return Collector.get(int(string))
+
+ def do_marshal(self, coll):
+ return str(coll.id)
+
class SystemParameter(Parameter):
def do_unmarshal(self, string):
return System.get(int(string))
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-09-30 15:17:23 UTC (rev 2553)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-09-30 15:38:50 UTC (rev 2554)
@@ -14,6 +14,7 @@
from job import *
from scheduler import SchedulerSet, SchedulerFrame
from submitter import SubmitterSet, SubmitterFrame
+from collector import CollectorSet, CollectorFrame
from limits import LimitsSet, LimitsFrame
strings = StringCatalog(__file__)
@@ -87,6 +88,9 @@
self.__sub = SubmitterFrame(app, "sub")
self.add_mode(self.__sub)
+ self.__coll = CollectorFrame(app, "coll")
+ self.add_mode(self.__coll)
+
self.__jobs_hold = JobSetHold(app, "jobshold")
self.add_mode(self.__jobs_hold)
@@ -136,6 +140,11 @@
self.page.set_current_frame(session, self.__sub)
return self.show_mode(session, self.__sub)
+ def show_collector(self, session, sub):
+ self.__coll.set_object(session, sub)
+ self.page.set_current_frame(session, self.__coll)
+ return self.show_mode(session, self.__coll)
+
def show_jobs_hold(self, session):
self.page.set_current_frame(session, self.__jobs_hold)
return self.show_mode(session, self.__jobs_hold)
@@ -179,6 +188,9 @@
subs = self.SubmittersTab(app, "subs")
self.__tabs.add_tab(subs)
+ colls = self.CollectorsTab(app, "colls")
+ self.__tabs.add_tab(colls)
+
limits = self.LimitsTab(app, "limits")
self.__tabs.add_tab(limits)
@@ -188,6 +200,9 @@
class SubmittersTab(SubmitterSet):
pass
+ class CollectorsTab(CollectorSet):
+ pass
+
class LimitsTab(LimitsSet):
pass