Author: tmckay
Date: 2011-06-09 14:47:07 +0000 (Thu, 09 Jun 2011)
New Revision: 4805
Removed:
trunk/cumin/python/cumin/grid/collector.py
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/grid/limit.py
trunk/cumin/python/cumin/grid/main.py
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/pool.py
trunk/cumin/python/cumin/grid/scheduler.py
trunk/cumin/python/cumin/grid/slot.py
trunk/cumin/python/cumin/grid/slotvis.py
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/inventory/system.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/objectframe.py
trunk/cumin/python/cumin/parameters.py
trunk/cumin/python/cumin/stat.py
trunk/rosemary/python/rosemary/model.py
Log:
Removed filtering on "pool" (derived from com.redhat.grid.Collector) for
Scheduler, Negotiator, Slot, etc. This is to support grid configurations
with hierarchical collectors, where grid objects from agents linked to
subcollectors report a different "pool" value than objects from agents
linked to the top-level collector.
In the process, removed the following dead or now-dead code (classes mostly):
* collector.py (the whole file)
* dashboard.py: DashboardSchedulerStats, DashboardCapacitySlotSummary_, NegotiatorCycles,
NegotiatorSlots,
NegotiatorSlotsChart, RosmaryPoolObjectAttribute
* negotiator.py: NegotiatorAttribute
* pool.py: PoolOverview
* slotvis.py: PoolSlotMapPage
* submission.py: PoolSubmitLink
* main.py: TopSubmissionTable.get_collector()
* parameters.py: ObjectAssociateAttribute, CollectorGridAttribute
BZ699413
Deleted: trunk/cumin/python/cumin/grid/collector.py
===================================================================
--- trunk/cumin/python/cumin/grid/collector.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/collector.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -1,66 +0,0 @@
-import logging
-
-from wooly import *
-from wooly.widgets import *
-from wooly.forms import *
-from wooly.resources import *
-from wooly.tables import *
-
-from cumin.objectframe import *
-from cumin.objecttask import *
-from cumin.stat import *
-from cumin.widgets import *
-from cumin.parameters import *
-from cumin.formats import *
-from cumin.util import *
-
-import main
-
-strings = StringCatalog(__file__)
-log = logging.getLogger("cumin.grid.collector")
-
-class CollectorFrame(ObjectFrame):
- def __init__(self, app, name):
- cls = app.model.com_redhat_grid.Collector
-
- super(CollectorFrame, self).__init__(app, name, cls)
-
- self.view.add_tab(CollectorOverview(app, "stats", self.object))
-
- self.start = DaemonStart(app, self, "COLLECTOR")
- self.stop = DaemonStop(app, self, "COLLECTOR")
-
-class CollectorGeneralStatSet(StatSet):
- def __init__(self, app, name, object):
- super(CollectorGeneralStatSet, self).__init__(app, name, object)
-
- self.attrs = ("RunningJobs", "IdleJobs",
- "HostsClaimed", "HostsUnclaimed",
- "HostsOwner", "HostsTotal")
-
-class CollectorOverview(Widget):
- def __init__(self, app, name, collector):
- super(CollectorOverview, self).__init__(app, name)
-
- self.add_child(GeneralStatSet(app, "stats", collector))
-
- chart = self.JobStackedChart(app, "jobs", collector)
- chart.stats = ("RunningJobs", "IdleJobs")
- chart.chart_type = "stacked"
- self.add_child(chart)
-
- chart = self.SlotStackedChart(app, "slots", collector)
- chart.stats = ("HostsClaimed", "HostsUnclaimed",
"HostsOwner")
- chart.chart_type = "stacked"
- self.add_child(chart)
-
- def render_title(self, session):
- return "Overview"
-
- class JobStackedChart(StatFlashChart):
- def render_title(self, session):
- return "Job status"
-
- class SlotStackedChart(StatFlashChart):
- def render_title(self, session, *args):
- return "Slot state"
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -14,8 +14,8 @@
from cumin.stat import StatSet, PieChartPage, StatFlashChart
from cumin.objectselector import ObjectSelector, MonitorSelfStatColumn,
ObjectTableColumn, ObjectTable,\
ObjectLinkColumn, CsvStatsExporter, ExportButton, MonitorSelfAgeColumn
+from cumin.parameters import YoungestAttribute
from cumin.util import rgb_to_string
-from negotiator import NegotiatorAttribute
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.dashboard")
@@ -29,33 +29,26 @@
dashboard = DashboardSummary(app, "d", collector)
self.add_tab(dashboard)
- performance = DashboardPerformance(app, "p", collector)
+ performance = DashboardPerformance(app, "p")
self.add_tab(performance)
- capacity = DashboardCapacity(app, "c", collector)
+ capacity = DashboardCapacity(app, "c")
self.add_tab(capacity)
def render_title(self, session):
return "Overview"
-class DashboardSchedulerStats(Widget):
- def __init__(self, app, name, collector):
- super(DashboardSchedulerStats, self).__init__(app, name)
-
- def render_title(self, session):
- return "Scheuler Stats"
-
class DashboardSummary(Widget):
def __init__(self, app, name, collector):
super(DashboardSummary, self).__init__(app, name)
- job_data = DashboardOverviewJobSummary(app, "job_info", collector)
+ job_data = DashboardOverviewJobSummary(app, "job_info")
self.add_child(job_data)
slot_data = GridSlotsSummary(app, "host_info", collector)
self.add_child(slot_data)
- neg_through = NegotiatorJobThroughput(app, "negotiator_throughput",
collector)
+ neg_through = NegotiatorJobThroughput(app, "negotiator_throughput")
self.add_child(neg_through)
cls = app.model.com_redhat_grid.Scheduler
@@ -63,7 +56,7 @@
setattr(cls.MeanTimeToStart, "average", True)
columns = (cls.JobSubmissionRate, cls.JobStartRate, cls.JobCompletionRate,
cls.MeanTimeToStart)
- stats = FootnoteDashboardSummaryStats(app, "scheduler_info", collector,
cls, columns, "Scheduler.Jobs")
+ stats = FootnoteDashboardSummaryStats(app, "scheduler_info", cls,
columns, "Scheduler.Jobs")
stats.title = "Job scheduler info"
self.add_child(stats)
@@ -71,32 +64,34 @@
return "Summary"
class DashboardPerformance(Widget):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
super(DashboardPerformance, self).__init__(app, name)
cls = app.model.com_redhat_grid.Collector
- c = MonitorSelfStats(app, "ms_c", collector, cls, "Collector
performance", None)
+ coll = YoungestAttribute(app, "coll", cls)
+ c = MonitorSelfStats(app, "ms_c", cls, "Collector
performance", None, coll)
self.add_child(c)
cls = app.model.com_redhat_grid.Negotiator
frame = "main.grid.negotiator"
- n = MonitorSelfStats(app, "ms_n", collector, cls, "Negotiator
performance", frame)
+ neg = YoungestAttribute(app, "neg", cls)
+ n = MonitorSelfStats(app, "ms_n", cls, "Negotiator
performance", frame, neg)
self.add_child(n)
- s = SchedulerPerformance(app, "ms_s", collector)
+ s = SchedulerPerformance(app, "ms_s")
self.add_child(s)
def render_title(self, session):
return "Performance"
class DashboardCapacity(Widget):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
super(DashboardCapacity, self).__init__(app, name)
- capacity = DashboardCapacitySlotSummary(app, "slot_capacity",
collector)
+ capacity = DashboardCapacitySlotSummary(app, "slot_capacity")
self.add_child(capacity)
- os_data = GridOSBreakdown(app, "os_breakdown", collector)
+ os_data = GridOSBreakdown(app, "os_breakdown")
self.add_child(os_data)
def render_title(self, session):
@@ -140,11 +135,15 @@
self.pie_tmpl = WidgetTemplate(self, "pie_html")
- # don't show this if our object isn't there
def do_render(self, session):
- object = self.object.get(session)
- if object:
- return super(PieStatSet, self).do_render(session)
+ # don't show this if our object isn't there
+ # Some of our children depend on an object, and some
+ # have overloaded do_get_items to read different data,
+ # so if self.object has been set to None skip the check.
+ if self.object:
+ if not self.object.get(session):
+ return
+ return super(PieStatSet, self).do_render(session)
# we generate the style sheet for the legend based on
# the colors defined in the PieChartPage
@@ -349,12 +348,9 @@
return field
class DashboardSumData(ObjectSqlAdapter):
- def __init__(self, app, columns, collector, cls):
+ def __init__(self, app, columns, cls):
super(DashboardSumData, self).__init__(app, cls)
- self.collector = collector
- self.add_value_filter(cls.Pool)
-
for column in columns:
col = "sum(\"%s\")" % column
self.columns.append(col)
@@ -366,9 +362,6 @@
def get_record(self, session):
values = dict()
- obj = self.collector.get(session)
- values[self.cls.Pool.name] = getattr(obj, self.cls.Pool.name)
-
options = DataAdapterOptions()
options.offset = 0
@@ -377,8 +370,8 @@
return records[0]
class DashboardSummaryStats(DefinitionSet):
- def __init__(self, app, name, collector, cls, columns, title):
- super(DashboardSummaryStats, self).__init__(app, name, collector, title)
+ def __init__(self, app, name, cls, columns, title):
+ super(DashboardSummaryStats, self).__init__(app, name, None, title)
self.record = Attribute(app, "totals")
self.add_attribute(self.record)
@@ -386,7 +379,7 @@
self.columns = columns
self.sum_columns = [x.name for x in columns]
self.sum_cls = cls
- self.data = DashboardSumData(app, self.sum_columns, collector, self.sum_cls)
+ self.data = DashboardSumData(app, self.sum_columns, self.sum_cls)
self.title = None
@@ -425,10 +418,10 @@
return record
class FootnoteDashboardSummaryStats(DashboardSummaryStats):
- def __init__(self, app, name, collector, cls, columns, title):
- super(FootnoteDashboardSummaryStats, self).__init__(app, name, collector, cls,
columns, title)
+ def __init__(self, app, name, cls, columns, title):
+ super(FootnoteDashboardSummaryStats, self).__init__(app, name, cls, columns,
title)
- self.footnote_data = DashboardSumData(app, [cls.WindowedStatWidth.name],
collector, cls)
+ self.footnote_data = DashboardSumData(app, [cls.WindowedStatWidth.name], cls)
def render_footnote_value(self, session):
# get the average WindowedStarWidth for all schedulers
@@ -440,8 +433,8 @@
return value
class DashboardPieSummarySet(PieStatSet):
- def __init__(self, app, name, collector, cls, columns, title):
- super(DashboardPieSummarySet, self).__init__(app, name, collector, title)
+ def __init__(self, app, name, cls, columns, title):
+ super(DashboardPieSummarySet, self).__init__(app, name, None, title)
self.record = Attribute(app, "totals")
self.add_attribute(self.record)
@@ -450,7 +443,7 @@
self.columns = columns
self.sum_columns = [x.name for x in columns]
self.sum_cls = cls
- self.data = DashboardSumData(app, self.sum_columns, collector, self.sum_cls)
+ self.data = DashboardSumData(app, self.sum_columns, self.sum_cls)
self.has_total = True
self.color_scheme = PieChartPage.BLUES
@@ -485,12 +478,12 @@
return record
class DashboardOverviewJobSummary(DashboardPieSummarySet):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
cls = app.model.com_redhat_grid.Scheduler
columns = [cls.TotalRunningJobs, cls.TotalHeldJobs, cls.TotalIdleJobs,
cls.TotalRemovedJobs, cls.TotalJobAds]
- super(DashboardOverviewJobSummary, self).__init__(app, name, collector, cls,
columns, "scheduler.jobs")
+ super(DashboardOverviewJobSummary, self).__init__(app, name, cls, columns,
"scheduler.jobs")
self.color_scheme = PieChartPage.GREENS
@@ -499,11 +492,11 @@
class DashboardCapacitySlotSummary(DashboardPieSummarySet):
PERCENT_COLUMN = "% Memory used"
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
self.cls = app.model.com_redhat_grid.Slot
columns = [self.cls.Disk, self.cls.ImageSize, self.cls.Memory]
- super(DashboardCapacitySlotSummary, self).__init__(app, name, collector,
self.cls, columns, "slot.summary")
+ super(DashboardCapacitySlotSummary, self).__init__(app, name, self.cls, columns,
"slot.summary")
self.has_pie_chart = False
self.has_total = False
@@ -559,40 +552,6 @@
def get_legend_class(self, session, item):
return "blank"
-class DashboardCapacitySlotSummary_(ObjectSelector):
- def __init__(self, app, name, collector):
- cls = app.model.com_redhat_grid.Slot
- super(DashboardCapacitySlotSummary, self).__init__(app, name, cls)
-
- self.add_filter(collector, cls.Pool)
-
- stat = self.DiskTotalColumn(app, "disk", cls.Disk, "Available
disk")
- stat.static_header = True
- self.add_column(stat)
-
- stat = SumSqlColumn(app, "slot_mem_used", cls.ImageSize, "Memory
used")
- stat.static_header = True
- self.add_column(stat)
- stat = SumSqlColumn(app, "memtotal", cls.Memory, "Memory
total")
- stat.static_header = True
- self.add_column(stat)
- stat = QuotientSqlColumn(app, "percentmem",
- "sum(%s)" %
cls.ImageSize.sql_column.identifier,
- "sum(%s)*1024" %
cls.Memory.sql_column.identifier)
- stat.static_header = True
- stat.title = "% Memory Used"
- self.add_column(stat)
-
- self.enable_csv_export(collector)
-
- def create_table(self, app, name, cls):
- # avoid the checkboxes
- return MinimalTable(app, name, cls)
-
- class DiskTotalColumn(SumSqlColumn):
- def render_text_align(self, session):
- return "left"
-
class GridSlotsSummary(PieStatSet):
def __init__(self, app, name, collector):
super(GridSlotsSummary, self).__init__(app, name, collector,
"collector.hosts")
@@ -625,13 +584,10 @@
return "Aggregate of %s for all slots" % self.attrs[index]
class DashboardOSData(ObjectSqlAdapter):
- def __init__(self, app, collector):
+ def __init__(self, app):
cls = app.model.com_redhat_grid.Slot
super(DashboardOSData, self).__init__(app, cls)
- self.collector = collector
- self.add_value_filter(cls.Pool)
-
self.sum_column = "\"OpSys\""
col = "count(%s)" % self.sum_column
@@ -643,8 +599,6 @@
def get_records(self, session):
values = dict()
- obj = self.collector.get(session)
- values[self.cls.Pool.name] = getattr(obj, self.cls.Pool.name)
options = SqlQueryOptions()
options.sort_column = self.sum_column
@@ -692,13 +646,13 @@
return None
class GridOSBreakdown(PieStatSet):
- def __init__(self, app, name, collector):
- super(GridOSBreakdown, self).__init__(app, name, collector, "slot.os")
+ def __init__(self, app, name):
+ super(GridOSBreakdown, self).__init__(app, name, None, "slot.os")
self.os_records = Attribute(app, "os_breakdown")
self.add_attribute(self.os_records)
- self.os_data = DashboardOSData(app, collector)
+ self.os_data = DashboardOSData(app)
self.color_scheme = PieChartPage.GROUP2
self.has_total = True
@@ -753,8 +707,9 @@
return "legend%s" %
rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][real_index]))
class NegotiatorDefinitionStatSet(PieStatSet):
- def __init__(self, app, name, collector, title):
- self.negotiator = NegotiatorAttribute(app, "neg", collector)
+ def __init__(self, app, name, title):
+ cls = app.model.com_redhat_grid.Negotiator
+ self.negotiator = YoungestAttribute(app, "neg", cls)
super(NegotiatorDefinitionStatSet, self).__init__(app, name, self.negotiator,
title)
self.add_attribute(self.negotiator)
@@ -772,12 +727,12 @@
return "legend%s" %
rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][index]))
class NegotiatorJobThroughput(Widget):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
super(NegotiatorJobThroughput, self).__init__(app, name)
self.attrs = ["NumJobsConsidered", "Matches",
"CandidateSlots", "MatchRate"]
- throughput_stats = JobThroughput(app, "stats", self.attrs, collector)
+ throughput_stats = JobThroughput(app, "stats", self.attrs)
self.add_child(throughput_stats)
chart = self.ThroughputChart(app, "timeseries",
throughput_stats.negotiator)
@@ -795,8 +750,8 @@
return "Recent negotiator job throughput"
class JobThroughput(NegotiatorDefinitionStatSet):
- def __init__(self, app, name, attrs, collector):
- super(JobThroughput, self).__init__(app, name, collector,
"job.throughput")
+ def __init__(self, app, name, attrs):
+ super(JobThroughput, self).__init__(app, name, "job.throughput")
self.attrs = attrs
@@ -815,65 +770,10 @@
def render_html_title(self, session, item):
return super(JobThroughput, self).render_html_title(session, item[0])
-class NegotiatorCycles(NegotiatorDefinitionStatSet):
- def __init__(self, app, name, collector):
- super(NegotiatorCycles, self).__init__(app, name, collector,
"negotiator.cycles")
-
- self.attrs = ["Phase1Duration", "Phase2Duration",
"Phase3Duration", "Phase4Duration", "Duration"]
- self.chart_link.stats = self.attrs
-
- self.has_total = True
- self.color_scheme = PieChartPage.RAINBOW
-
- def render_title(self, session):
- return "Negotiator Cycles"
-
-class NegotiatorSlots(NegotiatorDefinitionStatSet):
- def __init__(self, app, name, collector):
- super(NegotiatorSlots, self).__init__(app, name, collector,
"negotiator.slots")
-
- self.attrs = ["TrimmedSlots", "CandidateSlots",
"TotalSlots"]
- self.chart_link.stats = self.attrs
-
- self.has_total = True
-
- def render_title(self, session):
- return "Negotiator Slots"
-
- def render_width(self, session):
- # disable the pie chart since these stats don't add up to a total
- return 0
-
-class NegotiatorSlotsChart(Widget):
- def __init__(self, app, name, pool):
- super(NegotiatorSlotsChart, self).__init__(app, name)
-
- self.pool = pool
- cls = app.model.com_redhat_grid.Negotiator
- self.object = RosemaryPoolObjectAttribute(app, "obj", pool, cls)
- self.add_attribute(self.object)
-
- slots = self.SlotsChart(app, "slots", self.object)
- slots.stats = ("TotalSlots", "TrimmedSlots",
"CandidateSlots")
- self.add_child(slots)
-
- def do_render(self, session):
- object = self.object.get(session)
- if object:
- return super(NegotiatorSlotsChart, self).do_render(session)
-
- class SlotsChart(StatFlashChart):
- def render_title(self, session, *args):
- return "Slots Precessed"
-
-
class MonitorSelfSchedulerTable(ObjectSelector):
- def __init__(self, app, name, pool, cls, frame):
+ def __init__(self, app, name, cls, frame):
super(MonitorSelfSchedulerTable, self).__init__(app, name, cls)
- self.pool = pool
- self.add_filter(self.pool, cls.Pool)
-
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
@@ -890,20 +790,20 @@
stat = MonitorSelfStatColumn(app, cls.MonitorSelfImageSize.name,
cls.MonitorSelfImageSize)
self.add_column(stat)
- self.enable_csv_export(pool)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
return MinimalTable(app, name, cls)
class SchedulerPerformance(Widget):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
super(SchedulerPerformance, self).__init__(app, name)
cls = app.model.com_redhat_grid.Scheduler
frame = "main.grid.scheduler"
- self.table = MonitorSelfSchedulerTable(app, "current", collector, cls,
frame)
+ self.table = MonitorSelfSchedulerTable(app, "current", cls, frame)
self.add_child(self.table)
rates = WidgetSet(app, "rate_widgets")
@@ -914,31 +814,31 @@
cls = app.model.com_redhat_grid.Scheduler
columns = (cls.JobsSubmitted, cls.JobSubmissionRate, cls.JobsSubmittedCum)
- stats = DashboardSummaryStats(app, "submitted", collector, cls,
columns, "Jobs.Submitted")
+ stats = DashboardSummaryStats(app, "submitted", cls, columns,
"Jobs.Submitted")
stats.title = "Aggregate job submission stats"
rates.add_child(stats)
columns = (cls.JobsStarted, cls.JobStartRate, cls.JobsStartedCum)
- stats = DashboardSummaryStats(app, "started", collector, cls, columns,
"Jobs.Started")
+ stats = DashboardSummaryStats(app, "started", cls, columns,
"Jobs.Started")
stats.title = "Aggregate job started stats"
rates.add_child(stats)
columns = (cls.JobsCompleted, cls.JobCompletionRate, cls.JobsCompletedCum)
- stats = DashboardSummaryStats(app, "completed", collector, cls,
columns, "Jobs.Completed")
+ stats = DashboardSummaryStats(app, "completed", cls, columns,
"Jobs.Completed")
stats.title = "Aggregate job completion stats"
rates.add_child(stats)
columns = (cls.JobsExited, cls.JobsExitedCum)
- stats = DashboardSummaryStats(app, "exited", collector, cls, columns,
"Jobs.Exited")
+ stats = DashboardSummaryStats(app, "exited", cls, columns,
"Jobs.Exited")
stats.title = "Aggregate job exited stats"
others.add_child(stats)
columns = (cls.ShadowExceptions, cls.ShadowExceptionsCum)
- stats = DashboardSummaryStats(app, "exceptions", collector, cls,
columns, "Jobs.Exceptions")
+ stats = DashboardSummaryStats(app, "exceptions", cls, columns,
"Jobs.Exceptions")
stats.title = "Aggregate job shadow exceptions stats"
others.add_child(stats)
- self.footnote_data = DashboardSumData(app, [cls.WindowedStatWidth.name],
collector, cls)
+ self.footnote_data = DashboardSumData(app, [cls.WindowedStatWidth.name], cls)
def render_footnote_value(self, session):
# get the average WindowedStarWidth for all schedulers
@@ -956,21 +856,19 @@
return self.table.render(session)
class MonitorSelfStats(Widget):
- def __init__(self, app, name, pool, cls, title, frame):
+ def __init__(self, app, name, cls, title, frame, object):
super(MonitorSelfStats, self).__init__(app, name)
- self.pool = pool
self.cls = cls
self.frame = frame
self.title = title
-
- self.object = RosemaryPoolObjectAttribute(app, "obj", pool, cls)
+ self.object = object
self.add_attribute(self.object)
- self.chart_link = MonitorSelfCharts(app, "history", pool, cls,
self.object)
+ self.chart_link = MonitorSelfCharts(app, "history", self.object)
self.add_child(self.chart_link)
- table = MonitorSelfTable(app, "current", pool, cls, frame, True)
+ table = MonitorSelfTable(app, "current", cls, frame, True)
self.add_child(table)
def do_render(self, session):
@@ -981,12 +879,9 @@
return self.title
class MonitorSelfTable(ObjectSelector):
- def __init__(self, app, name, pool, cls, frame, static):
+ def __init__(self, app, name, cls, frame, static):
super(MonitorSelfTable, self).__init__(app, name, cls)
- self.pool = pool
- self.add_filter(self.pool, cls.Pool)
-
# Do we want the name column to link to the objects page?
# In the case of collector we don't
if frame:
@@ -1012,7 +907,7 @@
stat.static_header = static
self.add_column(stat)
- self.enable_csv_export(pool)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
@@ -1022,12 +917,9 @@
return "Current"
class MonitorSelfCharts(Widget):
- def __init__(self, app, name, pool, cls, object):
+ def __init__(self, app, name, object):
super(MonitorSelfCharts, self).__init__(app, name)
- self.pool = pool
- self.cls = cls
-
cpu = self.CPUFlashChart(app, "cpu", object)
cpu.stats = ("MonitorSelfCPUUsage",)
self.add_child(cpu)
@@ -1047,13 +939,3 @@
def render_title(self, session, *args):
return "Socket count"
-class RosemaryPoolObjectAttribute(Attribute):
- def __init__(self, app, name, pool, cls):
- super(RosemaryPoolObjectAttribute, self).__init__(app, name)
-
- self.pool = pool
- self.cls = cls
-
- def get(self, session):
- obj = self.pool.get(session)
- return self.cls.get_object(session.cursor, Pool=obj.Pool)
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -20,27 +20,9 @@
LIMIT_FLOAT_VALUE_FOR_UNLIMITED = 1000000.0
class LimitAdapter(ObjectQmfAdapter):
- def __init__(self, app, cls, collector):
- super(LimitAdapter, self).__init__(app, cls)
-
- self.collector = collector
-
def get_negotiator(self, session):
- collector = self.collector.get(session)
cls = self.app.model.com_redhat_grid.Negotiator
-
- # mis-configured pool if there is more than one negotiator
- negs = cls.get_selection(session.cursor, Pool=collector.Pool)
- try:
- youngest = negs[0]
- except IndexError:
- return None
-
- for neg in negs:
- if neg._qmf_update_time > youngest._qmf_update_time:
- youngest = neg
- negotiator = youngest
-
+ negotiator = self.app.model.find_youngest(cls, session.cursor)
return negotiator
def get_count(self, values):
@@ -114,15 +96,15 @@
return limit_max
class LimitSelector(ObjectQmfSelector):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
cls = app.model.com_redhat_cumin_grid.Limit
super(LimitSelector, self).__init__(app, name, cls)
self.add_search_filter(self.table.name_col)
- self.table.adapter = LimitAdapter(app, cls, collector)
+ self.table.adapter = LimitAdapter(app, cls)
- self.enable_csv_export(collector)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
return LimitTable(app, name, cls)
Modified: trunk/cumin/python/cumin/grid/main.py
===================================================================
--- trunk/cumin/python/cumin/grid/main.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/main.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -5,7 +5,8 @@
from cumin import *
from cumin.objecttask import *
from cumin.util import *
-from cumin.grid.slotvis import PoolSlotMapPage, PoolSlotFullPage
+from cumin.grid.slot import SlotMapPage
+from cumin.grid.slotvis import PoolSlotFullPage
from model import *
from pool import *
@@ -28,7 +29,7 @@
self.app.main_page.main.grid = self.frame
self.app.main_page.main.add_tab(self.frame)
- self.pool_slots_page = PoolSlotMapPage(self.app, "poolslots.vis")
+ self.pool_slots_page = SlotMapPage(self.app, "poolslots.vis")
self.app.add_page(self.pool_slots_page)
self.pool_slots_fullpage = PoolSlotFullPage \
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -22,15 +22,11 @@
super(NegotiatorFrame, self).__init__(app, name, cls)
class NegotiatorSelector(ObjectSelector):
- def __init__(self, app, name, pool):
+ def __init__(self, app, name):
cls = app.model.com_redhat_grid.Negotiator
super(NegotiatorSelector, self).__init__(app, name, cls)
- self.pool = pool
-
- self.add_filter(self.pool, cls.Pool)
-
frame = "main.grid.negotiator"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
@@ -49,7 +45,7 @@
#self.start = DaemonSelectionStart(app, self, "NEGOTIATOR")
#self.stop = DaemonSelectionStop(app, self, "NEGOTIATOR")
- self.enable_csv_export(pool)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
@@ -446,28 +442,3 @@
negotiator = self.frame.negotiator_attribute.get(osession)
self.form.negotiator.set(session, negotiator)
-class NegotiatorAttribute(Attribute):
- def __init__(self, app, name, collector):
- super(NegotiatorAttribute, self).__init__(app, name)
-
- self.collector = collector
-
- def get(self, session):
- negotiator = super(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.Pool)
- # 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
-
Modified: trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- trunk/cumin/python/cumin/grid/pool.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/pool.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -5,7 +5,6 @@
from wooly.util import StringCatalog, Writer
from cumin.objectframe import ObjectFrame, ObjectView
-from cumin.parameters import CollectorGridAttribute
from cumin.stat import StatFlashChart, StatSet
from cumin.grid.dashboard import PoolDashboard
@@ -13,10 +12,9 @@
from slot import SlotFrame
from scheduler import SchedulerFrame, SchedulerSelector
from negotiator import NegotiatorFrame, NegotiatorSelector,\
- NegotiatorEditDynamicQuota, NegotiatorAttribute
+ NegotiatorEditDynamicQuota
from limit import LimitFrame, LimitSelector
from cumin.grid.quota import QuotaSelector
-from collector import CollectorGeneralStatSet
from cumin.grid.slotvis import SlotOverview
strings = StringCatalog(__file__)
@@ -48,6 +46,10 @@
def __init__(self, app, name):
cls = app.model.com_redhat_grid.Collector
+ # cls is used by ObjectFrames during the "process" pass
+ # to find self.id and self.object, the handle to an
+ # object in the db and the Rosemary representation of
+ # the object itself.
super(PoolFrame, self).__init__(app, name, cls)
self.icon_href = "resource?name=pool-36.png"
@@ -63,7 +65,7 @@
self.slot = SlotFrame(app, "slot")
self.add_mode(self.slot)
- self.scheduler = SchedulerFrame(app, "scheduler", self.object)
+ self.scheduler = SchedulerFrame(app, "scheduler")
self.add_mode(self.scheduler)
self.negotiator = NegotiatorFrame(app, "negotiator")
@@ -75,26 +77,27 @@
dashboard = PoolDashboard(app, "dashboard", self.object)
self.view.add_tab(dashboard)
- submissions = PoolSubmissionJoinSelector(app, "pool_submissions",
self.object)
+ submissions = PoolSubmissionJoinSelector(app, "pool_submissions")
self.view.add_tab(submissions)
- slots = SlotOverview(app, "slots", self.object)
+ slots = SlotOverview(app, "slots")
self.view.add_tab(slots)
- schedulers = SchedulerSelector(app, "schedulers", self.object)
+ schedulers = SchedulerSelector(app, "schedulers")
self.view.add_tab(schedulers)
- negotiators = NegotiatorSelector(app, "negotiators", self.object)
+ negotiators = NegotiatorSelector(app, "negotiators")
self.view.add_tab(negotiators)
- self.negotiator_attribute = NegotiatorAttribute(app, "neg",
self.object)
+ cls = app.model.com_redhat_grid.Negotiator
+ self.negotiator_attribute = YoungestAttribute(app, "neg", cls)
self.add_attribute(self.negotiator_attribute)
self.edit_dynamic_quota = NegotiatorEditDynamicQuota(app, self)
self.quotas = QuotaSelector(app, "quotas", self.negotiator_attribute,
self)
self.view.add_tab(self.quotas)
- self.limits = LimitSelector(app, "limits", self.object)
+ self.limits = LimitSelector(app, "limits")
self.view.add_tab(self.limits)
self.top_tab = True
@@ -112,110 +115,9 @@
def do_process(self, session):
id = self.id.get(session)
if not id:
- # get all the collectors
- collectors = self.cls.get_selection(session.cursor)
- try:
- youngest = collectors[0]
- except IndexError:
- return
+ collector = self.app.model.find_youngest(self.cls, session.cursor)
+ if collector:
+ self.id.set(session, collector._id)
- for collector in collectors:
- if collector._qmf_update_time > youngest._qmf_update_time:
- youngest = collector
- collector = youngest
- self.id.set(session, collector._id)
-
super(PoolFrame, self).do_process(session)
-class PoolOverview(Widget):
- def __init__(self, app, name, collector):
- super(PoolOverview, self).__init__(app, name)
-
- self.collector = collector
-
- self.grid = CollectorGridAttribute(app, "grid", self.collector)
- self.add_attribute(self.grid)
-
- stats = CollectorGeneralStatSet(app, "collector_stats",
self.collector)
- self.add_child(stats)
-
- stats = GridStats(app, "grid_stats", self.grid)
- self.add_child(stats)
-
- chart = self.JobStackedChart(app, "jobs", self.collector)
- chart.duration.param.default = "3600"
- chart.stats = ("RunningJobs", "IdleJobs")
- chart.chart_type = "stacked"
- self.add_child(chart)
-
- chart = self.SlotFlashChart(app, "slots", self.collector)
- chart.duration.param.default = "3600"
- chart.stats = ("HostsClaimed", "HostsUnclaimed",
"HostsOwner")
- chart.chart_type = "stacked"
- self.add_child(chart)
-
- def render_title(self, session):
- return "Overview"
-
- def render_pool_name(self, session):
- collector = self.collector.get(session)
- return collector.Name
-
- class JobStackedChart(StatFlashChart):
- def render_title(self, session):
- return "Job status"
-
- class SlotFlashChart(StatFlashChart):
- def render_title(self, session):
- return "Slot state"
-
-class GridGeneralStatSet(StatSet):
- def __init__(self, app, name, object):
- super(GridGeneralStatSet, self).__init__(app, name, object)
-
- self.attrs = ("NumJobs", "SubmitsInProgress",
- "SubmitsQueued", "SubmitsAllowed",
- "SubmitsWanted", "RunningJobs",
"IdleJobs")
-
- def do_render(self, session):
- grid = self.object.get(session)
-
- if grid:
- return super(GridGeneralStatSet, self).do_render(session)
-
-class GridStats(Widget):
- def __init__(self, app, name, grid):
- super(GridStats, self).__init__(app, name)
-
- self.grid = grid
-
- stats = GridGeneralStatSet(app, "stats", self.grid)
- self.add_child(stats)
-
- chart = self.GridJobChart(app, "jobs_chart", self.grid)
- chart.stats = ("NumJobs", "RunningJobs",
"IdleJobs")
- self.add_child(chart)
-
- chart = self.GridSubmitChart(app, "submit_chart", self.grid)
- chart.stats = ("SubmitsAllowed", "SubmitsQueued",
"SubmitsInProgress")
- self.add_child(chart)
-
- def render_grid_name(self, session):
- grid = self.grid.get(session)
-
- if grid:
- return grid.Name
-
- def do_render(self, session):
- grid = self.grid.get(session)
-
- if grid:
- return super(GridStats, self).do_render(session)
-
- class GridJobChart(StatFlashChart):
- def render_title(self, session):
- return "Grid jobs"
-
- class GridSubmitChart(StatFlashChart):
- def render_title(self, session):
- return "Grid submits"
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -16,7 +16,7 @@
log = logging.getLogger("cumin.grid.scheduler")
class SchedulerFrame(ObjectFrame):
- def __init__(self, app, name, pool):
+ def __init__(self, app, name):
cls = app.model.com_redhat_grid.Scheduler
super(SchedulerFrame, self).__init__(app, name, cls)
@@ -30,7 +30,7 @@
overview = SchedulerOverview(app, "overview", self.object)
self.view.add_tab(overview)
- submissions = SchedulerPoolSubmissionSelector(app, "submissions",
self.object, pool)
+ submissions = SchedulerPoolSubmissionSelector(app, "submissions",
self.object)
self.view.add_tab(submissions)
submitters = SubmitterSelector(app, "submitters", self.object)
@@ -40,12 +40,12 @@
#self.stop = DaemonStop(app, self, "SCHEDD")
class SchedulerPoolSubmissionSelector(PoolSubmissionSelector):
- def __init__(self, app, name, scheduler, pool):
+ def __init__(self, app, name, scheduler):
frame = "main.grid.scheduler.submission"
- super(SchedulerPoolSubmissionSelector, self).__init__(app, name, pool, frame)
+ super(SchedulerPoolSubmissionSelector, self).__init__(app, name, frame)
self.add_reference_filter(scheduler, self.cls.jobserverRef)
- self.enable_csv_export(pool, scheduler)
+ self.enable_csv_export(scheduler)
def create_table(self, app, name, cls):
return self.JoinTable(app, name, cls)
@@ -71,15 +71,11 @@
return values
class SchedulerSelector(ObjectSelector):
- def __init__(self, app, name, pool):
+ def __init__(self, app, name):
cls = app.model.com_redhat_grid.Scheduler
super(SchedulerSelector, self).__init__(app, name, cls)
- self.pool = pool
-
- self.add_filter(self.pool, cls.Pool)
-
frame = "main.grid.scheduler"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
@@ -100,7 +96,7 @@
#self.start = DaemonSelectionStart(app, self, "SCHEDD")
#self.stop = DaemonSelectionStop(app, self, "SCHEDD")
- self.enable_csv_export(pool)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
Modified: trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- trunk/cumin/python/cumin/grid/slot.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/slot.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -133,7 +133,7 @@
# start creating artificial groupings after the number of real groups
max_top_level_items = 500
- def __init__(self, app, name, param, desc):
+ def __init__(self, app, name, param=None, desc=""):
super(SlotMapPage, self).__init__(app, name)
self.object_param = param
@@ -332,8 +332,17 @@
slot_count = len(records)
root = Element()
+
+ # Not sure these are used. Code was modified
+ # when collector filtering was removed. If values
+ # are needed here they can be synthesized in the case
+ # of a collector
root.name = self.object_description
- root.value = self.object_param.get(session)._id
+ if self.object_param != None:
+ root.value = self.object_param.get(session)._id
+ else:
+ root.value = ""
+
root.slots = slot_count
json = self.json.get(session)
sequence = self.sequence.get(session)
@@ -456,9 +465,6 @@
def render_fullpageable(self, session):
return "fullpageable"
- def get_scheduler_select(self, session):
- raise Exception("Must implement get_scheduler_select")
-
def render_slot_url(self, session):
slot = Identifiable("XXX")
try:
Modified: trunk/cumin/python/cumin/grid/slotvis.py
===================================================================
--- trunk/cumin/python/cumin/grid/slotvis.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/slotvis.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -16,27 +16,21 @@
log = logging.getLogger("cumin.slotvis")
class SlotOverview(RadioModeSet):
- def __init__(self, app, name, pool):
+ def __init__(self, app, name):
super(SlotOverview, self).__init__(app, name)
- self.pool = pool
+ self.add_tab(SlotSelector(app, "slots"))
+ self.add_tab(Visualization(app, "vis"))
- self.add_tab(SlotSelector(app, "slots", pool))
- self.add_tab(Visualization(app, "vis", pool))
-
def render_title(self, session):
return "Slots"
class SlotSelector(ObjectSelector):
- def __init__(self, app, name, pool):
+ def __init__(self, app, name):
cls = app.model.com_redhat_grid.Slot
super(SlotSelector, self).__init__(app, name, cls)
- self.pool = pool
-
- self.add_filter(self.pool, cls.Pool, cls.Pool)
-
frame = "main.grid.slot"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
self.add_column(col)
@@ -49,7 +43,7 @@
self.add_column(col)
self.table.set_default_sort_column(col)
- self.enable_csv_export(pool)
+ self.enable_csv_export()
def create_table(self, app, name, cls):
# avoid the checkboxes
@@ -59,99 +53,44 @@
return "Slot table"
class Visualization(Widget):
- def __init__(self, app, name, collector):
+ def __init__(self, app, name):
super(Visualization, self).__init__(app, name)
- self.collector = collector
-
- slot_map = PoolSlotMap(app, "slot_png", self.collector)
+ slot_map = PoolSlotMap(app, "slot_png")
self.add_child(slot_map)
- slot_vis = PoolSlotFlashVis(app, "slot_map", self.collector)
+ slot_vis = PoolSlotFlashVis(app, "slot_map")
self.add_child(slot_vis)
def render_title(self, session):
return "Slot visualization"
class PoolSlotMap(SlotMap):
- def __init__(self, app, name, collector):
- super(PoolSlotMap, self).__init__(app, name)
-
- self.collector = collector
-
- def do_process(self, session):
- super(PoolSlotMap, self).do_process(session)
-
- collector = self.collector.get(session)
-
- self.slots.add_where_expr(session, "\"Pool\" = '%s'",
collector.Pool)
-
def render_image_href(self, session):
- collector = self.collector.get(session)
-
page = self.app.grid.pool_slots_page
- sess = Session(page)
+ return Session(page).marshal()
- page.collector.set(sess, collector)
-
- return sess.marshal()
-
- def get_scheduler_select(self, session):
- pass
- #pool = self.pool.get(session)
-
-class PoolSlotMapPage(SlotMapPage):
+class PoolSlotFlashVis(PoolSlotMap):
def __init__(self, app, name):
- cls = app.model.com_redhat_grid.Collector
- self.collector = RosemaryObjectParameter(app, "id", cls)
+ super(PoolSlotFlashVis, self).__init__(app, name)
- super(PoolSlotMapPage, self).__init__(app, name, self.collector,
"Pool")
-
- self.add_parameter(self.collector)
-
- def do_process(self, session):
- super(PoolSlotMapPage, self).do_process(session)
-
- collector = self.collector.get(session)
-
- # XXX The conditional is necessary because this page is
- # overloaded to generate little dots, in which case it has no
- # pool
-
- if collector:
- self.slots.add_where_expr(session, "\"Pool\" =
'%s'", collector.Pool)
-
-class PoolSlotFlashVis(PoolSlotMap):
- def __init__(self, app, name, object):
- super(PoolSlotFlashVis, self).__init__(app, name, object)
-
self.group_by = self.GroupBySwitch(app, "group_by")
self.add_child(self.group_by)
self.fullpageable = True
def render_slots_href(self, session):
- collector = self.collector.get(session)
-
page = self.app.grid.pool_slots_page
sess = Session(page)
-
- page.collector.set(sess, collector)
page.json.set(sess, "slots")
page.group.set(sess, self.group_by.get(session))
return sess.marshal()
def render_image_href(self, session):
- collector = self.collector.get(session)
-
page = self.app.grid.pool_slots_page
- sess = Session(page)
+ return Session(page).marshal()
- page.collector.set(sess, collector)
-
- return sess.marshal()
-
def render_slot_chart_width(self, session):
return 740
@@ -172,13 +111,8 @@
return self.fullpageable and "fullpageable" or ""
def render_fullpage_href(self, session):
- collector = self.collector.get(session)
-
page = self.app.grid.pool_slots_fullpage
sess = Session(page)
-
- page.collector.set(sess, collector)
-
return sess.marshal()
class GroupBySwitch(StateSwitch):
@@ -197,11 +131,7 @@
def __init__(self, app, name):
super(PoolSlotFullPage, self).__init__(app, name)
- cls = app.model.com_redhat_grid.Collector
- self.collector = RosemaryObjectParameter(app, "id", cls)
- self.add_parameter(self.collector)
-
- self.flash_chart = PoolSlotFlashVis(app, "chart", self.collector)
+ self.flash_chart = PoolSlotFlashVis(app, "chart")
self.flash_chart.fullpageable = False
self.replace_child(self.flash_chart)
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/grid/submission.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -80,13 +80,8 @@
return ObjectTable(app, name, cls)
class PoolSubmissionSelector(SubmissionSelector):
- def __init__(self, app, name, pool, frame="main.grid.submission"):
+ def __init__(self, app, name, frame="main.grid.submission"):
super(PoolSubmissionSelector, self).__init__(app, name)
-
- self.pool = pool
-
- cls = app.model.com_redhat_grid.JobServer
- self.add_filter(self.pool, cls.Pool)
col = self.PoolSubmissionObjectLinkColumn(app, "name", self.cls.Name,
self.cls._id, frame)
self.insert_column(0, col)
@@ -96,21 +91,18 @@
col = ObjectTableColumn(app, attr.name, attr)
self.insert_column(1, col)
- link = self.PoolSubmitLink(app, "job_submit", app.grid.job_submit)
+ # Removed PoolSubmitLink, derived from TaskLink, because the
+ # the only method supplied was do_enter which does not exist
+ # in the parent. There are do_enter methods on Tasks,
+ # but not on TaskLinks; this was probably a mistake. 06/7/2001
+ link = TaskLink(app, "job_submit", app.grid.job_submit)
self.links.add_child(link)
- link = self.PoolSubmitLink \
- (app, "dag_job_submit", app.grid.dag_job_submit)
+ link = TaskLink(app, "dag_job_submit", app.grid.dag_job_submit)
self.links.add_child(link)
- link = self.PoolSubmitLink \
- (app, "vm_job_submit", app.grid.vm_job_submit)
+ link = TaskLink(app, "vm_job_submit", app.grid.vm_job_submit)
self.links.add_child(link)
-
- class PoolSubmitLink(TaskLink):
- def do_enter(self, session, obj, form_session):
- pool = self.parent.pool.get(session)
- self.form.pool_name.set(form_session, pool.Pool)
class PoolSubmissionObjectLinkColumn(ObjectLinkColumn):
def render_cell_content(self, session, record):
@@ -118,11 +110,10 @@
if(len(record[self.field.index]) > 50):
retval = record[self.field.index][:50] + "..." #indicate that
we truncated the name
return retval
-
class PoolSubmissionJoinSelector(PoolSubmissionSelector):
- def __init__(self, app, name, pool):
- super(PoolSubmissionJoinSelector, self).__init__(app, name, pool)
+ def __init__(self, app, name):
+ super(PoolSubmissionJoinSelector, self).__init__(app, name)
scheduler = app.model.com_redhat_grid.Scheduler
self.SchedulerJoin(app, self.table.adapter.query, self.cls.sql_table,
@@ -132,7 +123,7 @@
col = self.SchedulerColumn(app, "Scheduler", scheduler.Name,
scheduler._id, frame)
self.insert_column(2, col)
- self.enable_csv_export(pool)
+ self.enable_csv_export()
class SchedulerColumn(ObjectLinkColumn):
def render_header_content(self, session):
@@ -186,11 +177,9 @@
return "This text will identify the submission"
class JobSchedulerField(ScalarField):
- def __init__(self, app, name, pool_name):
+ def __init__(self, app, name):
super(JobSchedulerField, self).__init__(app, name, None)
- self.pool_name = pool_name
-
self.param = IntegerParameter(app, "param")
self.add_parameter(self.param)
@@ -237,14 +226,7 @@
def do_get_items(self, session):
cls = self.app.model.com_redhat_grid.Scheduler
-
- pool_name = self.parent.pool_name.get(session)
-
- if pool_name:
- schedulers = cls.get_selection(session.cursor, Pool=pool_name)
- else:
- schedulers = cls.get_selection(session.cursor)
-
+ schedulers = cls.get_selection(session.cursor)
return schedulers
def render_item_value(self, session, item):
@@ -388,9 +370,6 @@
cls = app.model.com_redhat_grid.Scheduler
super(JobSubmitForm, self).__init__(app, name, task, cls)
- self.pool_name = Attribute(app, "pool")
- self.add_attribute(self.pool_name)
-
self.description = JobDescriptionField(app, "description")
self.add_field(self.description)
@@ -413,7 +392,7 @@
self.directory.help = "Run the process in this directory"
self.add_field(self.directory)
- self.scheduler = JobSchedulerField(app, "scheduler", self.pool_name)
+ self.scheduler = JobSchedulerField(app, "scheduler")
self.add_extra_field(self.scheduler)
self.universe = self.UniverseField(app, "universe")
@@ -692,9 +671,6 @@
cls = app.model.com_redhat_grid.Scheduler
super(VmJobSubmitForm, self).__init__(app, name, task, cls)
- self.pool_name = Attribute(app, "pool")
- self.add_attribute(self.pool_name)
-
self.description = JobDescriptionField(app, "description")
self.add_field(self.description)
@@ -710,7 +686,7 @@
self.request_disk_MB = self.RequestDiskField(app, "requestdisk")
self.add_extra_field(self.request_disk_MB)
- self.scheduler = JobSchedulerField(app, "scheduler", self.pool_name)
+ self.scheduler = JobSchedulerField(app, "scheduler")
self.add_extra_field(self.scheduler)
self.attrs = JobAttributesField(app, "attrs")
@@ -830,9 +806,6 @@
cls = app.model.com_redhat_grid.Scheduler
super(DagJobSubmitForm, self).__init__(app, name, task, cls)
- self.pool_name = Attribute(app, "pool")
- self.add_attribute(self.pool_name)
-
self.description = JobDescriptionField(app, "description")
self.add_field(self.description)
@@ -842,7 +815,7 @@
self.location.input.size = 50
self.add_field(self.location)
- self.scheduler = JobSchedulerField(app, "scheduler", self.pool_name)
+ self.scheduler = JobSchedulerField(app, "scheduler")
self.add_extra_field(self.scheduler)
self.attrs = JobAttributesField(app, "attrs")
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/inventory/system.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -130,10 +130,6 @@
def render_slot_url(self, session):
return ""
- def get_scheduler_select(self, session):
- system = self.system.get(session)
- return "system='%s'" % system.nodeName
-
class SystemSlotFlashVis(SystemSlotMap):
def render_slots_href(self, session):
system = self.system.get(session)
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/main.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -554,30 +554,34 @@
for record in data:
# if we can't get the collector, don't render the row
submission_id = record[0]
- collector = self.get_collector(session, submission_id)
- if collector:
+
+ job_server = self.get_job_server(session, submission_id)
+ if job_server:
writer.write(self.row.render(session, record))
-
return writer.to_string()
- def get_collector(self, session, submission_id):
+ def get_job_server(self, session, submission_id):
try:
- cls = self.cls
- submission = cls.get_object_by_id(session.cursor, submission_id)
-
+ submission = self.cls.get_object_by_id(session.cursor, submission_id)
cls = self.app.model.com_redhat_grid.JobServer
- job_server = cls.get_object_by_id(session.cursor,
submission._jobserverRef_id)
-
- cls = self.app.model.com_redhat_grid.Collector
- return cls.get_object(session.cursor, Pool=job_server.Pool)
+ return cls.get_object_by_id(session.cursor, submission._jobserverRef_id)
except Exception, e:
log.exception(e)
class NameColumn(ObjectLinkColumn):
def render_cell_href(self, session, record):
submission_id = record[0]
- collector = self.parent.get_collector(session, submission_id)
- if collector:
+
+ cls = self.app.model.com_redhat_grid.Collector
+ collector = self.app.model.find_youngest(cls, session.cursor)
+ job_server = self.parent.get_job_server(session, submission_id)
+
+ # XXX BZ699413
+ # The collector id in the session is referenced by a bunch of
+ # classes, so it still needs to exist, even though it is not
+ # used for filtering. Try to remove references to it in another
+ # pass.
+ if job_server and collector:
branch = session.branch()
self.page.main.grid.id.set(session, collector._id)
self.page.main.grid.submission.id.set(session, submission_id)
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/objectframe.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -15,9 +15,15 @@
self.cls = cls
+ # This will hold the id of the object that should be assigned
+ # to self.object (it is the _id field from a sql table).
+ # Both the id and the object are typically determined during
+ # the "process" pass before a page is rendered.
self.id = IntegerParameter(app, "id")
self.add_parameter(self.id)
+ # This will be given a value during the "process" pass after
+ # self.id is determined (lookup by id)
self.object = Attribute(app, "object")
self.add_attribute(self.object)
Modified: trunk/cumin/python/cumin/parameters.py
===================================================================
--- trunk/cumin/python/cumin/parameters.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/parameters.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -10,16 +10,6 @@
return login.user
-class ObjectAssociateAttribute(Attribute):
- def __init__(self, app, name, object):
- super(ObjectAssociateAttribute, self).__init__(app, name)
-
- self.object = object
-
- def get(self, session):
- obj = self.object.get(session)
- return self.get_associate(session, obj)
-
class CuminClassParameter(Parameter):
def do_unmarshal(self, string):
return getattr(self.app.model, string, None)
@@ -61,6 +51,19 @@
obj = session.get(self.path)
return obj
+class YoungestAttribute(Attribute):
+ def __init__(self, app, name, cls):
+ super(YoungestAttribute, self).__init__(app, name)
+ self.cls = cls
+
+ def get(self, session):
+ val = super(YoungestAttribute, self).get(session)
+ if not val:
+ val = self.app.model.find_youngest(self.cls, session.cursor)
+ if val:
+ self.set(session, val)
+ return val
+
class BrokerGroupParameter(Parameter):
def do_unmarshal(self, string):
if string == "__none__":
@@ -120,12 +123,6 @@
class PeerParameter(LinkParameter):
pass
-class CollectorGridAttribute(ObjectAssociateAttribute):
- def get_associate(self, session, collector):
- cls = self.app.model.com_redhat_grid.Grid
- grid = cls.get_object(session.cursor, Pool=collector.Pool)
- return grid
-
class QueueParameter(Parameter):
def do_unmarshal(self, string):
return Queue.get(int(string))
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/cumin/python/cumin/stat.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -33,7 +33,9 @@
return self.attrs
def do_get_items(self, session):
- object = self.object.get(session)
+ object = None
+ if self.object:
+ object = self.object.get(session)
if not object:
return []
Modified: trunk/rosemary/python/rosemary/model.py
===================================================================
--- trunk/rosemary/python/rosemary/model.py 2011-06-08 18:58:28 UTC (rev 4804)
+++ trunk/rosemary/python/rosemary/model.py 2011-06-09 14:47:07 UTC (rev 4805)
@@ -78,6 +78,21 @@
for pkg in self._packages:
pkg.init_references()
+ @classmethod
+ def find_youngest(cls, rosemary_cls, cursor, **criteria):
+ youngest = None
+ if rosemary_cls._storage != "none":
+ try:
+ objects = rosemary_cls.get_selection(cursor, **criteria)
+ if len(objects) > 0:
+ youngest = objects[0]
+ for obj in objects:
+ if obj._qmf_update_time > youngest._qmf_update_time:
+ youngest = obj
+ except:
+ pass
+ return youngest
+
class RosemaryPackage(object):
def __init__(self, model, name):
self._model = model