r4841 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-17 16:54:24 +0000 (Fri, 17 Jun 2011)
New Revision: 4841
Modified:
trunk/cumin/python/cumin/grid/submission.py
Log:
Change freshness filter to correspond to changes that were checked into branch 'stability'
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2011-06-17 16:47:45 UTC (rev 4840)
+++ trunk/cumin/python/cumin/grid/submission.py 2011-06-17 16:54:24 UTC (rev 4841)
@@ -51,7 +51,7 @@
table = cls.sql_table
- fmt = "(%s > now() - interval '3 days' or %s > 0 or %s > 0 or %s > 0)"
+ fmt = "(%s > now() - interval '10 days' or %s > 0 or %s > 0 or %s > 0)"
args = (table._qmf_update_time.identifier,
table.Idle.identifier,
table.Running.identifier,
12 years, 11 months
r4840 - branches/clarity/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-17 16:47:45 +0000 (Fri, 17 Jun 2011)
New Revision: 4840
Modified:
branches/clarity/wooly/python/wooly/sql.py
Log:
Merge revision 4759 from trunk.
(Note, as of this commit, clarity branch is actually identical to trunk.
Not intentional, but happens to be true nonetheless)
Modified: branches/clarity/wooly/python/wooly/sql.py
===================================================================
--- branches/clarity/wooly/python/wooly/sql.py 2011-06-17 16:43:23 UTC (rev 4839)
+++ branches/clarity/wooly/python/wooly/sql.py 2011-06-17 16:47:45 UTC (rev 4840)
@@ -118,9 +118,9 @@
def render_sql_where(self, session):
exprs = self.where_exprs.get(session)
+ if exprs:
+ return "where %s" % " and ".join(exprs)
- return "where %s" % " and ".join(exprs)
-
def render_sql_order_by(self, session):
pass
12 years, 11 months
r4839 - branches/clarity/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-17 16:43:23 +0000 (Fri, 17 Jun 2011)
New Revision: 4839
Modified:
branches/clarity/cumin/python/cumin/model.py
Log:
Merge revision 4760 from trunk.
Gets rid of CuminStat class, dead code.
Modified: branches/clarity/cumin/python/cumin/model.py
===================================================================
--- branches/clarity/cumin/python/cumin/model.py 2011-06-17 16:38:37 UTC (rev 4838)
+++ branches/clarity/cumin/python/cumin/model.py 2011-06-17 16:43:23 UTC (rev 4839)
@@ -435,121 +435,6 @@
return "%s %s" % (pred0, pred1)
-class CuminStat(object):
- def __init__(self, cls, name):
- self.model = cls.model
- self.cumin_class = cls
-
- self.name = name
- self.unit = None
- self.title = None
- self.category = "general"
- self.summary = False
- self.format = None
-
- self.link_cb = None
- self.highlow = False
-
- self.cumin_class.add_stat(self)
-
- def init(self):
- pass
-
- def get_connection(self):
- return self.app.database.get_connection()
-
- def get_db_name(self):
- name = self.name
- nname = list()
- for c in name:
- if c.isupper():
- if len(nname):
- nname.append("_")
- c = c.lower()
- nname.append(c)
- return "".join(nname)
-
- def value_html(self, object):
- text = self.value_text(object)
-
- if text:
- html = text
- else:
- html = fmt_none_brief()
-
- return html
-
- def value_text(self, object):
- value = self.value(object)
-
- if value is None:
- text = ""
- elif self.format:
- text = self.format % value
- elif type(value) in (int, long, Decimal):
- if value == 0:
- text = "0"
- else:
- text = "%i" % value
- else:
- text = "%r" % value
-
- return text
-
- def value(self, object):
- try:
- return getattr(object, self.name)
- except AttributeError:
- pass
-
- def rate_html(self, object):
- text = self.rate_text(object)
-
- if text:
- html = text
- else:
- html = fmt_none_brief()
-
- return html
-
- def rate_text(self, object):
- rate = self.rate(object)
-
- if rate is None:
- text = ""
- elif rate == 0:
- text = "0"
- else:
- text = "%0.2f" % rate
-
- return text
-
- def rate(self, object):
- threshold = datetime.now() - timedelta(minutes=10)
-
- try:
- if object.statsCurr and object.statsCurr.qmfUpdateTime > threshold:
- curr = getattr(object.statsCurr, self.name)
- ctime = object.statsCurr.qmfUpdateTime
- csecs = mktime(ctime.timetuple())
-
- if object.statsPrev:
- prev = getattr(object.statsPrev, self.name)
- ptime = object.statsPrev.qmfUpdateTime
- psecs = mktime(ptime.timetuple())
-
- if curr is not None and prev is not None:
- return calc_rate(curr, prev, csecs, psecs)
- except AttributeError:
- pass
-
- def write_xml(self, writer, object):
- value = self.value_text(object)
- rate = self.rate_text(object)
-
- writer.write("<stat name=\"%s\" value=\"%s\" rate=\"%s\"/>" \
- % (self.name, value, rate))
-
class SamplesSqlAdapter(SqlAdapter):
qmf_update_col = '_qmf_update_time'
12 years, 11 months
r4838 - branches/clarity/cumin/python/cumin/usergrid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-17 16:38:37 +0000 (Fri, 17 Jun 2011)
New Revision: 4838
Modified:
branches/clarity/cumin/python/cumin/usergrid/model.py
Log:
Merge revision 4758 from trunk.
This uses a read connection to the db instead of a read write, for efficiency.
Modified: branches/clarity/cumin/python/cumin/usergrid/model.py
===================================================================
--- branches/clarity/cumin/python/cumin/usergrid/model.py 2011-06-17 16:33:03 UTC (rev 4837)
+++ branches/clarity/cumin/python/cumin/usergrid/model.py 2011-06-17 16:38:37 UTC (rev 4838)
@@ -15,7 +15,7 @@
return self.user.get(session).name
def get_connection(self, session):
- return self.app.database.get_connection()
+ return self.app.database.get_read_connection()
def get_object(self, session):
cursor = self.execute(session)
12 years, 11 months
r4837 - in branches/clarity/cumin/python/cumin: . grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-17 16:33:03 +0000 (Fri, 17 Jun 2011)
New Revision: 4837
Modified:
branches/clarity/cumin/python/cumin/grid/job.py
branches/clarity/cumin/python/cumin/objectselector.py
Log:
Merge 4836 from trunk.
Modified: branches/clarity/cumin/python/cumin/grid/job.py
===================================================================
--- branches/clarity/cumin/python/cumin/grid/job.py 2011-06-16 15:10:11 UTC (rev 4836)
+++ branches/clarity/cumin/python/cumin/grid/job.py 2011-06-17 16:33:03 UTC (rev 4837)
@@ -5,7 +5,7 @@
ObjectFrameTask
from cumin.qmfadapter import ObjectQmfAdapter
from cumin.objectselector import ObjectTableColumn, ObjectLinkColumn,\
- ObjectQmSelectorfTable, ObjectCheckboxColumn,\
+ ObjectQmfSelectorTable, ObjectCheckboxColumn,\
ObjectSelectorTask, ObjectSelectorTaskForm, ObjectQmfSelector
from cumin.widgets import StaticColumnHeader, Wait, CuminForm,\
EditablePropertyRenderer, StateSwitch
@@ -270,7 +270,7 @@
submission = self.parent.parent.submission.get(session)
return frame.get_href(session, submission._id, job_id)
-class JobSelectorTable(ObjectQmSelectorfTable):
+class JobSelectorTable(ObjectQmfSelectorTable):
def init_ids(self, app, cls):
item = Parameter(app, "item")
Modified: branches/clarity/cumin/python/cumin/objectselector.py
===================================================================
--- branches/clarity/cumin/python/cumin/objectselector.py 2011-06-16 15:10:11 UTC (rev 4836)
+++ branches/clarity/cumin/python/cumin/objectselector.py 2011-06-17 16:33:03 UTC (rev 4837)
@@ -706,5 +706,5 @@
class ObjectQmfTable(QmfValues, ObjectTable):
pass
-class ObjectQmSelectorfTable(QmfValues, ObjectSelectorTable):
+class ObjectQmfSelectorTable(QmfValues, ObjectSelectorTable):
pass
12 years, 11 months
r4836 - in trunk/cumin/python/cumin: . grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-16 15:10:11 +0000 (Thu, 16 Jun 2011)
New Revision: 4836
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/objectselector.py
Log:
Fix typo in class name ObjectQmSelectorfTable
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-06-15 19:44:41 UTC (rev 4835)
+++ trunk/cumin/python/cumin/grid/job.py 2011-06-16 15:10:11 UTC (rev 4836)
@@ -5,7 +5,7 @@
ObjectFrameTask
from cumin.qmfadapter import ObjectQmfAdapter
from cumin.objectselector import ObjectTableColumn, ObjectLinkColumn,\
- ObjectQmSelectorfTable, ObjectCheckboxColumn,\
+ ObjectQmfSelectorTable, ObjectCheckboxColumn,\
ObjectSelectorTask, ObjectSelectorTaskForm, ObjectQmfSelector
from cumin.widgets import StaticColumnHeader, Wait, CuminForm,\
EditablePropertyRenderer, StateSwitch
@@ -270,7 +270,7 @@
submission = self.parent.parent.submission.get(session)
return frame.get_href(session, submission._id, job_id)
-class JobSelectorTable(ObjectQmSelectorfTable):
+class JobSelectorTable(ObjectQmfSelectorTable):
def init_ids(self, app, cls):
item = Parameter(app, "item")
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2011-06-15 19:44:41 UTC (rev 4835)
+++ trunk/cumin/python/cumin/objectselector.py 2011-06-16 15:10:11 UTC (rev 4836)
@@ -706,5 +706,5 @@
class ObjectQmfTable(QmfValues, ObjectTable):
pass
-class ObjectQmSelectorfTable(QmfValues, ObjectSelectorTable):
+class ObjectQmfSelectorTable(QmfValues, ObjectSelectorTable):
pass
12 years, 11 months
r4835 - in branches/clarity: cumin/model mint/python/mint rosemary/python/rosemary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-15 19:44:41 +0000 (Wed, 15 Jun 2011)
New Revision: 4835
Modified:
branches/clarity/cumin/model/rosemary.xml
branches/clarity/mint/python/mint/update.py
branches/clarity/rosemary/python/rosemary/model.py
Log:
Merge 4834 from trunk.
(BZ702440 tweaks)
Modified: branches/clarity/cumin/model/rosemary.xml
===================================================================
--- branches/clarity/cumin/model/rosemary.xml 2011-06-15 17:41:26 UTC (rev 4834)
+++ branches/clarity/cumin/model/rosemary.xml 2011-06-15 19:44:41 UTC (rev 4835)
@@ -1,5 +1,5 @@
<model>
- <package name="com.redhat.cumin">
+ <package name="com.redhat.cumin" persistent="y">
<class name="User">
<property name="name" unique="y"/>
</class>
Modified: branches/clarity/mint/python/mint/update.py
===================================================================
--- branches/clarity/mint/python/mint/update.py 2011-06-15 17:41:26 UTC (rev 4834)
+++ branches/clarity/mint/python/mint/update.py 2011-06-15 19:44:41 UTC (rev 4835)
@@ -29,8 +29,11 @@
def _delete_all_objects(self):
def loop_body(cls):
if cls._storage != "none":
- cls.delete_selection(self.cursor)
- self.cursor.connection.commit()
+ if cls.check_persistent():
+ log.debug("Skipping persistent class " + str(cls))
+ else:
+ cls.delete_selection(self.cursor)
+ self.cursor.connection.commit()
if len(self.app.qmf_classes):
log.debug("Delete all objects by bound classes " + str(self.app.qmf_classes))
@@ -614,7 +617,7 @@
def delete_agent_objects(self, cursor, stats, agent, bound_classes, bound_packages):
def loop_body(cls):
- if cls._storage != "none": # and cls is not self.model.com_redhat_grid.Collector:
+ if cls._storage != "none" and not cls.check_persistent():
count = cls.delete_selection(cursor, _qmf_agent_id=agent.id)
stats.objects_deleted += count
#stats.objects_deleted_by_class[cls] += count
Modified: branches/clarity/rosemary/python/rosemary/model.py
===================================================================
--- branches/clarity/rosemary/python/rosemary/model.py 2011-06-15 17:41:26 UTC (rev 4834)
+++ branches/clarity/rosemary/python/rosemary/model.py 2011-06-15 19:44:41 UTC (rev 4835)
@@ -56,12 +56,20 @@
file.close()
def load(self, elem):
+ # This is an attribute on a top level tag,
+ # it should correspond to something like <schema package="blah">
attr = elem.get("package")
if attr:
pkg = RosemaryPackage(self, attr)
pkg.load(elem)
+ # This on the other hand is a tag itself. It should
+ # correspond to something like
+ # <model>
+ # <package ....>
+ # stuff
+ # </package>
for child in elem.findall("package"):
pkg = RosemaryPackage(self, child.get("name"))
pkg.load(child)
@@ -98,6 +106,18 @@
self._model = model
self._name = name
+ # Set in the extension xml file. This marks a package as
+ # containing persistent data which should not be deleted
+ # by cumin-data on startup or in association with
+ # the comings and goings of agents. Rather, it
+ # should be manipulated by specific interfaces.
+ # com.redhat.cumin is an example.
+
+ # Note, "persistent" may also be set at the class
+ # level in cases where packages contain both persistent
+ # and non-persistent data.
+ self.persistent = False
+
self._model._packages.append(self)
self._model._packages_by_name[self._name] = self
@@ -126,6 +146,10 @@
cls.load(child, groups_by_name)
def extend(self, elem):
+ persistent = elem.get("persistent")
+ if persistent is not None:
+ self.persistent = persistent == "y"
+
for child in elem.findall("class"):
cls = self._classes_by_name[child.get("name")]
cls.extend(child)
@@ -147,6 +171,10 @@
self._package = package
self._name = name
+ # If _persistent is None, check_persistent will
+ # return the value from self._package
+ self._persistent = None
+
self._package._classes.append(self)
self._package._classes_by_name[self._name] = self
self._package._classes_by_lowercase_name[self._name.lower()] = self
@@ -254,6 +282,10 @@
self._object_title = elem.findtext("object/title")
+ persistent = elem.get("persistent")
+ if persistent is not None:
+ self._persistent = persistent == "y"
+
for child in elem.findall("property"):
prop = self._properties_by_name[child.get("name")]
prop.extend(child)
@@ -270,6 +302,11 @@
idx = RosemaryIndex(self, child.get("name"))
idx.extend(child)
+ def check_persistent(self):
+ if self._persistent is None:
+ return self._package.persistent
+ return self._persistent
+
def init(self):
log.debug("Initializing %s", self)
12 years, 11 months
r4834 - in trunk: cumin/model mint/python/mint rosemary/python/rosemary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-15 17:41:26 +0000 (Wed, 15 Jun 2011)
New Revision: 4834
Modified:
trunk/cumin/model/rosemary.xml
trunk/mint/python/mint/update.py
trunk/rosemary/python/rosemary/model.py
Log:
Allow "persistent" attribute for Rosemary package and class in extension xml file. Items marked persistent will not be deleted on cumin start or delete_agent_objects.
(BZ702440 tweaks)
Modified: trunk/cumin/model/rosemary.xml
===================================================================
--- trunk/cumin/model/rosemary.xml 2011-06-15 12:58:50 UTC (rev 4833)
+++ trunk/cumin/model/rosemary.xml 2011-06-15 17:41:26 UTC (rev 4834)
@@ -1,5 +1,5 @@
<model>
- <package name="com.redhat.cumin">
+ <package name="com.redhat.cumin" persistent="y">
<class name="User">
<property name="name" unique="y"/>
</class>
Modified: trunk/mint/python/mint/update.py
===================================================================
--- trunk/mint/python/mint/update.py 2011-06-15 12:58:50 UTC (rev 4833)
+++ trunk/mint/python/mint/update.py 2011-06-15 17:41:26 UTC (rev 4834)
@@ -29,8 +29,11 @@
def _delete_all_objects(self):
def loop_body(cls):
if cls._storage != "none":
- cls.delete_selection(self.cursor)
- self.cursor.connection.commit()
+ if cls.check_persistent():
+ log.debug("Skipping persistent class " + str(cls))
+ else:
+ cls.delete_selection(self.cursor)
+ self.cursor.connection.commit()
if len(self.app.qmf_classes):
log.debug("Delete all objects by bound classes " + str(self.app.qmf_classes))
@@ -614,7 +617,7 @@
def delete_agent_objects(self, cursor, stats, agent, bound_classes, bound_packages):
def loop_body(cls):
- if cls._storage != "none": # and cls is not self.model.com_redhat_grid.Collector:
+ if cls._storage != "none" and not cls.check_persistent():
count = cls.delete_selection(cursor, _qmf_agent_id=agent.id)
stats.objects_deleted += count
#stats.objects_deleted_by_class[cls] += count
Modified: trunk/rosemary/python/rosemary/model.py
===================================================================
--- trunk/rosemary/python/rosemary/model.py 2011-06-15 12:58:50 UTC (rev 4833)
+++ trunk/rosemary/python/rosemary/model.py 2011-06-15 17:41:26 UTC (rev 4834)
@@ -56,12 +56,20 @@
file.close()
def load(self, elem):
+ # This is an attribute on a top level tag,
+ # it should correspond to something like <schema package="blah">
attr = elem.get("package")
if attr:
pkg = RosemaryPackage(self, attr)
pkg.load(elem)
+ # This on the other hand is a tag itself. It should
+ # correspond to something like
+ # <model>
+ # <package ....>
+ # stuff
+ # </package>
for child in elem.findall("package"):
pkg = RosemaryPackage(self, child.get("name"))
pkg.load(child)
@@ -98,6 +106,18 @@
self._model = model
self._name = name
+ # Set in the extension xml file. This marks a package as
+ # containing persistent data which should not be deleted
+ # by cumin-data on startup or in association with
+ # the comings and goings of agents. Rather, it
+ # should be manipulated by specific interfaces.
+ # com.redhat.cumin is an example.
+
+ # Note, "persistent" may also be set at the class
+ # level in cases where packages contain both persistent
+ # and non-persistent data.
+ self.persistent = False
+
self._model._packages.append(self)
self._model._packages_by_name[self._name] = self
@@ -126,6 +146,10 @@
cls.load(child, groups_by_name)
def extend(self, elem):
+ persistent = elem.get("persistent")
+ if persistent is not None:
+ self.persistent = persistent == "y"
+
for child in elem.findall("class"):
cls = self._classes_by_name[child.get("name")]
cls.extend(child)
@@ -147,6 +171,10 @@
self._package = package
self._name = name
+ # If _persistent is None, check_persistent will
+ # return the value from self._package
+ self._persistent = None
+
self._package._classes.append(self)
self._package._classes_by_name[self._name] = self
self._package._classes_by_lowercase_name[self._name.lower()] = self
@@ -254,6 +282,10 @@
self._object_title = elem.findtext("object/title")
+ persistent = elem.get("persistent")
+ if persistent is not None:
+ self._persistent = persistent == "y"
+
for child in elem.findall("property"):
prop = self._properties_by_name[child.get("name")]
prop.extend(child)
@@ -270,6 +302,11 @@
idx = RosemaryIndex(self, child.get("name"))
idx.extend(child)
+ def check_persistent(self):
+ if self._persistent is None:
+ return self._package.persistent
+ return self._persistent
+
def init(self):
log.debug("Initializing %s", self)
12 years, 11 months
r4833 - branches/clarity/mint/python/mint
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-15 12:58:50 +0000 (Wed, 15 Jun 2011)
New Revision: 4833
Modified:
branches/clarity/mint/python/mint/update.py
Log:
Merge 4831 from trunk.
Tweak for BZ702440, remove special case for collector on delete_agent_objects
Modified: branches/clarity/mint/python/mint/update.py
===================================================================
--- branches/clarity/mint/python/mint/update.py 2011-06-15 12:57:16 UTC (rev 4832)
+++ branches/clarity/mint/python/mint/update.py 2011-06-15 12:58:50 UTC (rev 4833)
@@ -614,7 +614,7 @@
def delete_agent_objects(self, cursor, stats, agent, bound_classes, bound_packages):
def loop_body(cls):
- if cls._storage != "none" and cls is not self.model.com_redhat_grid.Collector:
+ if cls._storage != "none": # and cls is not self.model.com_redhat_grid.Collector:
count = cls.delete_selection(cursor, _qmf_agent_id=agent.id)
stats.objects_deleted += count
#stats.objects_deleted_by_class[cls] += count
12 years, 11 months
r4832 - in branches/clarity/cumin: bin etc python/cumin python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-15 12:57:16 +0000 (Wed, 15 Jun 2011)
New Revision: 4832
Modified:
branches/clarity/cumin/bin/cumin-web
branches/clarity/cumin/etc/cumin.conf
branches/clarity/cumin/python/cumin/config.py
branches/clarity/cumin/python/cumin/grid/job.py
branches/clarity/cumin/python/cumin/grid/job.strings
branches/clarity/cumin/python/cumin/main.py
Log:
Merge 4830 from trunk.
BZ699890
Modified: branches/clarity/cumin/bin/cumin-web
===================================================================
--- branches/clarity/cumin/bin/cumin-web 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/bin/cumin-web 2011-06-15 12:57:16 UTC (rev 4832)
@@ -92,6 +92,9 @@
cumin.user = values.user
cumin.update_interval = values.update_interval
cumin.max_qmf_table_sort = values.max_qmf_table_sort
+
+ cumin.fast_view_attributes = [x.strip() for x in values.fast_view_attributes.split(',')]
+
# set default values for form inputs
cumin.set_form_defaults(values.request_memory,
Modified: branches/clarity/cumin/etc/cumin.conf
===================================================================
--- branches/clarity/cumin/etc/cumin.conf 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/etc/cumin.conf 2011-06-15 12:57:16 UTC (rev 4832)
@@ -58,6 +58,7 @@
# update-interval: 10
# max-qmf-table-sort: 1000
# persona: default
+# fast-view-attributes: JobStatus,Cmd,Args,ExitStatus,JobStartDate,LastRemoteHost,LastJobStatus,Owner
[data]
# log-file: $CUMIN_HOME/log/data.log
Modified: branches/clarity/cumin/python/cumin/config.py
===================================================================
--- branches/clarity/cumin/python/cumin/config.py 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/python/cumin/config.py 2011-06-15 12:57:16 UTC (rev 4832)
@@ -51,6 +51,9 @@
param = ConfigParameter(web, "persona", str)
param.default = "default"
+
+ param = ConfigParameter(web, "fast-view-attributes", str)
+ param.default = "JobStatus,Cmd,Args,ExitStatus,JobStartDate,LastRemoteHost,LastJobStatus,Owner"
def create_data_section(self, name, strict_section):
data = CuminConfigSection(self, name, strict_section)
Modified: branches/clarity/cumin/python/cumin/grid/job.py
===================================================================
--- branches/clarity/cumin/python/cumin/grid/job.py 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/python/cumin/grid/job.py 2011-06-15 12:57:16 UTC (rev 4832)
@@ -28,11 +28,14 @@
cls = app.model.com_redhat_grid.Submission
super(JobFrame, self).__init__(app, name, cls)
-
+
self.view = JobView(app, "view", self.object)
self.replace_child(self.view)
# view or edit
+ self.fast_view = JobAdFastView(app, "fastads")
+ self.view.add_tab(self.fast_view)
+
self.ads = JobAdModes(app, "ads")
self.view.add_tab(self.ads)
@@ -94,7 +97,17 @@
def render_title(self, session):
return "Attributes"
+
+class JobAdFastView(ModeSet):
+ def __init__(self, app, name):
+ super(JobAdFastView, self).__init__(app, name)
+ self.viewer = FastViewJobAdsViewer(app, "fastviewer")
+ self.add_mode(self.viewer)
+
+ def render_title(self, session):
+ return "Overview"
+
class JobView(ObjectView):
def add_details_tab(self):
pass
@@ -480,7 +493,35 @@
idict["path"] = path
return idict
+
+class FastViewJobAdsSet(JobAdsSet):
+ def __init__(self, app, name):
+ super(FastViewJobAdsSet, self).__init__(app, name)
+
+ def do_get_items(self, session):
+ ad_list = self.items.get(session)
+ error = self.qmf_error.get(session)
+
+ if not ad_list and not error:
+ ad_list = list()
+ id = self.frame.id.get(session)
+ job_server = self.frame.get_job_server(session, id)
+ job_id = self.frame.job_id.get(session)
+ action = QmfCall(self.app, {'JobAd': {}})
+ results = action.execute(job_server, "GetJobAd", job_id)
+ error = results.error
+ self.qmf_error.set(session, error)
+ ads = results.data['JobAd']
+ cls = self.app.model.job_meta_data
+ ad_list = [self.gen_item(x, ads[x], cls, dtype=self.get_type(ads[x])) \
+ for x in ads if not x.startswith("!!") and x in self.app.fast_view_attributes]
+
+ self.items.set(session, ad_list)
+
+ return ad_list, error
+
+
class JobPropertyRenderer(TemplateRenderer):
def render_title(self, session, item):
title = item["name"]
@@ -517,6 +558,9 @@
if "property" in item:
property = item["property"]
return property.description
+
+ def render_id(self, session, item):
+ return item["property"].name
class JobAdsGroups(Widget):
def __init__(self, app, name):
@@ -606,7 +650,48 @@
group_items.append(item)
return group_items, error
+
+class FastViewJobAdsViewer(FastViewJobAdsSet):
+ def __init__(self, app, name):
+ super(FastViewJobAdsViewer, self).__init__(app, name)
+
+ self.item_renderer = JobPropertyRenderer(self, "property_html")
+ self.wait = Wait(app, "wait")
+ self.add_child(self.wait)
+
+ self.defer_enabled = True
+ self.update_enabled = True
+
+ def render_title(self, session):
+ return "Attributes"
+
+ def get_group_items(self, session, group):
+ group_items = list()
+
+ items, error = self.do_get_items(session)
+ for item in items:
+ if "property" in item:
+ property = item["property"]
+ item_group = property.group
+ else:
+ item_group = "Other"
+ if item_group == group:
+ group_items.append(item)
+
+ return group_items, error
+
+ def render_all_ordered_properties(self, session):
+ items, error = self.do_get_items(session)
+ writer = Writer()
+ viewable_items = self.app.fast_view_attributes
+ for viewable_item in viewable_items:
+ for item in items:
+ if item["name"] == viewable_item:
+ self.item_renderer.render(writer, session, item)
+ break
+ return writer.to_string()
+
class JobAdsEditButton(Widget):
def render_edit_ads_url(self, session):
branch = session.branch()
Modified: branches/clarity/cumin/python/cumin/grid/job.strings
===================================================================
--- branches/clarity/cumin/python/cumin/grid/job.strings 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/python/cumin/grid/job.strings 2011-06-15 12:57:16 UTC (rev 4832)
@@ -181,3 +181,37 @@
</ul>
</div>
</div>
+
+[FastViewJobAdsViewer.html]
+<div id="{id}">
+<table style='width:100%' class="CuminDetails">
+ <tbody>
+ <tr>
+ <td>
+ <table class="PropertySet FastViewPropertySet">
+ <thead>
+ <tr>
+ <th style="width: 33%;">Name</th>
+ <th style="width: 33%;">Value</th>
+ <th style="width: 33%;"> </th>
+ </tr>
+ </thead>
+ <tbody id="properties">
+ {all_ordered_properties}
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+[FastViewJobAdsViewer.deferred_html]
+<div id="{id}">
+ {wait}
+</div>
+
+[FastViewJobAdsViewer.property_html]
+<tr id='{id}'>
+ <th style="width:33%;">{title}</th><td style="width:33%;">{value}</td><td style="width:33%;">{inline_help}</td>
+</tr>
\ No newline at end of file
Modified: branches/clarity/cumin/python/cumin/main.py
===================================================================
--- branches/clarity/cumin/python/cumin/main.py 2011-06-15 12:49:35 UTC (rev 4831)
+++ branches/clarity/cumin/python/cumin/main.py 2011-06-15 12:57:16 UTC (rev 4832)
@@ -56,6 +56,8 @@
self.operator_email = None
self.update_interval = 10
self.max_qmf_table_sort = 1000
+
+ self.fast_view_attributes = list()
self.form_defaults = self.CuminFormDefaults()
12 years, 11 months