Author: justi9
Date: 2010-03-23 13:06:23 -0400 (Tue, 23 Mar 2010)
New Revision: 3877
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
mgmt/newdata/cumin/python/cumin/grid/pool.py
mgmt/newdata/cumin/python/cumin/grid/pool.strings
mgmt/newdata/cumin/python/cumin/grid/scheduler.py
mgmt/newdata/cumin/python/cumin/grid/scheduler.strings
mgmt/newdata/cumin/python/cumin/grid/submitter.py
mgmt/newdata/cumin/python/cumin/grid/submitter.strings
Log:
More new data integration
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-03-23 16:42:18 UTC (rev 3876)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-03-23 17:06:23 UTC (rev 3877)
@@ -1,79 +1,55 @@
-
from wooly import *
-from wooly.widgets import *
from wooly.forms import *
from wooly.resources import *
from wooly.tables import *
-from cumin.stat import *
-from cumin.widgets import *
-from cumin.parameters import *
+from wooly.widgets import *
+
from cumin.formats import *
+from cumin.model import FetchRawConfig, FetchRawConfigSet
+from cumin.objectframe import *
+from cumin.objectselector import *
+from cumin.parameters import *
+from cumin.stat import *
from cumin.util import *
+from cumin.widgets import *
-from submitter import SubmitterSet
-from cumin.model import FetchRawConfig, FetchRawConfigSet
import main
strings = StringCatalog(__file__)
-log = logging.getLogger("cumin.negotiator")
+log = logging.getLogger("cumin.grid.negotiator")
-class NegotiatorSet(CuminSelectionTable):
- def __init__(self, app, name):
- item = NegotiatorParameter(app, "item")
- super(NegotiatorSet, self).__init__(app, name, item)
+class NegotiatorSelector(ObjectSelector):
+ def __init__(self, app, name, pool):
+ cls = app.rosemary.mrg_grid.Negotiator
- col = self.NameColumn(app, "name")
- self.add_column(col)
- self.set_default_column(col)
+ super(NegotiatorSelector, self).__init__(app, name, cls)
- col = self.SystemColumn(app, "system")
- self.add_column(col)
+ self.pool = pool
- task = main.module.negotiator_set_start
- button = TaskButton(app, "start", task, self.selection)
- self.buttons.add_child(button)
+ self.add_filter(self.pool, cls.Pool, cls.Pool)
- task = main.module.negotiator_set_stop
- button = TaskButton(app, "stop", task, self.selection)
- self.buttons.add_child(button)
+ frame = "main.grid.pool.negotiator"
+ col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
+ self.add_column(col)
- def render_title(self, session):
- count = self.get_item_count(session)
- return "Negotiators %s" % fmt_count(count)
+ # self.add_attribute_column(cls.MyAddress)
+ self.add_attribute_column(cls.Machine)
+ self.add_attribute_column(cls.System)
- def render_sql_where(self, session):
- sql = "((c.qmf_update_time is not null and " + \
- "c.qmf_update_time > now() - interval '10 minutes')" +
\
- " and qmf_delete_time is null)"
- return "where %s" % sql
+ self.add_selection_task(main.module.negotiator_set_start)
+ self.add_selection_task(main.module.negotiator_set_stop)
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
+class NegotiatorFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Negotiator
- def render_content(self, session, data):
- branch = session.branch()
+ super(NegotiatorFrame, self).__init__(app, name, cls)
- neg = Identifiable(data["id"])
- self.app.model.negotiator.show_object(branch, neg)
+ # self.icon_href = "resource?name=negotiator-36.png"
- return fmt_olink(branch, neg, name=data["name"])
-
- class SystemColumn(SqlTableColumn):
- def render_title(self, session):
- return "System"
-
- def render_content(self, session, data):
- id = data["system_id"]
-
- if id:
- sys = Identifiable(id)
- href = self.page.main.inventory.system.get_href(session, sys)
- return fmt_link(href, data["system_name"])
-
-class NegotiatorFrame(CuminFrame):
+class OldNegotiatorFrame(CuminFrame):
def __init__(self, app, name):
- super(NegotiatorFrame, self).__init__(app, name)
+ super(OldNegotiatorFrame, self).__init__(app, name)
self.object = NegotiatorParameter(app, "id")
self.add_parameter(self.object)
@@ -307,9 +283,7 @@
self.negotiator = negotiator
- self.users = self.Users(app, "users")
- self.users.update_enabled = False
- self.add_child(self.users)
+ self.users = self.Users()
def get_group_names(self, session):
groups = self.groups.get(session)
@@ -405,8 +379,11 @@
def get_default(self, session):
return list()
- class Users(SubmitterSet):
+ class Users(object):
def get(self, session, groups):
+ # XXX rewrite this for the new data
+ return dict()
+
#returns {group: [user, user], group: [user, user], ...}
users = self.items.get(session)
if not users:
@@ -423,9 +400,6 @@
self.items.set(session, users)
return users
- def render_sql_limit(self, session, *args):
- return ""
-
class AddGroupForm(CuminTaskForm):
def __init__(self, app, name, task):
super(AddGroupForm, self).__init__(app, name, task)
@@ -926,4 +900,3 @@
link = TaskLink(app, "edit", task, negotiator)
self.add_child(link)
-
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-03-23 16:42:18 UTC (rev
3876)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-03-23 17:06:23 UTC (rev
3877)
@@ -1,21 +1,3 @@
-[NegotiatorSet.sql]
-select
- n.id,
- n.name,
- y.id as system_id,
- y.node_name as system_name
-from negotiator as n
-left outer join negotiator_stats as c on c.id = n.stats_curr_id
-left outer join sysimage as y on n.system = y.node_name
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[NegotiatorSet.count_sql]
-select count(1) from negotiator as n
-left outer join negotiator_stats as c on c.id = n.stats_curr_id
-{sql_where}
-
[NegotiatorOverview.css]
div.GroupTable ul.actions {
display: inline;
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-03-23 16:42:18 UTC (rev 3876)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-03-23 17:06:23 UTC (rev 3877)
@@ -1,11 +1,12 @@
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 wooly.widgets import *
+
from cumin.objectframe import *
from cumin.objectselector import *
from cumin.stat import *
@@ -14,14 +15,14 @@
from cumin.formats import *
from cumin.util import *
+from collector import *
from job import *
+from limit import *
+from negotiator import *
from scheduler import *
+from slot 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 submitter import *
from cumin.widgets import Session
@@ -59,9 +60,12 @@
self.slot = SlotFrame(app, "slot")
self.add_mode(self.slot)
- self.scheduler = SchedulerFrame(app, "scheduler")
+ self.scheduler = SchedulerFrame(app, "scheduler", self.object)
self.add_mode(self.scheduler)
+ self.negotiator = NegotiatorFrame(app, "negotiator")
+ self.add_mode(self.negotiator)
+
submissions = SubmissionSelector(app, "submissions", self.object)
self.view.add_tab(submissions)
@@ -71,6 +75,9 @@
schedulers = SchedulerSelector(app, "schedulers", self.object)
self.view.add_tab(schedulers)
+ negotiators = NegotiatorSelector(app, "negotiators", self.object)
+ self.view.add_tab(negotiators)
+
class OldPoolFrame(CuminFrame):
def __init__(self, app, name):
super(OldPoolFrame, self).__init__(app, name)
@@ -172,52 +179,6 @@
pool = self.pool.get(session)
return {"pool": pool.id}
-class PoolSchedulerSet(SchedulerSet):
- def render_sql_where(self, session):
- return "where s.pool = %(pool)s"
-
- def get_sql_values(self, session):
- pool = self.frame.object.get(session)
- return {"pool": pool.id}
-
- def render_title(self, session):
- count = self.get_item_count(session)
- return "Schedulers %s" % fmt_count(count)
-
-class PoolCollectorSet(CollectorSet):
- def __init__(self, app, name, pool):
- super(PoolCollectorSet, self).__init__(app, name)
-
- self.pool = pool
-
- def render_sql_where(self, session):
- return "where c.pool = %(pool)s"
-
- 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 "Collectors %s" % fmt_count(count)
-
-class PoolNegotiatorSet(NegotiatorSet):
- def __init__(self, app, name, pool):
- super(PoolNegotiatorSet, self).__init__(app, name)
-
- self.pool = pool
-
- def render_sql_where(self, session):
- return "where n.pool = %(pool)s"
-
- 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 "Negotiators %s" % fmt_count(count)
-
class PoolOverview(Widget):
def __init__(self, app, name, pool):
super(PoolOverview, self).__init__(app, name)
@@ -448,4 +409,3 @@
def render_content(self, session):
return self.flash_chart.render(session)
-
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.strings 2010-03-23 16:42:18 UTC (rev 3876)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.strings 2010-03-23 17:06:23 UTC (rev 3877)
@@ -1,19 +1,3 @@
-[PoolSet.sql]
-select
- p.pool as id,
- p.name,
- c.running_jobs,
- c.idle_jobs,
- c.hosts_total as slots
-from collector as p
-left outer join collector_stats as c on c.id = p.stats_curr_id
-{sql_where}
-
-[PoolSet.count_sql]
-select count(*)
-from collector as p
-{sql_where}
-
[PoolOverview.css]
div#PoolOverview div.col1, div#PoolOverview div.col2 {
float: left;
Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-03-23 16:42:18 UTC (rev 3876)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-03-23 17:06:23 UTC (rev 3877)
@@ -46,79 +46,22 @@
self.add_selection_task(main.module.scheduler_set_stop)
class SchedulerFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
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")
- super(SchedulerSet, self).__init__(app, name, item)
+ self.submitter = SubmitterFrame(app, "submitter")
+ self.add_mode(self.submitter)
- col = self.NameColumn(app, "name")
- self.add_column(col)
- self.set_default_column(col)
+ submissions = SubmissionSelector(app, "submissions", pool)
+ submissions.add_reference_filter \
+ (self.object, submissions.cls.schedulerRef)
+ self.view.add_tab(submissions)
- col = self.SystemColumn(app, "system")
- self.add_column(col)
+ submitters = SubmitterSelector(app, "submitters", self.object)
+ self.view.add_tab(submitters)
- col = self.UsersColumn(app, "users")
- col.align = "right"
- self.add_column(col)
-
- col = self.RunningJobsColumn(app, "running")
- col.align = "right"
- self.add_column(col)
-
- col = self.HeldJobsColumn(app, "held")
- col.align = "right"
- self.add_column(col)
-
- task = main.module.scheduler_set_start
- button = TaskButton(app, "start", task, self.selection)
- self.buttons.add_child(button)
-
- task = main.module.scheduler_set_stop
- button = TaskButton(app, "stop", task, self.selection)
- self.buttons.add_child(button)
-
- def render_title(self, session, *args):
- return "Schedulers %s" % fmt_count(Scheduler.select().count())
-
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
-
- def render_content(self, session, data):
- sched = Identifiable(data["id"])
- href = self.page.main.grid.pool.scheduler.get_href(session, sched)
- return fmt_link(href, data["name"])
-
- class UsersColumn(SqlTableColumn):
- def render_title(self, session):
- return "Users"
-
- class RunningJobsColumn(SqlTableColumn):
- def render_title(self, session):
- return "Running Jobs"
-
- class HeldJobsColumn(SqlTableColumn):
- def render_title(self, session):
- return "Held Jobs"
-
- class SystemColumn(SqlTableColumn):
- def render_title(self, session):
- return "System"
-
- def render_content(self, session, data):
- id = data["system_id"]
-
- if id:
- sys = Identifiable(id)
- href = self.page.main.inventory.system.get_href(session, sys)
- return fmt_link(href, data["system_name"])
-
class SchedulerSelectField(ScalarField):
def __init__(self, app, name, pool):
super(SchedulerSelectField, self).__init__(app, name, None)
@@ -226,34 +169,6 @@
def render_title(self, session):
return "Jobs"
-class SchedulerSubmissionSet(SubmissionSet):
- def __init__(self, app, name, scheduler):
- super(SchedulerSubmissionSet, self).__init__(app, name)
-
- self.scheduler = scheduler
-
- self.scheduler_col.visible = False
-
- def render_sql_where(self, session):
- return "where d.id = %(id)r"
-
- def get_sql_values(self, session):
- scheduler = self.scheduler.get(session)
- return {"id": scheduler.id}
-
-class SchedulerSubmitterSet(SubmitterSet):
- def __init__(self, app, name, scheduler):
- super(SchedulerSubmitterSet, self).__init__(app, name)
-
- self.scheduler = scheduler
-
- def render_sql_where(self, session):
- return "where d.id = %(id)r"
-
- def get_sql_values(self, session):
- scheduler = self.scheduler.get(session)
- return {"id": scheduler.id}
-
class SchedulerJobSet(JobTab):
def __init__(self, app, name, pool):
super(SchedulerJobSet, self).__init__(app, name, pool)
Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.strings 2010-03-23 16:42:18 UTC (rev
3876)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.strings 2010-03-23 17:06:23 UTC (rev
3877)
@@ -1,23 +1,3 @@
-[SchedulerSet.sql]
-select
- s.id,
- s.name,
- y.id as system_id,
- y.node_name as system_name,
- c.num_users as users,
- c.total_running_jobs as running,
- c.total_held_jobs as held
-from scheduler as s
-left outer join scheduler_stats as c on c.id = s.stats_curr_id
-left outer join sysimage as y on s.system = y.node_name
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[SchedulerSet.count_sql]
-select count(1) from scheduler as s
-{sql_where}
-
[SchedulerStats.html]
<table class="twocol">
<tbody>
Modified: mgmt/newdata/cumin/python/cumin/grid/submitter.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submitter.py 2010-03-23 16:42:18 UTC (rev 3876)
+++ mgmt/newdata/cumin/python/cumin/grid/submitter.py 2010-03-23 17:06:23 UTC (rev 3877)
@@ -16,31 +16,35 @@
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.grid.submitter")
-class SubmitterSet(CuminTable):
- def __init__(self, app, name):
- super(SubmitterSet, self).__init__(app, name)
+class SubmitterSelector(ObjectSelector):
+ def __init__(self, app, name, scheduler):
+ cls = app.rosemary.mrg_grid.Submitter
- col = self.NameColumn(app, "name")
+ super(SubmitterSelector, self).__init__(app, name, cls)
+
+ self.scheduler = scheduler
+
+ self.add_reference_filter(self.scheduler, cls.schedulerRef)
+
+ frame = "main.grid.pool.scheduler.submitter"
+ col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
- self.set_default_column(col)
+ self.add_attribute_column(cls.Machine)
+ self.add_attribute_column(cls.ScheddName)
+ self.add_attribute_column(cls.IdleJobs)
+ self.add_attribute_column(cls.RunningJobs)
+ self.add_attribute_column(cls.HeldJobs)
- def render_title(self, session):
- return "Submitters %s" % fmt_count(Submitter.select().count())
+class SubmitterFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.mrg_grid.Submitter
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
+ super(SubmitterFrame, self).__init__(app, name, cls)
- def render_content(self, session, data):
- sub = Identifiable(data["id"])
- href = self.page.main.grid.pool.scheduler.submitter.get_href \
- (session, sub)
- return fmt_link(href, data["name"])
-
-class SubmitterFrame(CuminFrame):
+class OldSubmitterFrame(CuminFrame):
def __init__(self, app, name, pool):
- super(SubmitterFrame, self).__init__(app, name)
+ super(OldSubmitterFrame, self).__init__(app, name)
self.object = SubmitterParameter(app, "id")
self.add_parameter(self.object)
Modified: mgmt/newdata/cumin/python/cumin/grid/submitter.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submitter.strings 2010-03-23 16:42:18 UTC (rev
3876)
+++ mgmt/newdata/cumin/python/cumin/grid/submitter.strings 2010-03-23 17:06:23 UTC (rev
3877)
@@ -1,18 +1,3 @@
-[SubmitterSet.sql]
-select
- s.id,
- s.name
-from submitter as s
-inner join scheduler as d on s.scheduler_id = d.id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[SubmitterSet.count_sql]
-select count(*) from submitter as s
-inner join scheduler as d on s.scheduler_id = d.id
-{sql_where}
-
[SubmitterStats.html]
<table class="twocol">
<tbody>