[rhmessaging-commits] rhmessaging commits: r3875 - in mgmt/newdata/cumin/python/cumin: grid and 2 other directories.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Tue Mar 23 10:18:51 EDT 2010
Author: justi9
Date: 2010-03-23 10:18:50 -0400 (Tue, 23 Mar 2010)
New Revision: 3875
Modified:
mgmt/newdata/cumin/python/cumin/grid/main.py
mgmt/newdata/cumin/python/cumin/grid/pool.py
mgmt/newdata/cumin/python/cumin/grid/scheduler.py
mgmt/newdata/cumin/python/cumin/grid/slot.py
mgmt/newdata/cumin/python/cumin/grid/slot.strings
mgmt/newdata/cumin/python/cumin/grid/submission.py
mgmt/newdata/cumin/python/cumin/inventory/system.py
mgmt/newdata/cumin/python/cumin/inventory/system.strings
mgmt/newdata/cumin/python/cumin/model.py
mgmt/newdata/cumin/python/cumin/objectframe.py
mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
Log:
Add grid ui objects, setting aside the older versions for now
Modified: mgmt/newdata/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/main.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/main.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -75,7 +75,7 @@
self.pool = PoolFrame(app, "pool")
self.add_mode(self.pool)
- self.add_sticky_view(self.pool)
+ # XXX self.add_sticky_view(self.pool)
def render_title(self, session):
return "Grid"
@@ -90,7 +90,7 @@
self.tabs = TabbedModeSet(app, "tabs")
self.add_child(self.tabs)
- self.pools = PoolSet(app, "pools")
+ self.pools = PoolSelector(app, "pools")
self.tabs.add_tab(self.pools)
class Heading(CuminHeading):
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -1,10 +1,13 @@
import logging
+
from wooly import *
from wooly.widgets import *
from wooly.forms import *
from wooly.resources import *
from wooly.sql import *
from wooly.tables import *
+from cumin.objectframe import *
+from cumin.objectselector import *
from cumin.stat import *
from cumin.widgets import *
from cumin.parameters import *
@@ -12,13 +15,13 @@
from cumin.util import *
from job import *
-from scheduler import SchedulerSet, SchedulerFrame
+from scheduler import *
from submission import *
from submitter import SubmitterSet, SubmitterFrame
from collector import CollectorSet, CollectorFrame
from negotiator import NegotiatorSet, NegotiatorFrame
from limit import LimitSet, LimitFrame
-from slot import SlotSet, SlotFrame, SlotMap, SlotMapPage, SlotActivities
+from slot import * #SlotSet, SlotFrame, SlotMap, SlotMapPage, SlotActivities
from cumin.widgets import Session
@@ -26,53 +29,51 @@
import main
strings = StringCatalog(__file__)
-
log = logging.getLogger("cumin.pool")
-class PoolSet(CuminTable):
+class PoolSelector(ObjectSelector):
def __init__(self, app, name):
- super(PoolSet, self).__init__(app, name)
+ cls = app.rosemary.mrg_grid.Collector
- col = self.NameColumn(app, "name")
- self.add_column(col)
+ super(PoolSelector, self).__init__(app, name, cls)
- col = self.JobsRunningColumn(app, "running_jobs")
+ frame = "main.grid.pool"
+ col = ObjectLinkColumn(app, "name", cls.Pool, cls._id, frame)
self.add_column(col)
- col = self.JobsIdleColumn(app, "idle_jobs")
- self.add_column(col)
+ self.add_attribute_column(cls.RunningJobs)
+ self.add_attribute_column(cls.IdleJobs)
+ self.add_attribute_column(cls.HostsTotal)
- col = self.SlotsColumn(app, "slots")
- self.add_column(col)
-
- def render_title(self, session):
- count = self.get_item_count(session)
- return "Pools %s" % fmt_count(count)
+class PoolFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Collector
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
+ super(PoolFrame, self).__init__(app, name, cls)
- def render_content(self, session, data):
- pool = Identifiable(data["id"])
- href = self.page.main.grid.pool.get_href(session, pool)
- return fmt_link(href, data["name"])
+ self.icon_href = "resource?name=pool-36.png"
- class JobsRunningColumn(SqlTableColumn):
- def render_title(self, session):
- return "Running Jobs"
+ self.submission = SubmissionFrame(app, "submission")
+ self.add_mode(self.submission)
- class JobsIdleColumn(SqlTableColumn):
- def render_title(self, session):
- return "Idle Jobs"
+ self.slot = SlotFrame(app, "slot")
+ self.add_mode(self.slot)
- class SlotsColumn(SqlTableColumn):
- def render_title(self, session):
- return "Slots"
+ self.scheduler = SchedulerFrame(app, "scheduler")
+ self.add_mode(self.scheduler)
-class PoolFrame(CuminFrame):
+ submissions = SubmissionSelector(app, "submissions", self.object)
+ self.view.add_tab(submissions)
+
+ slots = SlotSelector(app, "slots", self.object)
+ self.view.add_tab(slots)
+
+ schedulers = SchedulerSelector(app, "schedulers", self.object)
+ self.view.add_tab(schedulers)
+
+class OldPoolFrame(CuminFrame):
def __init__(self, app, name):
- super(PoolFrame, self).__init__(app, name)
+ super(OldPoolFrame, self).__init__(app, name)
self.object = PoolParameter(app, "id")
self.add_parameter(self.object)
@@ -217,37 +218,6 @@
count = self.get_item_count(session)
return "Negotiators %s" % fmt_count(count)
-class PoolSlotSet(SlotSet):
- def __init__(self, app, name, pool):
- super(PoolSlotSet, self).__init__(app, name)
-
- self.pool = pool
-
- def render_sql_where(self, session):
- elems = list()
- elems.append("s.pool = %(pool)s")
-
- recent = self.get_recent_sql_where(session)
-
- if recent:
- elems.append(recent)
-
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session):
- pool = self.pool.get(session)
- return {"pool": pool.id}
-
- def render_title(self, session):
- count = self.get_item_count(session)
- return "Slots %s" % fmt_count(count)
-
- def filter(self, session, system, slots):
- return slots
-
- def render_sql_order_by(self, session):
- return "order by machine, name asc"
-
class PoolOverview(Widget):
def __init__(self, app, name, pool):
super(PoolOverview, self).__init__(app, name)
Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -7,7 +7,8 @@
from wooly.forms import *
from wooly.resources import *
from wooly.tables import *
-
+from cumin.objectframe import *
+from cumin.objectselector import *
from cumin.formats import *
from cumin.model import *
from cumin.parameters import *
@@ -20,9 +21,36 @@
from submission import *
strings = StringCatalog(__file__)
-
log = logging.getLogger("cumin.scheduler")
+class SchedulerSelector(ObjectSelector):
+ def __init__(self, app, name, pool):
+ cls = app.rosemary.mrg_grid.Scheduler
+
+ super(SchedulerSelector, self).__init__(app, name, cls)
+
+ self.pool = pool
+
+ self.add_filter(self.pool, cls.Pool, cls.Pool)
+
+ frame = "main.grid.pool.scheduler"
+ col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
+ self.add_column(col)
+
+ self.add_attribute_column(cls.NumUsers)
+ self.add_attribute_column(cls.TotalIdleJobs)
+ self.add_attribute_column(cls.TotalRunningJobs)
+ self.add_attribute_column(cls.TotalHeldJobs)
+
+ self.add_selection_task(main.module.scheduler_set_start)
+ self.add_selection_task(main.module.scheduler_set_stop)
+
+class SchedulerFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Scheduler
+
+ super(SchedulerFrame, self).__init__(app, name, cls)
+
class SchedulerSet(CuminSelectionTable):
def __init__(self, app, name, pool):
item = SchedulerParameter(app, "item")
@@ -138,9 +166,9 @@
if item is self.param.get(session):
return "selected=\"selected\""
-class SchedulerFrame(CuminFrame):
+class OldSchedulerFrame(CuminFrame):
def __init__(self, app, name, pool):
- super(SchedulerFrame, self).__init__(app, name)
+ super(OldSchedulerFrame, self).__init__(app, name)
self.object = SchedulerParameter(app, "id")
self.add_parameter(self.object)
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -6,101 +6,50 @@
from wooly.resources import *
from wooly.tables import *
+from cumin.objectframe import *
+from cumin.objectselector import *
from cumin.stat import *
from cumin.widgets import *
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.slot")
-class SlotDataSet(CuminSqlDataSet):
- def __init__(self, app):
- super(SlotDataSet, self).__init__(app)
+class SlotSelector(ObjectSelector):
+ def __init__(self, app, name, pool):
+ cls = app.rosemary.mrg_grid.Slot
- exprs = list()
- exprs.append("s.qmf_update_time > now() - interval '60 minutes'")
+ super(SlotSelector, self).__init__(app, name, cls)
- self.where_exprs.default = exprs
+ self.pool = pool
-class SlotSet(CuminTable):
- def __init__(self, app, name):
- super(SlotSet, self).__init__(app, name)
+ self.add_filter(self.pool, cls.Pool, cls.Pool)
- col = self.NameColumn(app, "name")
+ frame = "main.grid.pool.slot"
+ col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
- col = self.ActivityColumn(app, "activity")
- self.add_column(col)
+ self.add_attribute_column(cls.Activity)
+ self.add_attribute_column(cls.State)
+ self.add_attribute_column(cls.LoadAvg)
- col = self.StateColumn(app, "state")
- self.add_column(col)
+class SlotFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Slot
- col = self.LoadAvgColumn(app, "load_avg")
- self.add_column(col)
+ super(SlotFrame, self).__init__(app, name, cls)
- col = self.JobColumn(app, "job_id")
- self.add_column(col)
+class SlotDataSet(CuminSqlDataSet):
+ def __init__(self, app):
+ super(SlotDataSet, self).__init__(app)
- def get_recent_sql_where(self, session):
- return """
- s.qmf_update_time > now() - interval '60 minutes'
- """
+ exprs = list()
+ exprs.append("s.qmf_update_time > now() - interval '60 minutes'")
- def render_title(self, session):
- count = self.get_item_count(session)
- return "Slots %s" % fmt_count(count)
+ self.where_exprs.default = exprs
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
-
- def render_content(self, session, data):
- slot = Identifiable(data["id"])
- href = self.frame.slot.get_href(session, slot)
- return fmt_link(href, data["name"])
-
- class ActivityColumn(SqlTableColumn):
- def render_title(self, session):
- return "Activity"
-
- class StateColumn(SqlTableColumn):
- def render_title(self, session):
- return "State"
-
- class LoadAvgColumn(SqlTableColumn):
- def render_title(self, session):
- return "Load"
-
- def render_value(self, session, value):
- if value:
- return "%2.02f" % value
- else:
- return fmt_none_brief()
-
- class JobColumn(SqlTableColumn):
- def render_title(self, session):
- return "Current Job"
-
- def render_content(self, session, data):
- if data[self.name]:
- job = Identifiable(data[self.name])
- pool = self.frame.get_object(session)
- scheduler = None
-
- for scheduler in Scheduler.select("pool='%s'" % pool.id):
- break
-
- if scheduler:
- href = self.page.main.grid.pool.job.get_href \
- (session, job, scheduler)
- return fmt_link(href, data[self.name])
- else:
- return fmt_none()
- else:
- return fmt_none()
-
-class SlotFrame(CuminFrame):
+class OldSlotFrame(CuminFrame):
def __init__(self, app, name):
- super(SlotFrame, self).__init__(app, name)
+ super(OldSlotFrame, self).__init__(app, name)
self.object = SlotParameter(app, "id")
self.add_parameter(self.object)
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-03-23 14:18:50 UTC (rev 3875)
@@ -23,27 +23,6 @@
from slot as s
{sql_where}
-[SlotSet.sql]
-select
- s.id,
- s.name,
- s.machine,
- s.system,
- s.job_id,
- s.activity,
- s.state,
- c.load_avg
-from slot as s
-left outer join slot_stats as c on c.id = s.stats_curr_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[SlotSet.count_sql]
-select count(*)
-from slot as s
-{sql_where}
-
[SlotStats.html]
<table class="twocol">
<tbody>
Modified: mgmt/newdata/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -1,6 +1,8 @@
import logging
import shlex
+from cumin.objectframe import *
+from cumin.objectselector import *
from cumin.widgets import *
from cumin.util import *
from job import JobSet
@@ -10,6 +12,30 @@
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.grid.submission")
+class SubmissionSelector(ObjectSelector):
+ def __init__(self, app, name, pool):
+ cls = app.rosemary.mrg_grid.Submission
+
+ super(SubmissionSelector, self).__init__(app, name, cls)
+
+ self.pool = pool
+
+ # XXX self.add_filter(self.pool, cls.Pool, cls.Pool)
+
+ frame = "main.grid.pool.submission"
+ col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
+ self.add_column(col)
+
+ self.add_attribute_column(cls.Idle)
+ self.add_attribute_column(cls.Running)
+ self.add_attribute_column(cls.Completed)
+
+class SubmissionFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Submission
+
+ super(SubmissionFrame, self).__init__(app, name, cls)
+
class SubmissionSet(CuminTable):
def __init__(self, app, name):
super(SubmissionSet, self).__init__(app, name)
@@ -84,9 +110,9 @@
def render_title(self, session):
return "Completed Jobs"
-class SubmissionFrame(CuminFrame):
+class OldSubmissionFrame(CuminFrame):
def __init__(self, app, name):
- super(SubmissionFrame, self).__init__(app, name)
+ super(OldSubmissionFrame, self).__init__(app, name)
self.object = SubmissionParameter(app, "submission")
self.add_parameter(self.object)
Modified: mgmt/newdata/cumin/python/cumin/inventory/system.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -152,7 +152,6 @@
self.add_child(self.tabs)
self.tabs.add_tab(SystemStats(app, "stats", system))
- self.tabs.add_tab(SystemSlotSet(app, "slots", system))
self.tabs.add_tab(SystemServices(app, "services", system))
self.tabs.add_tab(CuminDetails(app, "details", system))
@@ -172,32 +171,6 @@
system = self.frame.get_object(session)
return {"nodeName": system.nodeName}
-from cumin.grid.slot import SlotSet
-
-class SystemSlotSet(SlotSet):
- def __init__(self, app, name, system):
- super(SystemSlotSet, self).__init__(app, name)
-
- self.system = system
-
- def render_title(self, session):
- return "Grid Slots %s" % fmt_count(self.get_item_count(session))
-
- def render_sql_where(self, session):
- elems = list()
- elems.append("system = %(nodeName)s")
-
- recent = self.get_recent_sql_where(session)
-
- if recent:
- elems.append(recent)
-
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session):
- system = self.system.get(session)
- return {"nodeName": system.nodeName}
-
class SystemServices(ItemSet):
def __init__(self, app, name, system):
super(SystemServices, self).__init__(app, name)
Modified: mgmt/newdata/cumin/python/cumin/inventory/system.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/inventory/system.strings 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/inventory/system.strings 2010-03-23 14:18:50 UTC (rev 3875)
@@ -1,38 +1,3 @@
-[SystemSet.sql]
-select
- s.id,
- s.node_name as name,
- (s.os_name || ' ' || s.release) as kernel,
- s.machine as arch,
- c.mem_free,
- c.load_average1_min as load
-from sysimage as s
-left outer join sysimage_stats as c on c.id = s.stats_curr_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[SystemSet.count_sql]
-select count(*) from sysimage as s
-{sql_where}
-
-[SystemSet.html]
-<form id="{id}" method="post" action="?">
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
[TopSystemSet.sql]
select
s.id,
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -1821,7 +1821,7 @@
def init(self):
super(CuminLimit, self).init()
- self.frame = self.model.frame.grid.pool.limit
+ #self.frame = self.model.frame.grid.pool.limit
def get_title(self, session):
return "Concurrency Limit"
@@ -2054,7 +2054,7 @@
def init(self):
super(CuminJob, self).init()
- self.frame = self.model.frame.grid.pool.job
+ #self.frame = self.model.frame.grid.pool.job
def get_title(self, session):
return "Job"
@@ -2214,7 +2214,7 @@
def init(self):
super(CuminScheduler, self).init()
- self.frame = self.model.frame.grid.pool.scheduler
+ # self.frame = self.model.frame.grid.pool.scheduler
def get_title(self, session):
return "Scheduler"
@@ -2271,7 +2271,7 @@
def init(self):
super(CuminSubmitter, self).init()
- self.frame = self.model.frame.grid.pool.scheduler.submitter
+ #self.frame = self.model.frame.grid.pool.scheduler.submitter
def get_title(self, session):
return "Submitter"
@@ -2323,7 +2323,7 @@
def init(self):
super(CuminCollector, self).init()
- self.frame = self.model.frame.grid.pool.collector
+ #self.frame = self.model.frame.grid.pool.collector
def get_title(self, session):
return "Collector"
@@ -2374,7 +2374,7 @@
def init(self):
super(CuminNegotiator, self).init()
- self.frame = self.model.frame.grid.pool.negotiator
+ #self.frame = self.model.frame.grid.pool.negotiator
def get_title(self, session):
return "Negotiator"
Modified: mgmt/newdata/cumin/python/cumin/objectframe.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objectframe.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/objectframe.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -108,7 +108,7 @@
return name
def render_value(self, session, name, value):
- return value
+ return xml_escape(str(value))
class ObjectTaskLinks(WidgetSet):
def __init__(self, app, name, object):
Modified: mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-03-22 18:06:01 UTC (rev 3874)
+++ mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-03-23 14:18:50 UTC (rev 3875)
@@ -44,9 +44,6 @@
self.submissions = SubmissionsFrame(app, "submissions", user)
self.add_tab(self.submissions)
- self.slots = SlotsFrame(app, "slots", user)
- self.add_tab(self.slots)
-
class OverviewFrame(CuminFrame):
def __init__(self, app, name, user):
super(OverviewFrame, self).__init__(app, name)
@@ -64,9 +61,6 @@
self.stats = UserJobStatSet(self.app, "jobs", user)
self.add_child(self.stats)
- self.stats = UserSlotStatSet(self.app, "slots", user)
- self.add_child(self.stats)
-
class SubmissionsFrame(CuminFrame):
def __init__(self, app, name, user):
super(SubmissionsFrame, self).__init__(app, name)
@@ -105,32 +99,6 @@
user = self.page.user.get(session)
return {"name": user.name}
-class SlotsFrame(CuminFrame):
- def __init__(self, app, name, user):
- super(SlotsFrame, self).__init__(app, name)
-
- self.view = UserSlotSet(app, "view", user)
- self.add_mode(self.view)
-
- self.slot = SlotFrame(app, "slot")
- self.add_mode(self.slot)
-
- def render_title(self, session):
- return "Slots"
-
-class UserSlotSet(SlotSet):
- def __init__(self, app, name, user):
- super(UserSlotSet, self).__init__(app, name)
-
- self.user = user
-
- def render_sql_where(self, session):
- return "where s.remote_user like %(name)s"
-
- def get_sql_values(self, session):
- user = self.user.get(session)
- return {"name": "%s@%%" % user.name}
-
class UserJobStatSet(NewStatSet):
def __init__(self, app, name, user):
super(UserJobStatSet, self).__init__(app, name)
More information about the rhmessaging-commits
mailing list