Author: eallen
Date: 2008-10-01 08:53:01 -0400 (Wed, 01 Oct 2008)
New Revision: 2557
Added:
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.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 Negotiator tab under Pool
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-09-30 18:24:39 UTC (rev 2556)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-01 12:53:01 UTC (rev 2557)
@@ -51,6 +51,7 @@
CuminPool(self)
CuminCollector(self)
+ CuminNegotiator(self)
# Systems
@@ -2067,6 +2068,51 @@
return frame
+class CuminNegotiator(RemoteClass):
+ def __init__(self, model):
+ super(CuminNegotiator, self).__init__(model, "negotiator",
+ Negotiator, NegotiatorStats)
+
+ prop = CuminProperty(self, "Name")
+ prop.title = "Name"
+
+ prop = CuminProperty(self, "Machine")
+ prop.title = "Machine"
+
+ prop = CuminProperty(self, "MyAddress")
+ prop.title = "Address"
+
+ stat = CuminStat(self, "MonitorSelfAge")
+ stat.title = "Age"
+
+ stat = CuminStat(self, "MonitorSelfCPUUsage")
+ stat.title = "CPU Usage"
+
+ stat = CuminStat(self, "MonitorSelfImageSize")
+ stat.title = "Image Size"
+
+ stat = CuminStat(self, "MonitorSelfRegisteredSocketCount")
+ stat.title = "Registered Socket Count"
+
+ stat = CuminStat(self, "MonitorSelfResidentSetSize")
+ stat.title = "Resident Set Size"
+
+ stat = CuminStat(self, "MonitorSelfTime")
+ stat.title = "Time"
+
+ def get_title(self, session):
+ return "Negotiator"
+
+ def get_object_name(self, neg):
+ return neg.Name
+
+ def show_object(self, session, neg):
+ frame = self.cumin_model.show_main(session)
+ frame = frame.children_by_name["pool"]
+ frame = frame.show_negotiator(session, neg).show_view(session)
+
+ return frame
+
class ModelPage(Page):
def __init__(self, app, name):
super(ModelPage, self).__init__(app, name)
Added: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-10-01 12:53:01 UTC (rev 2557)
@@ -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.negotiator")
+
+class NegotiatorSet(CuminTable):
+ def __init__(self, app, name):
+ super(NegotiatorSet, self).__init__(app, name)
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+
+ self.set_default_column(col)
+
+ def render_title(self, session):
+ return "Negotiators %s" % fmt_count(Negotiator.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_negotiator(branch, sub).show_view(branch)
+ return fmt_olink(branch, sub, name=data["name"])
+
+class NegotiatorFrame(CuminFrame, JobSetFrame):
+ def __init__(self, app, name):
+ super(NegotiatorFrame, self).__init__(app, name)
+
+ self.object = NegotiatorParameter(app, "id")
+ self.add_parameter(self.object)
+
+ view = NegotiatorView(app, "view")
+ self.add_mode(view)
+ self.set_view_mode(view)
+
+
+class NegotiatorView(CuminView):
+ def __init__(self, app, name):
+ super(NegotiatorView, self).__init__(app, name)
+
+ status = NegotiatorStatus(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, coll):
+ data = "model.xml?class=negotiator;id=%i" % coll.id
+ return "wooly.setIntervalUpdate('%s', updateNegotiator, 3000)"
% data
+
+class NegotiatorStatus(CuminStatus):
+ pass
+
Added: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-10-01 12:53:01 UTC (rev 2557)
@@ -0,0 +1,25 @@
+[NegotiatorSet.sql]
+select
+ n.id,
+ n.name
+from negotiator as n
+
+[NegotiatorSet.count_sql]
+select count(1) from negotiator
+
+[NegotiatorView.javascript]
+function updateNegotiator(data) {
+ var model = data.objectify();
+ var colls = model.negotiator;
+ 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/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py 2008-09-30 18:24:39 UTC (rev 2556)
+++ mgmt/trunk/cumin/python/cumin/parameters.py 2008-10-01 12:53:01 UTC (rev 2557)
@@ -157,6 +157,13 @@
def do_marshal(self, coll):
return str(coll.id)
+class NegotiatorParameter(Parameter):
+ def do_unmarshal(self, string):
+ return Negotiator.get(int(string))
+
+ def do_marshal(self, neg):
+ return str(neg.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 18:24:39 UTC (rev 2556)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-10-01 12:53:01 UTC (rev 2557)
@@ -15,6 +15,7 @@
from scheduler import SchedulerSet, SchedulerFrame
from submitter import SubmitterSet, SubmitterFrame
from collector import CollectorSet, CollectorFrame
+from negotiator import NegotiatorSet, NegotiatorFrame
from limits import LimitsSet, LimitsFrame
strings = StringCatalog(__file__)
@@ -91,6 +92,9 @@
self.__coll = CollectorFrame(app, "coll")
self.add_mode(self.__coll)
+ self.__neg = NegotiatorFrame(app, "neg")
+ self.add_mode(self.__neg)
+
self.__jobs_hold = JobSetHold(app, "jobshold")
self.add_mode(self.__jobs_hold)
@@ -145,6 +149,11 @@
self.page.set_current_frame(session, self.__coll)
return self.show_mode(session, self.__coll)
+ def show_negotiator(self, session, sub):
+ self.__neg.set_object(session, sub)
+ self.page.set_current_frame(session, self.__neg)
+ return self.show_mode(session, self.__neg)
+
def show_jobs_hold(self, session):
self.page.set_current_frame(session, self.__jobs_hold)
return self.show_mode(session, self.__jobs_hold)
@@ -191,6 +200,9 @@
colls = self.CollectorsTab(app, "colls")
self.__tabs.add_tab(colls)
+ neg = self.NegotiatorsTab(app, "neg")
+ self.__tabs.add_tab(neg)
+
limits = self.LimitsTab(app, "limits")
self.__tabs.add_tab(limits)
@@ -203,6 +215,9 @@
class CollectorsTab(CollectorSet):
pass
+ class NegotiatorsTab(NegotiatorSet):
+ pass
+
class LimitsTab(LimitsSet):
pass