Author: tmckay
Date: 2011-09-30 14:45:15 +0000 (Fri, 30 Sep 2011)
New Revision: 5031
Modified:
trunk/cumin/model/condor.xml
trunk/cumin/model/rosemary.xml
trunk/cumin/model/upgrades/1.0_to_1.1
trunk/cumin/python/cumin/grid/pool.py
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/objectframe.py
trunk/cumin/python/cumin/objectframe.strings
Log:
Add QDate column to submission table in Postgres, add qdate column to submissions under
admin tab,
remove scheduler column from same and add a scheduler link to the SubmissionFrame.
BZ639383
Modified: trunk/cumin/model/condor.xml
===================================================================
--- trunk/cumin/model/condor.xml 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/model/condor.xml 2011-09-30 14:45:15 UTC (rev 5031)
@@ -810,6 +810,8 @@
<property name="Name" type="sstr" index="y"/>
<property name="Owner" type="sstr" index="y"/>
+ <property name="QDate" type="absTime" optional="y"
+ desc="Oldest QDate of member jobs"/>
<statistic name="Idle" type="count32"/>
<statistic name="Running" type="count32"/>
Modified: trunk/cumin/model/rosemary.xml
===================================================================
--- trunk/cumin/model/rosemary.xml 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/model/rosemary.xml 2011-09-30 14:45:15 UTC (rev 5031)
@@ -502,6 +502,9 @@
<property name="Name">
<title>Description</title>
</property>
+ <property name="QDate">
+ <title>Enqueued</title>
+ </property>
</class>
<class name="Negotiator">
Modified: trunk/cumin/model/upgrades/1.0_to_1.1
===================================================================
--- trunk/cumin/model/upgrades/1.0_to_1.1 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/model/upgrades/1.0_to_1.1 2011-09-30 14:45:15 UTC (rev 5031)
@@ -1,2 +1,3 @@
#!/bin/bash
echo create index \"Submission_Name_idx\" on
\"com.redhat.grid\".\"Submission\"\(\"Name\"\) | psql -d
cumin -U cumin -h localhost
+echo alter table \"com.redhat.grid\".\"Submission\" add column
\"QDate\" timestamp | psql -d cumin -U cumin -h localhost
Modified: trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- trunk/cumin/python/cumin/grid/pool.py 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/python/cumin/grid/pool.py 2011-09-30 14:45:15 UTC (rev 5031)
@@ -9,7 +9,7 @@
from cumin.grid.dashboard import PoolDashboard
from cumin.grid.tags import TagsNodeEditTask, TagsFrame, TagInventory
-from submission import SubmissionFrame, PoolSubmissionJoinSelector
+from submission import PoolSubmissionFrame, PoolSubmissionJoinSelector
from slot import SlotFrame
from scheduler import SchedulerFrame, SchedulerSelector
from negotiator import NegotiatorFrame, NegotiatorSelector,\
@@ -61,7 +61,7 @@
self.mode.default = self.view
- self.submission = SubmissionFrame(app, "submission")
+ self.submission = PoolSubmissionFrame(app, "submission")
self.add_mode(self.submission)
self.slot = SlotFrame(app, "slot")
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/python/cumin/grid/submission.py 2011-09-30 14:45:15 UTC (rev 5031)
@@ -4,7 +4,7 @@
import os
from job import JobSelector, JobFrame
-from cumin.objectframe import ObjectFrame
+from cumin.objectframe import ObjectFrame, ObjectView, ObjectViewSummary,
ObjectViewContext
from cumin.sqladapter import ObjectSqlAdapter
from cumin.objectselector import ObjectSelector, ObjectLinkColumn,\
ObjectTableColumn, ObjectTable
@@ -33,6 +33,35 @@
jobs = JobSelector(app, "jobs", self.object)
self.view.add_tab(jobs)
+class PoolSubmissionFrame(SubmissionFrame):
+ # Use an ObjectView derivation here so that
+ # SubmissionFrame can use a different summary class later on...
+ def get_view(self, app, name, obj):
+ return self.MyObjectView(app, name, obj)
+
+ class MyObjectView(ObjectView):
+ def get_summary(self, app, name, obj):
+ return PoolSubmissionFrame.MyObjectViewSummary(app, name, obj)
+
+ class MyObjectViewSummary(ObjectViewSummary):
+ def get_scheduler(self, session):
+ # Find out submission
+ subm = self.frame.get_object(session,
+ self.frame.id.get(session))
+
+ # Get a scheduler...
+ js = self.app.model.get_jobserver_from_submission(session, subm)
+ return self.app.model.get_scheduler_from_jobserver(session, js)
+
+ def render_auxlink(self, session):
+ sch = self.get_scheduler(session)
+ frame = self.page.page_widgets_by_path["main.grid.scheduler"]
+ return frame.get_href(session, sch._id)
+
+ def render_auxtitle(self, session):
+ sch = self.get_scheduler(session)
+ return "Scheduler '%s'" % sch.Name
+
class SubmissionData(ObjectSqlAdapter):
def __init__(self, app):
submission = app.model.com_redhat_grid.Submission
@@ -70,6 +99,9 @@
self.table.adapter = SubmissionData(app)
+ col = self.QDateColumn(app, cls.QDate.name, cls.QDate)
+ self.add_column(col)
+
self.add_attribute_column(cls.Idle)
self.add_attribute_column(cls.Running)
self.add_attribute_column(cls.Completed)
@@ -79,6 +111,14 @@
# avoid the checkboxes
return ObjectTable(app, name, cls)
+ class QDateColumn(ObjectTableColumn):
+ def render_cell_content(self, session, data):
+ date = super(SubmissionSelector.QDateColumn, self).\
+ render_cell_content(session, data)
+ if date is None:
+ date = "unknown"
+ return date
+
class PoolSubmissionSelector(SubmissionSelector):
def __init__(self, app, name, frame="main.grid.submission"):
super(PoolSubmissionSelector, self).__init__(app, name)
@@ -119,9 +159,9 @@
self.SchedulerJoin(app, self.table.adapter.query, self.cls.sql_table,
self.cls.jobserverRef.sql_column, "jid")
- frame = "main.grid.scheduler"
- col = self.SchedulerColumn(app, "Scheduler", scheduler.Name,
scheduler._id, frame)
- self.insert_column(2, col)
+ #frame = "main.grid.scheduler"
+ #col = self.SchedulerColumn(app, "Scheduler", scheduler.Name,
scheduler._id, frame)
+ #self.insert_column(2, col)
self.enable_csv_export()
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/python/cumin/main.py 2011-09-30 14:45:15 UTC (rev 5031)
@@ -598,8 +598,10 @@
col = self.NameColumn(app, cls.Name.name, cls.Name, cls._id, None)
self.add_column(col)
- col = self.DurationColumn(app, cls._qmf_create_time.name,
- cls._qmf_create_time)
+# col = self.DurationColumn(app, cls._qmf_create_time.name,
+# cls._qmf_create_time)
+
+ col = self.DurationColumn(app, cls.QDate.name, cls.QDate)
self.add_column(col)
self.set_default_sort_column(col)
@@ -664,9 +666,12 @@
return "Duration"
def render_cell_content(self, session, record):
- created = self.field.get_content(session, record)
+ qdate = self.field.get_content(session, record)
+ if qdate is None:
+ return 0
+
import time
- return fmt_duration(time.time() - secs(created))
+ return fmt_duration(time.time() - secs(qdate))
def render_text_align(self, session):
return "right"
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/python/cumin/objectframe.py 2011-09-30 14:45:15 UTC (rev 5031)
@@ -27,7 +27,8 @@
self.object = Attribute(app, "object")
self.add_attribute(self.object)
- self.view = ObjectView(app, "view", self.object)
+ self.view = self.get_view(app, "view", self.object)
+ #self.view = ObjectView(app, "view", self.object)
self.add_child(self.view)
self.icon_href = "resource?name=action-36.png"
@@ -71,6 +72,9 @@
def get_object(self, session, id):
return self.cls.get_object_by_id(session.cursor, id)
+ def get_view(self, app, name, obj):
+ return ObjectView(app, name, obj)
+
class ObjectAttributes(Widget):
def __init__(self, app, name, object):
super(ObjectAttributes, self).__init__(app, name)
@@ -195,7 +199,8 @@
self.heading = ObjectViewHeading(app, "heading", self.object)
self.add_child(self.heading)
- self.summary = ObjectViewSummary(app, "summary", self.object)
+ self.summary = self.get_summary(app, "summary", self.object)
+# self.summary = ObjectViewSummary(app, "summary", self.object)
self.add_child(self.summary)
self.body = TabbedModeSet(app, "body")
@@ -219,10 +224,14 @@
if obj is not None:
title = obj.get_title()
else:
- # useful in the case where we are dealing with non-database objects and the
object title is passed in as the id
+ # useful in the case where we are dealing with
+ # non-database objects and the object title is passed in as the id
title = self.frame.id.get(session)
return title
+ def get_summary(self, app, name, obj):
+ return ObjectViewSummary(app, name, obj)
+
class ObjectViewChild(Widget):
def __init__(self, app, name, object):
super(ObjectViewChild, self).__init__(app, name)
@@ -290,7 +299,6 @@
retval = retval[:100] + "..."
return retval
-
class ObjectViewSummary(ObjectViewChild):
def __init__(self, app, name, object):
super(ObjectViewSummary, self).__init__(app, name, object)
@@ -298,11 +306,19 @@
tasks = SummaryTasks(app, "tasks", self.object)
self.add_child(tasks)
+ self.auxlink = None
+
def render_wide(self, session):
visible_tasks = [x for x in self.frame.tasks if x.visible]
if len(visible_tasks) > 6:
return "wide"
+ def render_auxlink(self, session):
+ pass
+
+ def render_auxtitle(self, session):
+ pass
+
class DetailsAttributes(ObjectAttributes):
pass
Modified: trunk/cumin/python/cumin/objectframe.strings
===================================================================
--- trunk/cumin/python/cumin/objectframe.strings 2011-09-30 14:25:25 UTC (rev 5030)
+++ trunk/cumin/python/cumin/objectframe.strings 2011-09-30 14:45:15 UTC (rev 5031)
@@ -126,13 +126,13 @@
[ObjectViewHeading.html]
<div class="{class}">
<img src="{icon_href}" alt="icon"/>
-
<h1>{title}</h1>
</div>
[ObjectViewSummary.html]
<div class="{class} {wide}">
{tasks}
+ <a href="{auxlink}">{auxtitle}</a>
</div>
[ObjectViewContext.html]