Author: tmckay
Date: 2013-03-06 21:55:02 +0000 (Wed, 06 Mar 2013)
New Revision: 5733
Modified:
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/util.py
trunk/cumin/python/cumin/widgets.py
trunk/mint/python/mint/update.py
trunk/rosemary/python/rosemary/model.py
Log:
Remove some more unnecessary code.
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/grid/submission.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -82,7 +82,7 @@
table = cls.sql_table
fmt = "(%s > now() - interval '10 days' or %s > 0 or %s > 0
or %s > 0)"
- args = (table._qmf_update_time.identifier,
+ args = (table.QDate.identifier,
table.Idle.identifier,
table.Running.identifier,
table.Held.identifier)
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/main.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -395,9 +395,6 @@
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.QDate.name, cls.QDate)
self.add_column(col)
self.set_default_sort_column(col)
Modified: trunk/cumin/python/cumin/util.py
===================================================================
--- trunk/cumin/python/cumin/util.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/util.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -55,25 +55,6 @@
if dt is not None:
return mktime(dt.timetuple())
-def parse_broker_addr(string):
- addr = string.split(":")
-
- if len(addr) > 1:
- host, port = addr[0], int(addr[1])
- else:
- host, port = addr[0], 5672
-
- return host, port
-
-def is_active(obj):
- delTime = obj._qmf_delete_time
- if not delTime and obj._qmf_update_time:
- updateTime = obj._qmf_update_time
- delta = timedelta(minutes=10)
- # mirroring logic in widgets/PhaseSwitch.get_sql_constraint
- if not updateTime or (updateTime > datetime.now() - delta):
- return True
-
class Identifiable(object):
def __init__(self, id=None):
self.id = id
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/widgets.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -1499,105 +1499,6 @@
self.classes.add(nsession, cls._name)
self.agents.add(nsession, obj._qmf_object_id)
-class IncrementalSearchInput(StringInput, ItemSet):
- def __init__(self, app, name, field_param):
- super(IncrementalSearchInput, self).__init__(app, name)
-
- self.disabled_tmpl = WidgetTemplate(self, "disabled_html")
- self.field = field_param
-
- def do_get_items(self, session):
- return ()
-
- def render_name(self, session):
- return self.field.path
-
- def do_render(self, session, *args):
- if self.disabled:
- writer = Writer()
-
- self.disabled_tmpl.render(writer, session, *args)
-
- return writer.to_string()
- else:
- return super(IncrementalSearchInput, self).do_render(session, *args)
-
-class BaseBindingInput(IncrementalSearchInput):
- def __init__(self, app, name, field_param):
- super(BaseBindingInput, self).__init__(app, name, field_param)
-
- def render_item_content(self, session, field):
- return xml_escape(field.name) or "Default"
-
- def render_value(self, session):
- if self.disabled:
- field = self.form.object.get(session)
- return fmt_shorten(field.get_formatted_value("name", escape=True),
- pre=36, post=4, spanify=False)
- else:
- input_value = self.param.get(session)
- return input_value and xml_escape(input_value) or ""
-
- def base_get_items(self, session, objects):
- obj_list = []
- if not self.disabled:
- obj_list_full = sorted_by(list(objects))
-
- delta = timedelta(days=3)
- for _obj in obj_list_full:
- if (_obj._qmf_update_time > (datetime.now() - delta)):
- obj_list.append(_obj)
-
- return obj_list
-
-class BindingAddTask(ObjectFrameTask):
- def get_title(self, session):
- return "Add binding"
-
- def do_invoke(self, invoc, obj, queue, exchange, key, args):
- session = self.app.model.get_session_by_object(obj)
- session.exchange_bind(queue=queue, exchange=exchange,
- binding_key=key, arguments=args)
- session.sync()
-
- invoc.end()
-
-class QueueBindingField(ScalarField):
- def __init__(self, app, name, queue):
- super(QueueBindingField, self).__init__(app, name, None)
-
- self.input = QueueInput(app, "input", queue)
- self.add_child(self.input)
-
- def render_title(self, session):
- return "Queue"
-
-class ExchangeBindingField(ScalarField):
- def __init__(self, app, name, exchange):
- super(ExchangeBindingField, self).__init__(app, name, None)
-
- self.input = ExchangeInput(app, "input", exchange)
- self.add_child(self.input)
-
- def render_title(self, session):
- return "Exchange"
-
-class QueueInput(BaseBindingInput):
- def do_get_items(self, session):
- cls = self.app.model.org_apache_qpid_broker.Queue
- queue = self.form.object.get(session)
- vhostid = queue._vhostRef_id
- queues = cls.get_selection(session.cursor, _vhostRef_id=vhostid)
- return self.base_get_items(session, queues)
-
-class ExchangeInput(BaseBindingInput):
- def do_get_items(self, session):
- cls = self.app.model.org_apache_qpid_broker.Exchange
- obj = self.form.object.get(session)
- vhostid = obj._class._name == "Vhost" and obj._id or obj._vhostRef_id
- exchanges = cls.get_selection(session.cursor, _vhostRef_id=vhostid)
- return self.base_get_items(session, exchanges)
-
class TopTable(ObjectTable):
def __init__(self, app, name, cls):
super(TopTable, self).__init__(app, name, cls)
Modified: trunk/mint/python/mint/update.py
===================================================================
--- trunk/mint/python/mint/update.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/mint/python/mint/update.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -311,7 +311,6 @@
obj = cls.create_object(cursor)
obj._qmf_agent_id = self.get_agent_id()
obj._qmf_object_id = self.get_object_id()
- obj._qmf_create_time = create_time
obj._qmf_update_time = update_time
object_columns = list()
@@ -322,7 +321,6 @@
object_columns.append(table._id)
object_columns.append(table._qmf_agent_id)
object_columns.append(table._qmf_object_id)
- object_columns.append(table._qmf_create_time)
object_columns.append(table._qmf_update_time)
self.process_properties(obj, object_columns, cursor)
Modified: trunk/rosemary/python/rosemary/model.py
===================================================================
--- trunk/rosemary/python/rosemary/model.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/rosemary/python/rosemary/model.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -673,19 +673,10 @@
self._qmf_object_id = RosemaryHeader(self, name, sql_text)
self._qmf_object_id.title = "Object ID"
- name = "_qmf_create_time"
- self._qmf_create_time = RosemaryHeader(self, name, sql_timestamp)
- self._qmf_create_time.title = "Create Time"
-
name = "_qmf_update_time"
self._qmf_update_time = RosemaryHeader(self, name, sql_timestamp)
self._qmf_update_time.title = "Update Time"
- name = "_qmf_delete_time"
- self._qmf_delete_time = RosemaryHeader(self, name, sql_timestamp)
- self._qmf_delete_time.title = "Delete Time"
- self._qmf_delete_time.optional = True
-
# Default timestamp field for Qmf objects will be _qmf_update_time
self.timestamp = "_qmf_update_time"
@@ -1226,7 +1217,6 @@
def fake_qmf_values(self):
self._qmf_agent_id = "__rosemary__"
self._qmf_object_id = str(datetime.now())
- self._qmf_create_time = datetime.now()
self._qmf_update_time = datetime.now()
class RosemaryNotFound(Exception):