rhmessaging commits: r4105 - in mgmt/newdata: cumin/python/cumin/grid and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-12 17:45:23 -0400 (Mon, 12 Jul 2010)
New Revision: 4105
Removed:
mgmt/newdata/cumin/python/cumin/grid/submission.strings
Modified:
mgmt/newdata/cumin/python/cumin/grid/pool.py
mgmt/newdata/cumin/python/cumin/grid/scheduler.py
mgmt/newdata/cumin/python/cumin/grid/submission.py
mgmt/newdata/cumin/python/cumin/main.py
mgmt/newdata/cumin/python/cumin/objectselector.py
mgmt/newdata/cumin/python/cumin/usergrid/model.strings
mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
mgmt/newdata/wooly/python/wooly/table.py
Log:
* Filter submissions by pool
* Add more columns to the submission selectors
* Remove unused sqlobject-based query string resource
* Repair the job stats in the grid user view
* Add a method for inserting columns into indexed locations in tables
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -78,11 +78,9 @@
overview = PoolOverview(app, "overview", self.object)
self.view.add_tab(overview)
- submissions = SubmissionSelector(app, "submissions")
+ submissions = PoolSubmissionSelector(app, "submissions", self.object)
self.view.add_tab(submissions)
- # XXX submissions.add_filter(self.object, submissions.cls.Pool)
-
slots = SlotSelector(app, "slots", self.object)
self.view.add_tab(slots)
Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -35,7 +35,7 @@
overview = SchedulerOverview(app, "overview", self.object)
self.view.add_tab(overview)
- submissions = SubmissionSelector(app, "submissions")
+ submissions = PoolSubmissionSelector(app, "submissions", pool)
self.view.add_tab(submissions)
cls = submissions.cls
Modified: mgmt/newdata/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -8,7 +8,6 @@
from cumin.util import *
from job import JobSelector, JobFrame
-strings = StringCatalog(__file__)
log = logging.getLogger("cumin.grid.submission")
class SubmissionFrame(ObjectFrame):
@@ -23,20 +22,44 @@
jobs = JobSelector(app, "jobs", self.object)
self.view.add_tab(jobs)
+class SubmissionData(ObjectSqlAdapter):
+ def __init__(self, app):
+ submission = app.model.com_redhat_grid.Submission
+ jobserver = app.model.com_redhat_grid.JobServer
+
+ super(SubmissionData, self).__init__(app, submission)
+
+ self.add_join(jobserver, submission.jobserverRef, jobserver._id)
+
class SubmissionSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_grid.Submission
+ data = SubmissionData(app)
- super(SubmissionSelector, self).__init__(app, name, cls)
+ super(SubmissionSelector, self).__init__(app, name, cls, data)
- 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)
+ self.add_attribute_column(cls.Held)
+class PoolSubmissionSelector(SubmissionSelector):
+ def __init__(self, app, name, pool):
+ super(PoolSubmissionSelector, self).__init__(app, name)
+
+ self.pool = pool
+
+ cls = app.model.com_redhat_grid.JobServer
+ self.add_filter(self.pool, cls.Pool)
+
+ frame = "main.grid.pool.submission"
+ col = ObjectLinkColumn(app, "name", self.cls.Name, self.cls._id, frame)
+ self.insert_column(1, col)
+
+ attr = self.cls.Owner
+ col = ObjectAttributeColumn(app, attr.name, attr)
+ self.insert_column(2, col)
+
class SubmissionAdd(ObjectTask):
EXPR_TYPE, INTEGER_TYPE, FLOAT_TYPE, STRING_TYPE = 0, 1, 2, 3
UNIVERSE = {"VANILLA": 5,
Deleted: mgmt/newdata/cumin/python/cumin/grid/submission.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.strings 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.strings 2010-07-12 21:45:23 UTC (rev 4105)
@@ -1,17 +0,0 @@
-[TopSubmissionSet.sql]
-select
- s.id,
- s.name,
- s.qmf_create_time,
- d.pool
-from submission as s
-join scheduler d on d.id = s.scheduler_id
-left outer join submission_stats as c on c.id = s.stats_curr_id
-where c.running > 0
- and c.qmf_update_time > now() - interval '60 seconds'
-order by s.qmf_create_time asc
-limit 5
-
-[TopSubmissionSet.count_sql]
---
-
Modified: mgmt/newdata/cumin/python/cumin/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/main.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/main.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -144,6 +144,8 @@
self.add_mode(self.main)
self.set_default_frame(self.main)
+ self.page_html_class = "Cumin"
+
def render_title(self, session):
return self.get_title(session)
@@ -348,14 +350,15 @@
self.add_column(col)
self.sort_col = cls._qmf_create_time.name
- running_col = self.adapter.table._columns_by_name["Running"]
- SqlComparisonFilter(self.adapter.query,
- running_col, "0", ">")
+ def init(self):
+ super(TopSubmissionTable, self).init()
- update_col = self.adapter.table._columns_by_name["_qmf_update_time"]
- SqlComparisonFilter(self.adapter.query,
- update_col, "now() - interval '60 seconds'", ">=")
+ table = self.cls.sql_table
+ SqlComparisonFilter(self.adapter.query, table.Running, "0", ">")
+ SqlComparisonFilter(self.adapter.query, table._qmf_update_time,
+ "now() - interval '60 seconds'", ">=")
+
class NameColumn(ObjectLinkColumn):
def render_cell_href(self, session, record):
# XXX fix this when submission has collector ref
Modified: mgmt/newdata/cumin/python/cumin/objectselector.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objectselector.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/objectselector.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -67,6 +67,8 @@
for this, that, fobj in self.filter_specs:
obj = fobj.get(session)
+ session.log("%r %r %r" % (this, obj, that))
+
values[this.name] = getattr(obj, that.name)
return values
Modified: mgmt/newdata/cumin/python/cumin/usergrid/model.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/usergrid/model.strings 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/usergrid/model.strings 2010-07-12 21:45:23 UTC (rev 4105)
@@ -1,22 +1,9 @@
[LoadUserJobStats.sql]
select
- sum(c.running + c.idle + c.removed + c.held + c.completed) as total,
- sum(c.running) as running,
- sum(c.idle) as idle,
- sum(c.removed) as removed,
- sum(c.held) as held,
- sum(c.completed) as completed
-from submission as s
-left outer join submission_stats as c on c.id = s.stats_curr_id
+ sum(s."RunningJobs") as RunningJobs,
+ sum(s."IdleJobs") as IdleJobs,
+ sum(s."HeldJobs") as held
+from "com.redhat.grid"."Submitter" as s
[xxx]
where s.submitter like '{user_name}@%'
-
-[LoadUserSlotStats.sql]
-select
- count(*) as total,
- count(case s.activity when 'Busy' then 1 end) as busy,
- count(case s.activity when 'Idle' then 1 end) as idle,
- count(case s.activity when 'Suspended' then 1 end) as suspended
-from slot as s
-where s.remote_owner like '{user_name}@%'
Modified: mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -28,6 +28,8 @@
self.add_mode(self.main)
self.set_default_frame(self.main)
+ self.page_html_class = "Cumin"
+
def render_title(self, session):
return self.get_title(session)
@@ -65,8 +67,8 @@
def __init__(self, app, name, user):
super(SubmissionsFrame, self).__init__(app, name)
- #self.view = UserSubmissionSet(app, "view", user)
- #self.add_mode(self.view)
+ self.view = UserSubmissionSelector(app, "view", user)
+ self.add_mode(self.view)
self.submission = SubmissionFrame(app, "submission")
self.add_mode(self.submission)
@@ -74,62 +76,44 @@
def render_title(self, session):
return "Submissions"
-# class UserSubmissionSet(SubmissionSet):
-# def __init__(self, app, name, user):
-# super(UserSubmissionSet, self).__init__(app, name)
+class UserSubmissionSelector(SubmissionSelector):
+ def __init__(self, app, name, user):
+ super(UserSubmissionSelector, self).__init__(app, name)
-# self.user = user
+ self.user = user
-# self.scheduler_col.visible = False
-# self.submitter_col.visible = False
+ self.user_name = UserSubmissionSelector.UserName(self, "username")
+ self.add_attribute(self.user_name)
-# task = app.grid.SubmissionAdd
-# link = TaskLink(app, "add", task, None)
-# self.links.add_child(link)
+ #self.add_filter(self.user_name, self.cls.Owner)
+
+ frame = "main.submissions.submission"
+ col = ObjectLinkColumn(app, "name", self.cls.Name, self.cls._id, frame)
+ self.insert_column(1, col)
-# def get_submission_href(self, session, id):
-# submission = Identifiable(id)
-# return self.page.main.submissions.submission.get_href \
-# (session, submission)
+ class UserName(Attribute):
+ def get(self, session):
+ user = self.widget.user.get(session)
+ return user.name
-# def render_sql_where(self, session):
-# pass # XXX return "where m.name = %(name)s"
-
-# def get_sql_values(self, session):
-# user = self.page.user.get(session)
-# return {"name": user.name}
-
class UserJobStatSet(NewStatSet):
def __init__(self, app, name, user):
super(UserJobStatSet, self).__init__(app, name)
- stat = self.TotalJobs("total")
- self.stats.append(stat)
-
stat = self.RunningJobs("running")
self.stats.append(stat)
stat = self.IdleJobs("idle")
self.stats.append(stat)
- stat = self.RemovedJobs("removed")
- self.stats.append(stat)
-
stat = self.HeldJobs("held")
self.stats.append(stat)
- stat = self.CompletedJobs("completed")
- self.stats.append(stat)
-
self.load = LoadUserJobStats(app, user)
def get_values(self, session):
return self.load.execute(session).fetchone()
- class TotalJobs(CuminStatistic):
- def get_title(self, session):
- return "Total"
-
class RunningJobs(CuminStatistic):
def get_title(self, session):
return "Running"
@@ -138,51 +122,6 @@
def get_title(self, session):
return "Idle"
- class RemovedJobs(CuminStatistic):
- def get_title(self, session):
- return "Removed"
-
class HeldJobs(CuminStatistic):
def get_title(self, session):
return "Held"
-
- class CompletedJobs(CuminStatistic):
- def get_title(self, session):
- return "Completed"
-
-class UserSlotStatSet(NewStatSet):
- def __init__(self, app, name, user):
- super(UserSlotStatSet, self).__init__(app, name)
-
- stat = self.TotalSlots("total")
- self.stats.append(stat)
-
- stat = self.BusySlots("busy")
- self.stats.append(stat)
-
- stat = self.IdleSlots("idle")
- self.stats.append(stat)
-
- stat = self.SuspendedSlots("suspended")
- self.stats.append(stat)
-
- self.load = LoadUserSlotStats(app, user)
-
- def get_values(self, session):
- return self.load.execute(session).fetchone()
-
- class TotalSlots(CuminStatistic):
- def get_title(self, session):
- return "Total"
-
- class BusySlots(CuminStatistic):
- def get_title(self, session):
- return "Busy"
-
- class IdleSlots(CuminStatistic):
- def get_title(self, session):
- return "Idle"
-
- class SuspendedSlots(CuminStatistic):
- def get_title(self, session):
- return "Suspended"
Modified: mgmt/newdata/wooly/python/wooly/table.py
===================================================================
--- mgmt/newdata/wooly/python/wooly/table.py 2010-07-12 18:05:42 UTC (rev 4104)
+++ mgmt/newdata/wooly/python/wooly/table.py 2010-07-12 21:45:23 UTC (rev 4105)
@@ -31,6 +31,11 @@
self.columns.append(column)
+ def insert_column(self, index, column):
+ self.add_child(column)
+
+ self.columns.insert(index, column)
+
def get_data(self, session):
return ()
14 years, 5 months
rhmessaging commits: r4104 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-07-12 14:05:42 -0400 (Mon, 12 Jul 2010)
New Revision: 4104
Modified:
mgmt/newdata/cumin/python/cumin/grid/job.py
Log:
Adapting the adaptor to the new schema name and location of JobSummary info
Modified: mgmt/newdata/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.py 2010-07-12 17:49:08 UTC (rev 4103)
+++ mgmt/newdata/cumin/python/cumin/grid/job.py 2010-07-12 18:05:42 UTC (rev 4104)
@@ -129,7 +129,7 @@
class JobSelector(ObjectSelector):
def __init__(self, app, name, submission):
- cls = app.model.qmf_response.GetJobSummaries
+ cls = app.model.com_redhat_cumin_grid.JobSummary
adapter = JobSummariesAdapter(app, cls)
super(JobSelector, self).__init__(app, name, cls, adapter)
14 years, 5 months
rhmessaging commits: r4103 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-12 13:49:08 -0400 (Mon, 12 Jul 2010)
New Revision: 4103
Modified:
mgmt/newdata/mint/python/mint/vacuum.py
Log:
Analyze when we vacuum; vacuum every hour
Modified: mgmt/newdata/mint/python/mint/vacuum.py
===================================================================
--- mgmt/newdata/mint/python/mint/vacuum.py 2010-07-11 23:16:10 UTC (rev 4102)
+++ mgmt/newdata/mint/python/mint/vacuum.py 2010-07-12 17:49:08 UTC (rev 4103)
@@ -12,7 +12,7 @@
up = VacuumUpdate(self.app.model)
self.app.update_thread.enqueue(up)
- sleep(60 * 60 * 10)
+ sleep(60 * 60)
class VacuumUpdate(Update):
def do_process(self, cursor, stats):
@@ -35,7 +35,7 @@
log.info("Vacuumed tables")
def vacuum(self, cursor, cls):
- sql = "vacuum verbose %s"
+ sql = "vacuum analyze verbose %s"
cursor.execute(sql % cls.sql_table.identifier)
cursor.execute(sql % cls.sql_samples_table.identifier)
14 years, 5 months
rhmessaging commits: r4102 - in mgmt/newdata/cumin: python/cumin/messaging and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-11 19:16:10 -0400 (Sun, 11 Jul 2010)
New Revision: 4102
Modified:
mgmt/newdata/cumin/model/rosemary.xml
mgmt/newdata/cumin/python/cumin/messaging/binding.py
mgmt/newdata/cumin/python/cumin/messaging/broker.py
mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
mgmt/newdata/cumin/python/cumin/messaging/connection.py
mgmt/newdata/cumin/python/cumin/messaging/exchange.py
mgmt/newdata/cumin/python/cumin/messaging/queue.py
Log:
Reorganize the broker plumbing around vhosts. This makes things
easier, and it gives us a name attribute to use.
Modified: mgmt/newdata/cumin/model/rosemary.xml
===================================================================
--- mgmt/newdata/cumin/model/rosemary.xml 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/model/rosemary.xml 2010-07-11 23:16:10 UTC (rev 4102)
@@ -37,17 +37,9 @@
<class name="Broker">
<object>
- <title>host:%(port)s</title>
+ <title>%(name)s</title>
</object>
- <property name="port">
- <title>Port</title>
- </property>
-
- <property name="workerThreads">
- <title>Worker Threads</title>
- </property>
-
<property name="maxConns">
<title>Max Connections</title>
</property>
@@ -56,24 +48,10 @@
<title>Connection Backlog</title>
</property>
- <property name="stagingThreshold">
- <title>Staging Threshold</title>
- </property>
-
<property name="mgmtPubInterval">
<title>QMF Publish Interval</title>
</property>
- <!--
- <property name="clusterName">
- <title>Cluster Name</title>
- </property>
- -->
-
- <property name="version">
- <title>Version</title>
- </property>
-
<property name="dataDir">
<title>Data Directory</title>
</property>
@@ -183,6 +161,10 @@
<title>Host</title>
</property>
</class>
+
+ <class name="Vhost">
+ <title>Broker</title>
+ </class>
</package>
<package name="org.apache.qpid.cluster">
Modified: mgmt/newdata/cumin/python/cumin/messaging/binding.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -31,7 +31,7 @@
invoc.end()
class BindingFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, vhost):
cls = app.model.org_apache_qpid_broker.Binding
super(BindingFrame, self).__init__(app, name, cls)
Modified: mgmt/newdata/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/broker.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/broker.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -23,13 +23,15 @@
class BrokerData(ObjectSqlAdapter):
def __init__(self, app):
+ vhost = app.model.org_apache_qpid_broker.Vhost
broker = app.model.org_apache_qpid_broker.Broker
system = app.model.org_apache_qpid_broker.System
cluster = app.model.org_apache_qpid_cluster.Cluster
mapping = app.model.com_redhat_cumin.BrokerGroupMapping
- super(BrokerData, self).__init__(app, broker)
+ super(BrokerData, self).__init__(app, vhost)
+ self.add_join(broker, vhost.brokerRef, broker._id)
self.add_join(system, broker.systemRef, system._id)
self.add_outer_join(cluster, broker._id, cluster.brokerRef)
@@ -53,6 +55,9 @@
class BrokerSelector(ObjectSelector):
def __init__(self, app, name, data):
+ # Actually a vhost selector, as it happens
+
+ vhost = app.model.org_apache_qpid_broker.Vhost
broker = app.model.org_apache_qpid_broker.Broker
system = app.model.org_apache_qpid_broker.System
cluster = app.model.org_apache_qpid_cluster.Cluster
@@ -64,9 +69,10 @@
self.group = SessionAttribute(self, "group")
frame = "main.messaging.broker"
- col = ObjectLinkColumn(app, "name", system.nodeName, broker._id, frame)
+ col = ObjectLinkColumn(app, "name", vhost.name, vhost._id, frame)
self.add_column(col)
+ self.add_attribute_column(system.nodeName)
self.add_attribute_column(broker.port)
self.add_attribute_column(cluster.clusterName)
@@ -92,7 +98,7 @@
class BrokerFrame(ObjectFrame):
def __init__(self, app, name):
- cls = app.model.org_apache_qpid_broker.Broker
+ cls = app.model.org_apache_qpid_broker.Vhost
super(BrokerFrame, self).__init__(app, name, cls)
@@ -100,23 +106,23 @@
self.broker = SessionAttribute(self, "broker")
- self.queue = QueueFrame(app, "queue") # XXX pass self.vhost
+ self.queue = QueueFrame(app, "queue", self.object)
self.add_mode(self.queue)
- self.exchange = ExchangeFrame(app, "exchange")
+ self.exchange = ExchangeFrame(app, "exchange", self.object)
self.add_mode(self.exchange)
- self.binding = BindingFrame(app, "binding")
+ self.binding = BindingFrame(app, "binding", self.object)
self.add_mode(self.binding)
- self.connection = ConnectionFrame(app, "connection")
+ self.connection = ConnectionFrame(app, "connection", self.object)
self.add_mode(self.connection)
- self.brokerlink = BrokerLinkFrame(app, "link")
+ self.brokerlink = BrokerLinkFrame(app, "link", self.broker)
self.add_mode(self.brokerlink)
- self.view = ObjectView(app, "view", self.broker)
- self.replace_child(self.view)
+ # self.view = ObjectView(app, "view", self.broker)
+ # self.replace_child(self.view)
self.view.add_tab(QueueSelector(app, "queues", self.object))
self.view.add_tab(ExchangeSelector(app, "exchanges", self.object))
@@ -130,26 +136,18 @@
self.engroup = BrokerEngroup(app, self)
#self.add_selection_task(app.messaging.BrokerEngroup)
+ def do_process(self, session):
+ super(BrokerFrame, self).do_process(session)
- def get_object(self, session, id):
- # self.object is Vhost, and we stick Broker in self.broker
+ vhost = self.object.get(session)
- broker = super(BrokerFrame, self).get_object(session, id)
+ cls = self.app.model.org_apache_qpid_broker.Broker
+ obj = cls.get_object(session.cursor, _id=vhost._brokerRef_id)
- self.broker.set(session, broker)
+ assert obj
- cls = self.app.model.org_apache_qpid_broker.Vhost
- args = {"_brokerRef_id": id, "name": "/"}
+ self.broker.set(session, obj)
- for obj in cls.get_selection(session.cursor, **args):
- break
-
- return obj
-
- def get_title(self, session):
- obj = self.broker.get(session)
- return "%s '%s'" % (obj._class._title, obj.get_title())
-
class ModuleNotEnabled(Widget):
def do_render(self, session):
return "This module is not enabled"
Modified: mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -19,7 +19,7 @@
strings = StringCatalog(__file__)
class BrokerLinkFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, broker):
cls = app.model.org_apache_qpid_broker.Link
super(BrokerLinkFrame, self).__init__(app, name, cls)
Modified: mgmt/newdata/cumin/python/cumin/messaging/connection.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/connection.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/connection.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -16,7 +16,7 @@
strings = StringCatalog(__file__)
class ConnectionFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, vhost):
cls = app.model.org_apache_qpid_broker.Connection
super(ConnectionFrame, self).__init__(app, name, cls)
Modified: mgmt/newdata/cumin/python/cumin/messaging/exchange.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/exchange.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/exchange.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -19,7 +19,7 @@
log = logging.getLogger("cumin.messaging.exchange")
class ExchangeFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, vhost):
cls = app.model.org_apache_qpid_broker.Exchange
super(ExchangeFrame, self).__init__(app, name, cls)
Modified: mgmt/newdata/cumin/python/cumin/messaging/queue.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/queue.py 2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/queue.py 2010-07-11 23:16:10 UTC (rev 4102)
@@ -22,7 +22,7 @@
log = logging.getLogger("cumin.messaging.queue")
class QueueFrame(ObjectFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, vhost):
cls = app.model.org_apache_qpid_broker.Queue
super(QueueFrame, self).__init__(app, name, cls)
14 years, 5 months
rhmessaging commits: r4101 - mgmt/newdata/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-11 18:10:39 -0400 (Sun, 11 Jul 2010)
New Revision: 4101
Modified:
mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
Log:
Replace sqlobject based navigation
Modified: mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py 2010-07-11 21:47:39 UTC (rev 4100)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py 2010-07-11 22:10:39 UTC (rev 4101)
@@ -340,14 +340,25 @@
def do_invoke(self, invoc, vhost, host, port, durable, username,
password, transport):
- broker = vhost.broker # XXX
+ # XXX ugh. need to pass session into do_invoke instead of
+ # this
+ cls = self.app.model.org_apache_qpid_broker.Broker
+
+ conn = self.app.database.get_connection()
+ cursor = conn.cursor()
+
+ try:
+ obj = cls.get_object(cursor, _id=vhost._brokerRef_id)
+ finally:
+ conn.close()
+
if username == "anonymous":
mech = "ANONYMOUS"
else:
mech = "PLAIN"
- self.qmf_call(invoc, broker, "connect",
+ self.qmf_call(invoc, obj, "connect",
host, port, durable, mech, username, password, transport)
class BrokerLinkAddForm(ObjectTaskForm):
14 years, 5 months
rhmessaging commits: r4100 - mgmt/newdata/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-11 17:47:39 -0400 (Sun, 11 Jul 2010)
New Revision: 4100
Modified:
mgmt/newdata/cumin/python/cumin/model.py
Log:
Fix formatting of floats
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-07-11 21:32:54 UTC (rev 4099)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-07-11 21:47:39 UTC (rev 4100)
@@ -555,7 +555,7 @@
class CuminStatistic(object):
formatters = {
NoneType: lambda x: fmt_none(),
- float: lambda x: "%0.2d" % x,
+ float: lambda x: "%0.2f" % x,
Decimal: lambda x: str(x),
int: lambda x: "%i" % x
}
14 years, 5 months
rhmessaging commits: r4099 - mgmt/newdata/cumin/model.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-11 17:32:54 -0400 (Sun, 11 Jul 2010)
New Revision: 4099
Modified:
mgmt/newdata/cumin/model/rosemary.xml
Log:
Set the object title for Connections
Modified: mgmt/newdata/cumin/model/rosemary.xml
===================================================================
--- mgmt/newdata/cumin/model/rosemary.xml 2010-07-11 20:58:49 UTC (rev 4098)
+++ mgmt/newdata/cumin/model/rosemary.xml 2010-07-11 21:32:54 UTC (rev 4099)
@@ -80,6 +80,10 @@
</class>
<class name="Connection">
+ <object>
+ <title>%(address)s</title>
+ </object>
+
<property name="remotePid">
<title>Process ID</title>
<!-- value -->
14 years, 5 months
rhmessaging commits: r4098 - in mgmt/newdata: mint/python/mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-11 16:58:49 -0400 (Sun, 11 Jul 2010)
New Revision: 4098
Modified:
mgmt/newdata/cumin/model/cumin.xml
mgmt/newdata/cumin/model/qmf.xml
mgmt/newdata/mint/python/mint/expire.py
mgmt/newdata/mint/python/mint/update.py
mgmt/newdata/mint/python/mint/vacuum.py
mgmt/newdata/rosemary/python/rosemary/model.py
Log:
* Add support in rosemary for multiple Packages in one schema file
* Add a storage parameter to Class; this is meant to replace the
transient flag and to support future in-memory storage alternatives
* Add a proposed replacement for the GetJobSummaries class to
cumin.xml: com.redhat.cumin.grid.JobSummary; it's just a rename and
a relocation
Modified: mgmt/newdata/cumin/model/cumin.xml
===================================================================
--- mgmt/newdata/cumin/model/cumin.xml 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/cumin/model/cumin.xml 2010-07-11 20:58:49 UTC (rev 4098)
@@ -1,25 +1,41 @@
-<schema package="com.redhat.cumin">
- <class name="BrokerGroup">
- <property name="name" type="sstr"/>
- <property name="description" type="lstr" optional="y"/>
- </class>
+<model>
+ <package name="com.redhat.cumin">
+ <class name="BrokerGroup">
+ <property name="name" type="sstr"/>
+ <property name="description" type="lstr" optional="y"/>
+ </class>
- <class name="BrokerGroupMapping">
- <property name="broker" type="objId" references="org.apache.qpid.broker:Broker"/>
- <property name="group" type="objId" references="BrokerGroup"/>
- </class>
+ <class name="BrokerGroupMapping">
+ <property name="broker" type="objId" references="org.apache.qpid.broker:Broker"/>
+ <property name="group" type="objId" references="BrokerGroup"/>
+ </class>
- <class name="User">
- <property name="name" type="sstr" index="y"/>
- <property name="password" type="sstr" index="y"/>
- </class>
+ <class name="User">
+ <property name="name" type="sstr" index="y"/>
+ <property name="password" type="sstr" index="y"/>
+ </class>
- <class name="Role">
- <property name="name" type="sstr" index="y"/>
- </class>
+ <class name="Role">
+ <property name="name" type="sstr" index="y"/>
+ </class>
- <class name="UserRoleMapping">
- <property name="user" references="User" index="y"/>
- <property name="role" references="Role" index="y"/>
- </class>
-</schema>
+ <class name="UserRoleMapping">
+ <property name="user" references="User" index="y"/>
+ <property name="role" references="Role" index="y"/>
+ </class>
+ </package>
+
+ <package name="com.redhat.cumin.grid">
+ <class name="JobSummary" storage="none">
+ <property name="ProcId" type="sstr"/>
+ <property name="Args" type="sstr"/>
+ <property name="QDate" type="absTime"/>
+ <property name="Cmd" type="sstr"/>
+ <property name="ClusterId" type="sstr"/>
+ <property name="JobStatus" type="sstr"/>
+ <property name="EnteredCurrentStatus" type="absTime"/>
+ <property name="GlobalJobId" type="sstr"/>
+ <property name="JobId" type="sstr"/>
+ </class>
+ </package>
+</model>
Modified: mgmt/newdata/cumin/model/qmf.xml
===================================================================
--- mgmt/newdata/cumin/model/qmf.xml 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/cumin/model/qmf.xml 2010-07-11 20:58:49 UTC (rev 4098)
@@ -1,5 +1,5 @@
<schema package="qmf.response" type="transient">
- <class name="GetJobSummaries">
+ <class name="GetJobSummaries" storage="none">
<property name="ProcId" type="sstr"/>
<property name="Args" type="sstr"/>
<property name="QDate" type="absTime"/>
@@ -10,5 +10,4 @@
<property name="GlobalJobId" type="sstr"/>
<property name="JobId" type="sstr"/>
</class>
-
</schema>
Modified: mgmt/newdata/mint/python/mint/expire.py
===================================================================
--- mgmt/newdata/mint/python/mint/expire.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/expire.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -41,10 +41,12 @@
count = 0
for pkg in self.model._packages:
- if pkg.sql_schema.type != "transient":
- for cls in pkg._classes:
- count += self.delete_samples(cursor, cls, seconds)
+ for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+ count += self.delete_samples(cursor, cls, seconds)
+
log.info("Expired %i samples", count)
def delete_samples(self, cursor, cls, seconds):
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/update.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -480,6 +480,9 @@
for pkg in self.model._packages:
for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+
for obj in cls.get_selection(cursor, _qmf_agent_id=id):
obj.delete(cursor)
Modified: mgmt/newdata/mint/python/mint/vacuum.py
===================================================================
--- mgmt/newdata/mint/python/mint/vacuum.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/vacuum.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -24,10 +24,12 @@
conn.set_isolation_level(0)
for pkg in self.model._packages:
- if pkg.sql_schema.type != "transient":
- for cls in pkg._classes:
- self.vacuum(cursor, cls)
+ for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+ self.vacuum(cursor, cls)
+
conn.set_isolation_level(level)
log.info("Vacuumed tables")
Modified: mgmt/newdata/rosemary/python/rosemary/model.py
===================================================================
--- mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -55,11 +55,17 @@
finally:
file.close()
- # XXX Change to load_elem, load_extended_elem
def load(self, elem):
- pkg = RosemaryPackage(self, elem.get("package"), elem.get("type"))
- pkg.load(elem)
+ attr = elem.get("package")
+ if attr:
+ pkg = RosemaryPackage(self, attr, elem.get("type"))
+ pkg.load(elem)
+
+ for child in elem.findall("package"):
+ pkg = RosemaryPackage(self, child.get("name"), None)
+ pkg.load(child)
+
def extend(self, elem):
for child in elem.findall("package"):
pkg = self._packages_by_name[child.get("name")]
@@ -80,7 +86,7 @@
mangled = self._name.replace(".", "_")
if hasattr(self._model, mangled):
- raise Exception("Collision")
+ raise Exception("Collision: %s" % mangled)
setattr(self._model, mangled, self)
@@ -130,6 +136,8 @@
setattr(self._package, self._name, self)
+ self._storage = "database"
+
self._title = None
self._object_title = None
@@ -239,6 +247,10 @@
def load(self, elem, groups_by_name):
log.debug("Loading %s", self)
+ self._storage = elem.get("storage", "database")
+
+ assert self._storage in ("database", "none")
+
for child in elem.findall("group"):
name = child.get("name")
14 years, 5 months
rhmessaging commits: r4097 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-07-09 16:56:48 -0400 (Fri, 09 Jul 2010)
New Revision: 4097
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
Log:
Make the + and - on negotiator groups a button
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-09 20:15:59 UTC (rev 4096)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-09 20:56:48 UTC (rev 4097)
@@ -219,8 +219,9 @@
self.expand.set(branch, next_expand)
hover = state == "-" and "Collapse" or "Expand"
+ cls = "action"
- return fmt_link(branch.marshal(), state, link_title=hover)
+ return fmt_link(branch.marshal(), state, class_=cls, link_title=hover)
class GroupColumn(ItemTableColumn):
def render_title(self, session, *args):
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-07-09 20:15:59 UTC (rev 4096)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-07-09 20:56:48 UTC (rev 4097)
@@ -10,6 +10,12 @@
th.ExpandColumn {
width: 2em;
}
+td.ExpandColumn a.action {
+ width: 1em;
+ display: block;
+ text-align: center;
+}
+
th.GroupColumn {
width: 50%;
}
14 years, 5 months
rhmessaging commits: r4096 - in mgmt/newdata/cumin/python/cumin: grid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-07-09 16:15:59 -0400 (Fri, 09 Jul 2010)
New Revision: 4096
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
mgmt/newdata/cumin/python/cumin/model.py
Log:
Rework negotiator configs to better handle hundreds of groups/users
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-09 15:39:44 UTC (rev 4095)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-09 20:15:59 UTC (rev 4096)
@@ -25,14 +25,15 @@
super(NegotiatorFrame, self).__init__(app, name, cls)
self.group_add = NegotiatorGroupAdd(app, self)
-
self.edit_dynamic_quota = NegotiatorEditDynamicQuota(app, self)
+ """
self.edit_static_quota = NegotiatorEditStaticQuota(app, self)
self.edit_prio_factor = NegotiatorEditPrioFactor(app, self)
self.edit_regroup = NegotiatorEditRegroup(app, self)
self.user_prio_factor = NegotiatorUserPrioFactor(app, self)
self.user_regroup = NegotiatorUserRegroup(app, self)
-
+ """
+
overview = NegotiatorOverview(app, "overview", self.object, self)
self.view.add_tab(overview)
@@ -64,7 +65,7 @@
self.title = None
self.getter = getter
- self.align = "right"
+ #self.align = "right"
self.user = False
self.negotiator = negotiator
self.task = task
@@ -79,21 +80,10 @@
if x[0] == group:
return self.render_data(session, x)
- if self.user:
- data = self.getter(session, [group], True)
- for x in data:
- if x[0] == group:
- return self.render_data(session, x)
-
return ""
def render_data(self, session, data):
- # is user
- if "." in data[0] and self.user_task:
- href = "%s" % self.user_task.get_href \
- (session, (self.negotiator.get(session)))
- else:
- href = self.task.get_href(session)
+ href = self.task.get_href(session)
content = data[2][2] and str(data[1]) or "NOT SET"
return fmt_link(href, content, "", "", self.fmt_hover(data[0]))
@@ -110,19 +100,12 @@
self.group_helper = GroupHelper(app, "groups", negotiator)
self.add_child(self.group_helper)
- self.expand = self.ExpandSwitch(app, "expand")
- self.add_child(self.expand)
+ self.expand = Parameter(app, "expand")
+ self.add_parameter(self.expand)
- self.buttons = WidgetSet(app, "buttons")
- self.buttons.html_class = "buttons"
- self.add_child(self.buttons)
-
- task = frame.group_add
- button = EditButton(app, "add_group_button", task, negotiator)
- self.buttons.add_child(button)
-
- col = self.ExpandColumn(app, "expand_col")
+ col = self.ExpandColumn(app, "expand_col", self.expand)
col.header_class = ItemTableColumnHeader
+ col.width = "20px"
self.add_column(col)
col = self.GroupColumn(app, "group")
@@ -130,10 +113,11 @@
self.set_default_column(col)
task = frame.edit_dynamic_quota
- col = self.DynamicColumn(app, "dynamic", self.group_helper.get_dyn_quota, negotiator, task)
+ col = self.DynamicColumn(app, "dynamic", None, negotiator, task)
col.title = "Dynamic Quota"
self.add_column(col)
+ """
task = frame.edit_static_quota
col = QmfGroupColumn(app, "static", self.group_helper.get_static_quota, negotiator, task)
col.title = "Static Quota"
@@ -152,7 +136,8 @@
col.user = True
col.user_task = frame.user_regroup
self.add_column(col)
-
+ """
+
def render_title(self, session):
return "Group Configuration"
@@ -163,30 +148,49 @@
return "Loading..."
def do_get_items(self, session):
- groups = self.group_helper.get_group_names(session)
- users = self.group_helper.get_users(session, groups)
- self.expand.initialize(session, groups, users)
+ info = self.group_helper.get_config_info(session)
- names = list(groups)
+ names = list(info)
+ names = sorted(names)
if self.reversed.get(session):
names = reversed(names)
- # if current expanded group has users
expanded = self.expand.get(session)
- if expanded in users:
- self.group_helper.get_priority_factor(session, users[expanded], True)
- self.group_helper.get_regroups(session, users[expanded], True)
- # insert the users into the list
+ # make a list of groups to show based on what is expanded
+ parent = expanded and self.group_helper.get_parent(session, expanded) or None
items = list()
for name in names:
- items.append(name)
- if name == expanded and expanded in users:
- items.extend(users[expanded])
+ # always show top level groups
+ if "." not in name:
+ items.append(name)
+ # add the current expanded item
+ elif expanded == name:
+ items.append(name)
+ # add the ancestors
+ elif expanded and expanded.startswith(name+"."):
+ items.append(name)
+ # add the direct children of expanded item
+ elif expanded and name.startswith(expanded+"."):
+ sub_name = name[len(expanded) + 1:]
+ if "." not in sub_name:
+ items.append(name)
+ # and direct children of expanded item's parent
+ elif parent and name.startswith(parent+"."):
+ sub_name = name[len(parent) + 1:]
+ if "." not in sub_name:
+ items.append(name)
+ self.group_helper.get_config_for_groups(session, "GROUP_QUOTA_DYNAMIC", items)
+
return items
class ExpandColumn(ItemTableColumn):
+ def __init__(self, app, name, expand):
+ super(NegotiatorOverview.ExpandColumn, self).__init__(app, name)
+
+ self.expand = expand
+
def render_title(self, session, *args):
return ""
@@ -194,11 +198,30 @@
return ["expand"]
def render_content(self, session, group):
- if self.parent.expand.get_title(session, group):
- return self.parent.expand.render_item_link(session, group)
- else:
+ if not self.parent.group_helper.has_child(session, group):
return ""
+ info = self.parent.group_helper.get_config_info(session)
+ # return a " or - depending on current expand
+ expand = self.expand.get(session)
+ if expand and expand.startswith(group):
+ state = "-"
+ else:
+ state = "+"
+
+ parent = self.parent.group_helper.get_parent(session, group)
+ return self.render_item_link(session, group, parent, state)
+
+ def render_item_link(self, session, group, parent, state):
+ branch = session.branch()
+
+ next_expand = state == "+" and group or parent
+ self.expand.set(branch, next_expand)
+
+ hover = state == "-" and "Collapse" or "Expand"
+
+ return fmt_link(branch.marshal(), state, link_title=hover)
+
class GroupColumn(ItemTableColumn):
def render_title(self, session, *args):
return "Group"
@@ -206,40 +229,19 @@
def render_content(self, session, group):
# if a user
if "." in group:
- (g, sep, user) = group.partition(".")
- return "<span style='padding-left: 2em;'>%s</span>" % user
+ (g, sep, user) = group.rpartition(".")
+ return "<span style='padding-left: 1em;'>%s</span>" % user
return group
class DynamicColumn(QmfGroupColumn):
- def render_data(self, session, data):
+ def render_content(self, session, group):
+ value = self.parent.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
+ self.task.form.group_leader.set(session, group)
href = self.task.get_href(session)
- content = "%s%%" % str(round(float(data[1]) * 100.0, 2))
- return fmt_link(href, content, "", "", self.fmt_hover(data[0]))
+ content = "%s%%" % str(round(float(value) * 100.0, 2))
+ return fmt_link(href, content, "", "", self.fmt_hover(""))
- class ExpandSwitch(DynamicSwitch):
- def render_item_link(self, session, state):
- branch = session.branch()
- expanded = self.get(session) == state
-
- if expanded:
- self.set(branch, "")
- else:
- self.set(branch, state)
-
- content = expanded and "[-]" or "[+]"
- verb = expanded and "Hide" or "Show"
- hover = self.get_hover(session, state) % verb
-
- return fmt_link(branch.marshal(), content, "", link_title=hover)
-
- def initialize(self, session, groups, users):
- if len(self.get_items(session)) == 0:
- for group in groups:
- if group in users:
- self.add_state(session, group, "+", hover="%%s users for %s" % group)
- self.param.default = None
-
class GroupHelper(Widget):
def __init__(self, app, name, negotiator):
super(GroupHelper, self).__init__(app, name)
@@ -273,37 +275,106 @@
self.users = self.Users(app, "users")
self.add_attribute(self.users)
- def get_group_names(self, session):
- groups = self.groups.get(session)
- if len(groups) == 0:
- negotiator = self.negotiator.get(session)
+ def get_config_info(self, session):
+ negotiator = self.negotiator.get(session)
+ try:
+ info = self.app.model.configs_by_negotiator \
+ [negotiator._qmf_agent_id]
+ except KeyError:
+ info = dict()
+
+ if len(info) == 0:
default = {'Value': None}
action = QmfCall(self.app, default=default, timeout=10)
results = action.execute(negotiator, "GetRawConfig", "GROUP_NAMES")
- # TODO: remove this temp workaround
- # XXX temp work around for qmf call
- if results.error:
- results.data = {'Value': 'msg, grid, mgmt, rt'}
groups = results.data
try:
groups = self.split_group_names(groups['Value'])
except Exception, e:
groups = []
- if len(groups):
- self.groups.set(session, groups)
- return groups
+ info = dict()
+ for group in groups:
+ info[group] = dict()
+
+ self.app.model.configs_by_negotiator[negotiator._qmf_agent_id] = info
+
+ return info
+
+ def has_child(self, session, group):
+ negotiator = self.negotiator.get(session)
+ info = self.app.model.configs_by_negotiator[negotiator._qmf_agent_id]
+
+ try:
+ return info[group]['has_child']
+ except KeyError:
+ info[group]['has_child'] = False
+ for key in info:
+ if key.startswith(group+"."):
+ info[group]['has_child'] = True
+ break
+
+ self.app.model.configs_by_negotiator[negotiator._qmf_agent_id] = info
+ return info[group]['has_child']
+
+ def get_parent(self, session, group):
+ negotiator = self.negotiator.get(session)
+ info = self.app.model.configs_by_negotiator[negotiator._qmf_agent_id]
+
+ try:
+ return info[group]['parent']
+ except KeyError:
+ parent = ""
+ for key in info:
+ if key != group and group.startswith(key):
+ if len(key) > len(parent):
+ parent = key
+
+ info[group]['parent'] = parent
+
+ self.app.model.configs_by_negotiator[negotiator._qmf_agent_id] = info
+ return info[group]['parent']
+
+ def get_siblings(self, session, node):
+ negotiator = self.negotiator.get(session)
+ info = self.app.model.configs_by_negotiator[negotiator._qmf_agent_id]
+
+ siblings = list()
+ (ng, s, nn) = node.rpartition(".")
+ for group in info:
+ (g, s, n) = group.rpartition(".")
+ if g == ng:
+ siblings.append(group)
+
+ return siblings
+
+ def get_group_names(self, session):
+ info = self.get_config_info(session)
+ return list(info)
+
def split_group_names(self, group_string):
groups = []
- gsplit = group_string.split()
- if len(gsplit) < 2:
- gsplit = group_string.split(",")
- for group in gsplit:
- group = group.replace(",", "")
- group = group.replace(" ", "")
- groups.append(group)
- return groups
+ g_string = group_string.replace(", ", ",")
+ return g_string.split(",")
+ def get_config_for_groups(self, session, config, groups):
+ info = self.get_config_info(session)
+
+ needed_groups = [x for x in groups if not config in info[x]]
+
+ if len(needed_groups) > 0:
+ negotiator = self.negotiator.get(session)
+ action = FetchRawConfigSet(self.app)
+ raw_configs = action.execute(negotiator, needed_groups, config+"_")
+
+ for group in raw_configs:
+ res = raw_configs[group]
+ info[group][config] = res.data['Value']
+
+ def get_config_value(self, session, group, config):
+ info = self.get_config_info(session)
+ return info[group][config]
+
def get_group_raw_config(self, session, config, param, groups=None):
configs = param.get(session)
@@ -350,55 +421,29 @@
"GROUP_AUTOREGROUP",
self.autoregroup, [""])
- def get_users(self, session, groups):
- try:
- users = self.users.get_users(session, groups, self.negotiator)
- except:
- users = dict()
- return users
-
- def append_unclaimed_dyn_quota(self, session, quotas, force=False):
+ def get_unclaimed_dyn_quota(self, session, groups):
+ info = self.get_config_info(session)
total = 0.0
- for [group, value, status] in quotas:
+ for group in groups:
+ value = info[group]["GROUP_QUOTA_DYNAMIC"]
try:
total = total + float(value)
except:
pass
- if (total < 1.0) or force:
- val = 1.0 - total
- appended = list(quotas)
- appended.append(['Unclaimed', str(val), ("OK", False, True)])
- return appended
- else:
- return quotas
+ val = 1.0 - total
+ val = max(0, val)
+ val = min(1.0, val)
+ return val
+
class GroupAttribute(Attribute):
def get_default(self, session):
return list()
class Users(Attribute):
- def get_users(self, session, groups, negotiator):
- #returns {group: [user, user], group: [user, user], ...}
- users = self.get(session)
- if not users:
- neg = negotiator.get(session)
- pool = neg.Pool
- cls = self.app.model.com_redhat_grid.Scheduler
- scheduler = cls.get_object(session.cursor, Pool=pool)
- cls = self.app.model.com_redhat_grid.Submitter
- submitters = cls.get_selection(session.cursor, _schedulerRef_id=scheduler._id)
- user_names = [x.Name for x in submitters]
- users = dict()
- for group in groups:
- for user_name in user_names:
- if user_name.startswith("%s." % group):
- if not group in users:
- users[group] = list()
- users[group].append(user_name)
+ def get_default(self, session):
+ return dict()
- self.set(session, users)
- return users
-
class GroupAddForm(ObjectTaskForm):
def __init__(self, app, name, task):
super(GroupAddForm, self).__init__(app, name, task)
@@ -420,11 +465,15 @@
original_groups = self.group_helper.get_group_names(session)
if self.is_valid(group_name):
- original_groups.append(group_name)
- new_groups = ", ".join(original_groups)
- self.task.invoke(session, negotiator, "GROUP_NAMES", new_groups)
- self.task.reconfig(negotiator)
+ if group_name not in original_groups:
+ original_groups.append(group_name)
+ new_groups = ", ".join(original_groups)
+ self.task.invoke(session, negotiator, "GROUP_NAMES", new_groups)
+ self.task.reconfig(negotiator)
+ info = self.group_helper.get_config_info(session)
+ info[group_name] = dict()
+
self.task.exit_with_redirect(session)
def is_valid(self, group):
@@ -458,7 +507,7 @@
self.add_parameter(self.original_values)
def render_group_name(self, session, group):
- return group[0]
+ return group
def render_group_name_path(self, session, group):
return self.group_names.path
@@ -583,8 +632,11 @@
self.quotas = ListParameter(app, "quotas", quota)
self.add_parameter(self.quotas)
+ self.group_leader = Parameter(app, "group_leader")
+ self.add_parameter(self.group_leader)
+
self.chart = PriorityPieChart \
- (app, "chart", self.object, self.group_helper)
+ (app, "chart", self.object, self.group_helper, self.group_leader)
self.add_child(self.chart)
def render_title(self, session):
@@ -597,28 +649,34 @@
return "priorityForm"
def render_data_col_header(self, session):
- return "Percent of Slots"
+ return "Percent"
def render_groups(self, session):
writer = Writer()
- groups = self.group_helper.get_dyn_quota(session)
- groups = self.group_helper.append_unclaimed_dyn_quota \
- (session, groups, force=True)
- for group in groups:
- if group[0] == "Unclaimed":
- self.unclaimed_tmpl.render(writer, session, group)
- else:
- self.field_tmpl.render(writer, session, group)
+ group_leader = self.group_leader.get(session)
+ groups = self.group_helper.get_siblings(session, group_leader)
+ for group in sorted(groups):
+ self.field_tmpl.render(writer, session, group)
+ self.unclaimed_tmpl.render(writer, session, "Unclaimed")
+
return writer.to_string()
def render_quota_name(self, session, group):
return self.quotas.path
def render_quota_value(self, session, group):
- return round(float(group[1]) * 100.0, 2)
+ value = self.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
+ return round(float(value) * 100.0, 2)
+ def render_unclaimed_value(self, session, group):
+ group_leader = self.group_leader.get(session)
+ groups = self.group_helper.get_siblings(session, group_leader)
+ unclaimed = self.group_helper.get_unclaimed_dyn_quota \
+ (session, groups)
+ return round(float(unclaimed) * 100.0, 2)
+
def render_chart_id(self, session):
return self.chart.render_id(session)
@@ -627,6 +685,7 @@
quotas = self.quotas.get(session)
group_names = self.group_names.get(session)
original_values = self.original_values.get(session)
+ info = self.group_helper.get_config_info(session)
changed = False
for group, new_value, original_value in zip(group_names, quotas, original_values):
@@ -636,7 +695,9 @@
if quota:
self.task.invoke(session, negotiator,
"GROUP_QUOTA_DYNAMIC_" + group, quota)
+ info[group]["GROUP_QUOTA_DYNAMIC"] = quota
changed = True
+
if changed:
self.task.reconfig(negotiator)
self.task.exit_with_redirect(session)
@@ -829,7 +890,7 @@
self.task.exit_with_redirect(session)
class PriorityPieChart(StatFlashChart):
- def __init__(self, app, name, negotiator, groups):
+ def __init__(self, app, name, negotiator, group_helper, group_leader):
super(PriorityPieChart, self).__init__(app, name, negotiator)
self.negotiator = negotiator
@@ -838,7 +899,8 @@
self.fullpageable = False
self.update_enabled = False
- self.groups = groups
+ self.group_helper = group_helper
+ self.group_leader = group_leader
def render_title(self, session):
pass
@@ -859,12 +921,18 @@
# send the group names and values to the chart page so we
# don't have to get them again
- values = self.groups.get_dyn_quota(session)
- values = self.groups.append_unclaimed_dyn_quota(session, values)
- names = ["name=%s" % x[0] for x in values]
+ group_leader = self.group_leader.get(session)
+ groups = self.group_helper.get_siblings(session, group_leader)
+ names = ["name=%s" % x for x in groups]
params.extend(names)
- vals = ["value=%s" % str(x[1]) for x in values]
+ params.append("name=Unclaimed")
+
+ info = self.group_helper.get_config_info(session)
+ vals = ["value=%s" % info[x]["GROUP_QUOTA_DYNAMIC"] for x in groups]
params.extend(vals)
+ unclaimed = self.group_helper.get_unclaimed_dyn_quota(session, groups)
+ params.append("value=%s" % str(unclaimed))
+
return params
class EditButton(ActionSet):
@@ -927,6 +995,9 @@
self.form = GroupAddForm(app, self.name, self)
def get_title(self, session):
+ return ""
+
+ def get_description(self, session):
return "Add group"
class NegotiatorEditRegroup(NegotiatorGroupTask):
@@ -954,8 +1025,15 @@
self.form = EditDynamicQuotaForm(app, self.name, self)
def get_title(self, session):
+ return ""
+
+ def get_description(self, session):
return "Edit dynamic quota"
+ def do_enter(self, session, osession):
+ group_leader = self.form.group_leader.get(osession)
+ self.form.group_leader.set(session, group_leader)
+
class NegotiatorEditStaticQuota(NegotiatorGroupTask):
def __init__(self, app, frame):
super(NegotiatorEditStaticQuota, self).__init__(app, frame)
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-07-09 15:39:44 UTC (rev 4095)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-07-09 20:15:59 UTC (rev 4096)
@@ -6,6 +6,14 @@
padding: 0.75em;
}
+[NegotiatorOverview.css]
+th.ExpandColumn {
+ width: 2em;
+}
+th.GroupColumn {
+ width: 50%;
+}
+
[NegotiatorOverview.html]
<div id="{id}" class="CuminTable GroupTable">
<table {class}>
@@ -181,11 +189,11 @@
{group_name}
</td>
<td>
- <input id="{group_name}" class="disabled" disabled="disabled" type="text" name="{quota_name}" value="{quota_value}"
+ <input id="{group_name}" class="disabled" disabled="disabled" type="text" name="{quota_name}" value="{unclaimed_value}"
size="6" tabindex="100"/>
<!-- these are here so we don't need to reget the groups and values after a submit -->
<input type="hidden" name="{group_name_path}" value="{group_name}" />
- <input type="hidden" name="{original_value_path}" value="{quota_value}" />
+ <input type="hidden" name="{original_value_path}" value="{unclaimed_value}" />
</td>
</tr>
@@ -219,7 +227,7 @@
//alert('failed');
},
evaluateOnSubmit: false,
- evaluateFieldsOnBlur: false
+ evaluateFieldsOnBlur: true
});
myFormValidator.add('IsPercent', {
errorMsg: 'Values must be between 0 and 100.',
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-07-09 15:39:44 UTC (rev 4095)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-07-09 20:15:59 UTC (rev 4096)
@@ -30,6 +30,7 @@
self.limits_by_negotiator = dict()
self.job_summaries_by_submission = dict()
+ self.configs_by_negotiator = dict()
self.lock = Lock()
14 years, 5 months