Author: eallen
Date: 2010-08-13 10:34:55 -0400 (Fri, 13 Aug 2010)
New Revision: 4210
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
Log:
Fix BZ 623476. Moved Group Config to Pool level, renamed to Quotas.
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-08-13 13:31:44 UTC (rev 4209)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-08-13 14:34:55 UTC (rev 4210)
@@ -27,17 +27,7 @@
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)
+ #self.edit_dynamic_quota = NegotiatorEditDynamicQuota(app, self)
class NegotiatorSelector(ObjectSelector):
def __init__(self, app, name, pool):
@@ -119,29 +109,11 @@
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"
+ col = self.SpacerColumn(app, "spacer")
self.add_column(col)
- task = frame.edit_prio_factor
- col = QmfGroupColumn(app, "factor",
self.group_helper.get_priority_factor, negotiator, task)
- col.title = "Priority Factor"
- col.user = True
- col.user_task = frame.user_prio_factor
- self.add_column(col)
-
- task = frame.edit_regroup
- col = QmfGroupColumn(app, "regroup", self.group_helper.get_regroups,
negotiator, task)
- col.title = "Auto Regroup"
- col.user = True
- col.user_task = frame.user_regroup
- self.add_column(col)
- """
-
def render_title(self, session):
- return "Group Configuration"
+ return "Quotas"
def render_class(self, session):
return "class=\"mobjects\""
@@ -227,7 +199,7 @@
class GroupColumn(ItemTableColumn):
def render_title(self, session, *args):
- return "Group"
+ return "Name"
def render_content(self, session, group):
# if a user
@@ -245,6 +217,13 @@
content = "%s%%" % str(round(float(value) * 100.0, 2))
return fmt_link(href, content, "", "",
self.fmt_hover(""))
+ class SpacerColumn(ItemTableColumn):
+ def render_title(self, session, *args):
+ return ""
+
+ def render_content(self, session, _):
+ return ""
+
class GroupHelper(Widget):
def __init__(self, app, name, negotiator):
super(GroupHelper, self).__init__(app, name)
@@ -489,12 +468,11 @@
def __init__(self, app, name, task):
super(GroupForm, self).__init__(app, name, task)
- self.defer_enabled = True
+ cls = app.model.com_redhat_grid.Negotiator
+ self.negotiator = RosemaryObjectParameter(app, "neg", cls)
+ self.add_parameter(self.negotiator)
- #self.object = NegotiatorParameter(app, "negotiator")
- #self.add_parameter(self.object)
-
- self.group_helper = GroupHelper(app, "groups", self.object)
+ self.group_helper = GroupHelper(app, "groups", self.negotiator)
self.add_child(self.group_helper)
group_name = Parameter(app, "gn")
@@ -509,6 +487,8 @@
self.original_values = ListParameter(app, "original_values",
original_value)
self.add_parameter(self.original_values)
+ self.defer_enabled = True
+
def render_group_name(self, session, group):
return group
@@ -684,7 +664,7 @@
return self.chart.render_id(session)
def process_submit(self, session):
- negotiator = self.object.get(session)
+ negotiator = self.negotiator.get(session)
quotas = self.quotas.get(session)
group_names = self.group_names.get(session)
original_values = self.original_values.get(session)
@@ -967,7 +947,7 @@
class NegotiatorGroupTask(ObjectFrameTask):
def do_exit(self, session):
- self.app.main_page.main.grid.pool.negotiator.view.show(session)
+ self.app.main_page.main.grid.pool.view.show(session)
def do_invoke(self, invoc, negotiator, group, value):
# don't call self.qmf_call here since we need to
@@ -1030,6 +1010,9 @@
group_leader = self.form.group_leader.get(osession)
self.form.group_leader.set(session, group_leader)
+ negotiator = self.frame.negotiator_attribute.get(osession)
+ self.form.negotiator.set(session, negotiator)
+
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-08-13 13:31:44 UTC (rev
4209)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings 2010-08-13 14:34:55 UTC (rev
4210)
@@ -20,6 +20,19 @@
width: 50%;
}
+th.SpacerColumn {
+ width: 25%;
+}
+
+table.mobjects th.DynamicColumn {
+ white-space: nowrap;
+ text-align: right;
+}
+table.mobjects td.DynamicColumn {
+ text-align: right;
+ padding-right: 2em;
+}
+
[NegotiatorOverview.html]
<div id="{id}" class="CuminTable GroupTable">
<table {class}>
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-08-13 13:31:44 UTC (rev 4209)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.py 2010-08-13 14:34:55 UTC (rev 4210)
@@ -57,9 +57,6 @@
self.submission = SubmissionFrame(app, "submission")
self.add_mode(self.submission)
- #self.job = JobFrame(app, "job")
- #self.add_mode(self.job)
-
self.slot = SlotFrame(app, "slot")
self.add_mode(self.slot)
@@ -69,9 +66,6 @@
self.negotiator = NegotiatorFrame(app, "negotiator")
self.add_mode(self.negotiator)
- #self.collector = CollectorFrame(app, "coll")
- #elf.add_mode(self.collector)
-
self.limit = LimitFrame(app, "limit")
self.add_mode(self.limit)
@@ -90,6 +84,13 @@
negotiators = NegotiatorSelector(app, "negotiators", self.object)
self.view.add_tab(negotiators)
+ self.negotiator_attribute = self.NegotiatorAttribute(app, "neg",
self.object)
+ self.add_attribute(self.negotiator_attribute)
+
+ self.edit_dynamic_quota = NegotiatorEditDynamicQuota(app, self)
+ self.quotas = NegotiatorOverview(app, "quotas",
self.negotiator_attribute, self)
+ self.view.add_tab(self.quotas)
+
self.limits = LimitSet(app, "limits", self.object)
self.view.add_tab(self.limits)
@@ -98,11 +99,31 @@
#self.submission_vm_add = SubmissionVMAdd(app, self)
#self.submission_dag_add = SubmissionDagAdd(app, self)
- def do_process(self, session):
- #self.limits.limit_count.process(session)
+ class NegotiatorAttribute(Attribute):
+ def __init__(self, app, name, collector):
+ super(PoolFrame.NegotiatorAttribute, self).__init__(app, name)
- super(PoolFrame, self).do_process(session)
+ self.collector = collector
+ def get(self, session):
+ negotiator = super(PoolFrame.NegotiatorAttribute, self).get(session)
+ if not negotiator:
+ cls = self.app.model.com_redhat_grid.Negotiator
+
+ pool = self.collector.get(session)
+ if pool:
+ negotiators = cls.get_selection(session.cursor, Pool=pool.Name)
+ # use the most recently updated one if there are multiple
+ if len(negotiators) > 0:
+ recent_negotiator = negotiators[0]
+ for neg in negotiators:
+ if neg._qmf_update_time > \
+ recent_negotiator._qmf_update_time:
+ recent_negotiator = neg
+ self.set(session, recent_negotiator)
+ negotiator = recent_negotiator
+ return negotiator
+
class PoolOverview(Widget):
def __init__(self, app, name, collector):
super(PoolOverview, self).__init__(app, name)