rhmessaging commits: r2692 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-28 12:16:20 -0400 (Tue, 28 Oct 2008)
New Revision: 2692
Added:
mgmt/trunk/cumin/resources/shade.png
Log:
Background image for slot visualizations
Added: mgmt/trunk/cumin/resources/shade.png
===================================================================
(Binary files differ)
Property changes on: mgmt/trunk/cumin/resources/shade.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 1 month
rhmessaging commits: r2691 - in mgmt/trunk/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-24 21:41:54 -0400 (Fri, 24 Oct 2008)
New Revision: 2691
Modified:
mgmt/trunk/cumin/python/cumin/formats.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/widgets.py
Log:
William Henry's move message functionality and tool tips for shortened names
Modified: mgmt/trunk/cumin/python/cumin/formats.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/formats.py 2008-10-24 19:06:46 UTC (rev 2690)
+++ mgmt/trunk/cumin/python/cumin/formats.py 2008-10-25 01:41:54 UTC (rev 2691)
@@ -112,9 +112,9 @@
def fmt_shorten(string, pre=16, post=4):
if len(string) > pre + post:
if post:
- string = string[:pre] + "…" + string[-post:]
+ string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "…" + string[-post:])
else:
- string = string[:pre] + "…"
+ string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "…")
return string
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-24 19:06:46 UTC (rev 2690)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-25 01:41:54 UTC (rev 2691)
@@ -912,6 +912,9 @@
def init(self):
self.frame = self.model.frame.broker.queue
+ action = self.MoveMessages(self, "move_messages")
+ action.summary = True
+
def get_title(self, session):
return "Queue"
@@ -966,6 +969,18 @@
completion("OK")
+ class MoveMessages(CuminAction):
+ def show(self, session, queue):
+ frame = self.cumin_class.show_object(session, queue)
+ return frame.move_messages.show(session)
+
+ def get_title(self, session):
+ return "Move Messages"
+
+ def do_invoke(self, queue, args, completion):
+ broker = queue.vhost.broker
+ broker.queueMoveMessages(self.model.data, completion, args["srcQueue"], args["destQueue"], args["qty"])
+
class CuminExchange(RemoteClass):
def __init__(self, model):
super(CuminExchange, self).__init__(model, "exchange",
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-10-24 19:06:46 UTC (rev 2690)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-10-25 01:41:54 UTC (rev 2691)
@@ -61,6 +61,9 @@
self.__purge = self.Purge(app, "purge")
self.add_child(self.__purge)
+ self.__move_messages = self.MoveMessages(app, "move_messages")
+ self.add_child(self.__move_messages)
+
self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
@@ -97,6 +100,20 @@
def render_content(self, session):
return "Purge"
+
+ class MoveMessages(FormButton):
+ def process_submit(self, session):
+ ids = self.parent.ids.get(session)
+ self.parent.ids.clear(session)
+
+ branch = session.branch()
+ frame = self.frame.show_queues_move(branch)
+ frame.ids.set(branch, ids)
+ self.page.set_redirect_url(session, branch.marshal())
+
+ def render_content(self, session):
+ return "Move Messages"
+
class Remove(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
@@ -186,6 +203,9 @@
self.add_mode(self.remove)
self.set_remove_mode(self.remove)
+ self.move_messages = QueueMoveMessages(app, "move_messages")
+ self.add_mode(self.move_messages)
+
def show_object(self, session, queue):
reg = queue.vhost.broker.registration
self.page.main.broker.set_object(session, reg)
@@ -202,6 +222,9 @@
else:
return "Queue"
+ def show_move(self, session):
+ return self.show_mode(session, self.move_messages)
+
class QueueStatus(CuminStatus):
def render_consumers(self, session, queue):
return self.app.model.queue.consumers.value(queue)
@@ -730,3 +753,90 @@
def render_item_unacked_messages(self, session, consumer):
return self.app.model.consumer.unackedMessages.value(consumer)
+
+class QueueSelectField(FormField):
+ def __init__(self, app, name, form):
+ super(QueueSelectField, self).__init__(app, name)
+
+ param = QueueParameter(app, "param")
+ self.param = param
+ self.add_parameter(param)
+
+ self.queue_set = self.QueueInputSet(app, "queue_set", param)
+ self.add_child(self.queue_set)
+
+ def get(self, session):
+ return self.param.get(session)
+
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, queue):
+ return "Select the destination queue"
+
+ def render_inputs(self, session, queue):
+ return self.queue_set.render(session)
+
+ class QueueInputSet(RadioInputSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def do_get_items(self, session, queue):
+ queue_list_full = sorted_by(list(queue.vhost.queues))
+ delta = timedelta(minutes=10)
+ queue_list = []
+ for _queue in queue_list_full:
+ if (_queue.recTime > (datetime.now() - delta)) and (_queue.name != queue.name):
+ queue_list.append(_queue)
+ return queue_list
+
+ def render_item_value(self, session, queue):
+ return queue.id
+
+ def render_item_content(self, session, queue):
+ return queue.name or "<em>Default</em>"
+
+ def render_item_checked_attr(self, session, queue):
+ return queue is self.param.get(session) and "checked=\"checked\"" or None
+
+class QueueMoveMessages(CuminFieldForm):
+ def __init__(self, app, name):
+ super(QueueMoveMessages, self).__init__(app, name)
+
+ self.move_to = QueueSelectField(app, "move_to", self)
+ self.add_field(self.move_to)
+
+ self.move_qty = MultiplicityField(app, "move_qty")
+ self.add_field(self.move_qty)
+
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, queue):
+ return "Move Messages from Queue '%s'" % queue.name
+
+ def process_submit(self, session, queue):
+ request_qty = self.move_qty.get(session)
+ args = dict()
+ args["destQueue"] = self.move_to.get(session).name
+ args["srcQueue"] = queue.name
+
+ if request_qty == "all":
+ args["qty"] = 0
+ elif request_qty == "top":
+ args["qty"] = 1
+ elif request_qty == "N":
+ args["qty"] = self.move_qty.top_n.get_n_value(session)
+ else:
+ raise Exception("Wrong Value")
+
+ action = self.app.model.queue.move_messages
+ action.invoke(queue, args)
+ self.process_cancel(session, queue)
+
+ def render_submit_content(self, session, queue):
+ return "Yes, Move Messages from Queue '%s'" % queue.name
+
+ def render_cancel_content(self, session, queue):
+ return "No, Cancel"
+
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-10-24 19:06:46 UTC (rev 2690)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-10-25 01:41:54 UTC (rev 2691)
@@ -343,6 +343,9 @@
assert self.param is not None
assert isinstance(self.param, Parameter)
+ def get(self, session):
+ return self.param.get(session)
+
def add_option(self, option):
assert isinstance(option, RadioFieldOption)
Modified: mgmt/trunk/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/widgets.py 2008-10-24 19:06:46 UTC (rev 2690)
+++ mgmt/trunk/cumin/python/wooly/widgets.py 2008-10-25 01:41:54 UTC (rev 2691)
@@ -182,7 +182,6 @@
if items is None:
items = self.do_get_items(session, *args)
-
if items is None:
items = ()
@@ -225,7 +224,6 @@
if items is None:
items = self.do_get_items(session, *args)
-
if items is None:
items = ()
16 years, 2 months
rhmessaging commits: r2690 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-24 15:06:46 -0400 (Fri, 24 Oct 2008)
New Revision: 2690
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
Log:
Make it clear the user is entering a new password, not an existing one
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2008-10-24 15:44:05 UTC (rev 2689)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2008-10-24 19:06:46 UTC (rev 2690)
@@ -15,8 +15,8 @@
password = None
while password is None:
- once = getpass("Type password: ")
- twice = getpass("Retype password: ")
+ once = getpass("Enter new password: ")
+ twice = getpass("Confirm new password: ")
if once == twice:
password = once
16 years, 2 months
rhmessaging commits: r2689 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:44:05 -0400 (Fri, 24 Oct 2008)
New Revision: 2689
Modified:
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
Log:
Added commented out code to determine collector start/stop status.
This code may be resurrected at a later date.
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2008-10-24 15:43:03 UTC (rev 2688)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-10-24 15:44:05 UTC (rev 2689)
@@ -36,9 +36,20 @@
self.__stop = self.StopButton(app, "stop")
self.add_child(self.__stop)
- def render_title(self, session):
- return "Collectors %s" % fmt_count(Collector.select().count())
+ def get_args(self, session):
+ return self.frame.get_args(session)
+ def render_title(self, session, collector):
+ count = self.get_item_count(session, collector)
+ return "Collectors %s" % fmt_count(count)
+
+ def render_sql_where(self, session, collector):
+ sql = "deletion_time is null"
+ #sql = "((cs.rec_time is null and c.rec_time > now() - interval '10 minutes') or " + \
+ # "(cs.rec_time > now() - interval '10 minutes')" + \
+ # " and deletion_time is null)"
+ return "where %s" % sql
+
class NameColumn(SqlTableColumn):
def render_title(self, session, data):
return "Name"
@@ -111,9 +122,24 @@
data = "model.xml?class=collector;id=%i" % coll.id
return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" % data
-class CollectorStatus(CuminStatus):
- pass
+class CollectorStatus(CuminStatus, AjaxField):
+ def render_collector_status(self, session, collector):
+ return ""
+ #return "<span id=\"%s\"></span>%s" % \
+ # (self.name, self.render_script(session))
+ def render_color(self, session, collector):
+ #return "transparent"
+ return "green"
+
+ def get_url(self, session):
+ collector = self.get_args(session)[0]
+ if collector:
+ return "call.xml?class=collector;id=%i;method=GetStarted" % collector.id
+
+ def got_fn(self, session):
+ return "startstop_status"
+
class CollectorStart(CuminBulkActionForm):
def render_title(self, session, *args):
return "Start Collector"
Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings 2008-10-24 15:43:03 UTC (rev 2688)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-10-24 15:44:05 UTC (rev 2689)
@@ -6,12 +6,14 @@
y.node_name as system_name
from collector as c
inner join system as y on c.system = y.node_name
+left outer join collector_stats as cs on cs.id = c.stats_curr_id
{sql_where}
{sql_orderby}
{sql_limit}
[CollectorSet.count_sql]
-select count(*) from collector as c
+select count(1) from collector as c
+left outer join collector_stats as cs on cs.id = c.stats_curr_id
{sql_where}
[CollectorView.javascript]
@@ -53,3 +55,11 @@
</table>
<div>{hidden_inputs}</div>
</form>
+
+
+[CollectorStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>Collector Status</h2>
+ {collector_status}
+ <div id="recTime"></div>
+</div>
16 years, 2 months
rhmessaging commits: r2688 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:43:03 -0400 (Fri, 24 Oct 2008)
New Revision: 2688
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Added ability to rename status boxes.
Made AjaxField more flexible
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-24 15:41:53 UTC (rev 2687)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-24 15:43:03 UTC (rev 2688)
@@ -293,6 +293,9 @@
def get_args(self, session):
return self.frame.get_args(session)
+ def render_title(self, session, object):
+ return "Status"
+
def render_color(self, session, object):
if hasattr(object, "errors"):
if object.errors:
@@ -1165,8 +1168,21 @@
addEvent(window, "load", get_%s);
</script>
"""
+ get_fn = self.get_fn(session)
url = self.get_url(session)
- return script % (self.name, url, self.name, self.name, self.name)
+ got_fn = self.got_fn(session)
+ elem_id = self.elem_id(session)
+
+ return script % (get_fn, url, got_fn, elem_id, get_fn)
def get_url(self, session):
pass
+
+ def get_fn(self, session):
+ return self.name
+
+ def got_fn(self, session):
+ return self.name
+
+ def elem_id(self, session):
+ return self.name
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-10-24 15:41:53 UTC (rev 2687)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-10-24 15:43:03 UTC (rev 2688)
@@ -645,7 +645,6 @@
[CuminStatus.javascript]
function updateStatus(id, object) {
var status = wooly.doc().elembyid(id);
-
/*
var ecount = object.events.errors
var errors = ecount + " " + (ecount == "1" && "error" || "errors");
@@ -705,6 +704,11 @@
background-color: #cfc;
}
+div.CuminStatus.clear {
+ border: 1px dotted #9c9;
+ background-color: transparent;
+}
+
div.CuminStatus table {
width: 100%;
font-size: 0.9em;
@@ -717,7 +721,7 @@
[CuminStatus.html]
<div id="{id}" class="CuminStatus {color}">
- <h2>Status</h2>
+ <h2>{title}</h2>
</div>
[CuminDetails.css]
16 years, 2 months
rhmessaging commits: r2687 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:41:53 -0400 (Fri, 24 Oct 2008)
New Revision: 2687
Modified:
mgmt/trunk/cumin/python/cumin/submitter.py
Log:
Rename status box to Submitter Status
Modified: mgmt/trunk/cumin/python/cumin/submitter.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.py 2008-10-24 15:40:35 UTC (rev 2686)
+++ mgmt/trunk/cumin/python/cumin/submitter.py 2008-10-24 15:41:53 UTC (rev 2687)
@@ -72,7 +72,8 @@
return "wooly.setIntervalUpdate('%s', updateSubmitter, 3000)" % data
class SubmitterStatus(CuminStatus):
- pass
+ def render_title(self, session, submitter):
+ return "Submitter Status"
class SubmitterStats(Widget):
def __init__(self, app, name):
16 years, 2 months
rhmessaging commits: r2686 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:40:35 -0400 (Fri, 24 Oct 2008)
New Revision: 2686
Modified:
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
Log:
Rename status box to Scheduler Status
Implement ajax update of scheduler start/stop status
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-10-24 15:39:53 UTC (rev 2685)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-10-24 15:40:35 UTC (rev 2686)
@@ -141,9 +141,22 @@
data = "model.xml?class=scheduler;id=%i" % sched.id
return "wooly.setIntervalUpdate('%s', updateScheduler, 3000)" % data
-class SchedulerStatus(CuminStatus):
- pass
+class SchedulerStatus(CuminStatus, AjaxField):
+ def render_scheduler_status(self, session, scheduler):
+ return "<span id=\"%s\"></span>%s" % \
+ (self.name, self.render_script(session))
+ def render_color(self, session, scheduler):
+ return "transparent"
+
+ def get_url(self, session):
+ scheduler = self.get_args(session)[0]
+ if scheduler:
+ return "call.xml?class=scheduler;id=%i;method=GetStarted" % scheduler.id
+
+ def got_fn(self, session):
+ return "startstop_status"
+
class SchedulerStats(Widget):
def __init__(self, app, name):
super(SchedulerStats, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-24 15:39:53 UTC (rev 2685)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-24 15:40:35 UTC (rev 2686)
@@ -15,7 +15,7 @@
{sql_limit}
[SchedulerSet.count_sql]
-select count(*) from scheduler as s
+select count(1) from scheduler as s
{sql_where}
[SchedulerView.javascript]
@@ -99,3 +99,54 @@
<div>{hidden_inputs}</div>
</form>
+[SchedulerStatus.css]
+#recTime {
+ display:none;
+}
+[SchedulerStatus.javascript]
+function got_startstop_status(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var recTime = obj.rectime;
+ var confidence = obj.confidence;
+ var color = "clear";
+ var started = "Pending...";
+ var timeout;
+
+ var oRecTime = document.getElementById("recTime");
+ if (oRecTime) {
+ origRecTime = oRecTime.innerHTML;
+ oRecTime.innerHTML = recTime;
+ if (origRecTime == "") {
+ timeout = 1000;
+ } else if (recTime == origRecTime) {
+ fConfidence = parseFloat(confidence);
+ if (fConfidence < 75) { /* hasn't changed in approx 2.5 minutes */
+ color = "red";
+ started = "Stopped";
+ timeout = 10000;
+ }
+ else {
+ timeout = 1000;
+ }
+ } else {
+ color = "green";
+ started = "Started";
+ timeout = 0;
+ }
+ elem.innerHTML = started;
+ elem.parentNode.className = "CuminStatus " + color;
+ if (timeout > 0) {
+ setTimeout("get_status()", 5000);
+ }
+ }
+ }
+}
+
+[SchedulerStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>Scheduler Status</h2>
+ {scheduler_status}
+ <div id="recTime"></div>
+</div>
+
16 years, 2 months
rhmessaging commits: r2685 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:39:53 -0400 (Fri, 24 Oct 2008)
New Revision: 2685
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/pool.strings
Log:
Rename status box to Pool Status to avoid confusion
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-24 15:39:01 UTC (rev 2684)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-10-24 15:39:53 UTC (rev 2685)
@@ -302,3 +302,6 @@
class PoolStatus(CuminStatus):
def render_status(self, session, pool):
return "Active"
+
+ def render_title(self, session, pool):
+ return "Pool Status"
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-24 15:39:01 UTC (rev 2684)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-24 15:39:53 UTC (rev 2685)
@@ -16,7 +16,7 @@
[PoolStatus.html]
<div id="{id}" class="CuminStatus {color}">
- <h2>Status</h2>
+ <h2>{title}</h2>
<div>{status}</div>
</div>
16 years, 2 months
rhmessaging commits: r2684 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:39:01 -0400 (Fri, 24 Oct 2008)
New Revision: 2684
Modified:
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.strings
Log:
Implemented ajax negotiator status updater.
Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py 2008-10-24 15:37:34 UTC (rev 2683)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-10-24 15:39:01 UTC (rev 2684)
@@ -39,9 +39,19 @@
self.__stop = self.StopButton(app, "stop")
self.add_child(self.__stop)
- def render_title(self, session):
- return "Negotiators %s" % fmt_count(Negotiator.select().count())
+ def get_args(self, session):
+ return self.frame.get_args(session)
+ def render_title(self, session, negotiator):
+ count = self.get_item_count(session, negotiator)
+ return "Negotiators %s" % fmt_count(count)
+
+ def render_sql_where(self, session, negotiator):
+ sql = "((c.rec_time is not null and " + \
+ "c.rec_time > now() - interval '10 minutes')" + \
+ " and deletion_time is null)"
+ return "where %s" % sql
+
class NameColumn(SqlTableColumn):
def render_title(self, session, data):
return "Name"
@@ -54,18 +64,29 @@
return fmt_olink(branch, neg, name=data["name"])
- class StartedColumn(SqlTableColumn):
+ class StartedColumn(SqlTableColumn, AjaxField):
def render_title(self, session, data):
- return "Started"
-
+ return "Status"
+
+ def get_url(self, session):
+ data = self.get_args(session)[0]
+ negotiator = Negotiator.get(data["id"])
+ if negotiator:
+ return "call.xml?class=negotiator;id=%i;method=GetLimitCount" % negotiator.id
+
def render_content(self, session, data):
- value = data["rec_time"]
- expiry_time = datetime.now() - timedelta(minutes=2)
- if value and value > expiry_time:
- return "Yes"
- else:
- return "No"
+ id = self.elem_id(session)
+ return "<span id=\"%s\">Pending...%s</span>" % \
+ (id, self.render_script(session))
+ def elem_id(self, session):
+ data = self.get_args(session)[0]
+ id = data["id"]
+ return "%s_%i" % (self.name, id)
+
+ def get_fn(self, session):
+ return self.elem_id(session)
+
class SystemColumn(SqlTableColumn):
def render_title(self, session, data):
return "System"
@@ -125,13 +146,37 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
- def render_script(self, session, coll):
- data = "model.xml?class=negotiator;id=%i" % coll.id
- return "wooly.setIntervalUpdate('%s', updateNegotiator, 3000)" % data
+class NegotiatorStatus(CuminStatus, AjaxField):
+ def render_negotiator_status(self, session, negotiator):
+ if self.expired(session, negotiator):
+ started = "Stopped"
+ else:
+ started = "Started"
+ return "<span id=\"%s\">%s</span>%s" % \
+ (self.name, started, self.render_script(session))
-class NegotiatorStatus(CuminStatus):
- pass
+ def render_color(self, session, negotiator):
+ if self.expired(session, negotiator):
+ return "red"
+ else:
+ return "green"
+
+ def expired(self, session, negotiator):
+ value = negotiator.statsCurr.recTime
+ expiry_time = datetime.now() - timedelta(minutes=2)
+ if value and value > expiry_time:
+ return False
+ else:
+ return True
+ def get_url(self, session):
+ negotiator = self.get_args(session)[0]
+ if negotiator:
+ return "call.xml?class=negotiator;id=%i;method=GetLimitCount" % negotiator.id
+
+ def got_fn(self, session):
+ return "negotiator_status"
+
class NegStart(CuminBulkActionForm):
def render_title(self, session, *args):
return "Start Negotiator"
Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-10-24 15:37:34 UTC (rev 2683)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-10-24 15:39:01 UTC (rev 2684)
@@ -2,21 +2,18 @@
select
n.id,
n.name,
- n.daemon_start_time as started,
- c.monitor_self_age as age,
- c.rec_time,
y.id as system_id,
y.node_name as system_name
from negotiator as n
left outer join negotiator_stats as c on c.id = n.stats_curr_id
-left outer join negotiator_stats as p on p.id = n.stats_prev_id
inner join system as y on n.system = y.node_name
{sql_where}
{sql_orderby}
{sql_limit}
[NegotiatorSet.count_sql]
-select count(*) from negotiator as n
+select count(1) from negotiator as n
+left outer join negotiator_stats as c on c.id = n.stats_curr_id
{sql_where}
[NegotiatorView.javascript]
@@ -58,3 +55,40 @@
</table>
<div>{hidden_inputs}</div>
</form>
+
+[NegotiatorStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>Negotiator Status</h2>
+ {negotiator_status}
+</div>
+
+[StartedColumn.javascript]
+function got_started(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var err = obj.error.value;
+ var started = "Started";
+ if (err == "True") {
+ started = "Stopped"
+ }
+ elem.innerHTML = started;
+ }
+}
+
+[NegotiatorStatus.javascript]
+function got_negotiator_status(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var err = obj.error.value;
+ var started = "Started";
+ var color = "green";
+ if (err == "True") {
+ started = "Stopped"
+ color = "red"
+ }
+ elem.innerHTML = started;
+ elem.parentNode.className = "CuminStatus " + color;
+ setTimeout("get_status()", 1000)
+ }
+}
+
16 years, 2 months
rhmessaging commits: r2683 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:37:34 -0400 (Fri, 24 Oct 2008)
New Revision: 2683
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Dead code removal.
Better detection of errors when getting limits.
Rename of cumin_model to model for master start/stop actions
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-24 15:35:26 UTC (rev 2682)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-24 15:37:34 UTC (rev 2683)
@@ -591,13 +591,13 @@
def do_invoke(self, object, args, completion):
system_name = object.System
master = Master.select("System = '%s'" % system_name)[0]
- master.Start(self.cumin_model.data, completion, args["subsystem"])
+ master.Start(self.model.data, completion, args["subsystem"])
class Stop(CuminAction):
def do_invoke(self, object, args, completion):
system_name = object.System
master = Master.select("System = '%s'" % system_name)[0]
- master.Stop(self.cumin_model.data, completion, args["subsystem"])
+ master.Stop(self.model.data, completion, args["subsystem"])
class CuminBroker(RemoteClass):
def __init__(self, model):
@@ -2152,6 +2152,25 @@
Value = args[1]
job.SetAttribute(self.model.data, completion, Name, str(Value))
+class GetStartedAction(CuminAction):
+ def do_invoke(self, object):
+ confidence = self.started_confidence(object)
+ recTime = object.statsCurr and object.statsCurr.recTime or object.recTime
+ conf = "<confidence>%d</confidence>" % confidence
+ rect = "<rectime>%s</rectime>" % fmt_datetime(recTime)
+
+ return "%s%s" % (conf, rect)
+
+ def started_confidence(self, object):
+ value = object.statsCurr and object.statsCurr.recTime or object.recTime
+ age = datetime.now() - value
+ # 100% at now
+ # 0% at 10 min
+ confidence = float(600 - age.seconds) / 6.0
+ if confidence < 0:
+ confidence = 0
+ return confidence
+
class CuminScheduler(RemoteClass):
def __init__(self, model):
super(CuminScheduler, self).__init__(model, "scheduler",
@@ -2200,6 +2219,9 @@
action = self.Stop(self, "stop")
action.summary = True
+ action = GetStartedAction(self, "GetStarted")
+ action.navigable = False
+
def init(self):
self.frame = self.model.frame.pool.scheduler
@@ -2218,10 +2240,6 @@
def get_title(self, session):
return "Start"
- # the actual start/stop is done my master
- def do_invoke(self, scheduler, args, completion):
- pass
-
class Stop(CuminAction):
def show(self, session, sched):
frame = self.model.frame.pool.show_scheds_stop(session)
@@ -2231,10 +2249,6 @@
def get_title(self, session):
return "Stop"
- # the actual start/stop is done my master
- def do_invoke(self, scheduler, args, completion):
- pass
-
class CuminSubmitter(RemoteClass):
def __init__(self, model):
super(CuminSubmitter, self).__init__(model, "submitter",
@@ -2287,6 +2301,9 @@
action = self.Stop(self, "stop")
action.summary = True
+ action = GetStartedAction(self, "GetStarted")
+ action.navigable = False
+
def init(self):
self.frame = self.model.frame.pool.collector
@@ -2306,10 +2323,6 @@
def get_title(self, session):
return "Start"
- # the actual start/stop is done my master
- def do_invoke(self, collector, args, completion):
- pass
-
class Stop(CuminAction):
def show(self, session, collector):
frame = self.model.frame.pool.show_colls_stop(session)
@@ -2320,10 +2333,6 @@
def get_title(self, session):
return "Stop"
- # the actual start/stop is done my master
- def do_invoke(self, collector, args, completion):
- pass
-
class CuminNegotiator(RemoteClass):
def __init__(self, model):
super(CuminNegotiator, self).__init__(model, "negotiator",
@@ -2361,10 +2370,6 @@
stat.title = "Resident Set Size"
stat.category = "general"
-# stat = CuminStat(self, "MonitorSelfTime")
-# stat.title = "Time"
-# stat.category = "general"
-
action = self.Start(self, "start")
action.summary = True
@@ -2395,10 +2400,6 @@
def get_title(self, session):
return "Start"
- # the actual start/stop is done my master
- def do_invoke(self, negotiator, args, completion):
- pass
-
class Stop(CuminAction):
def show(self, session, neg):
frame = self.model.frame.pool.show_negs_stop(session)
@@ -2408,15 +2409,19 @@
def get_title(self, session):
return "Stop"
- # the actual start/stop is done my master
- def do_invoke(self, negotiator, args, completion):
- pass
-
class GetLimitCount(CuminAction):
def do_invoke(self, negotiator):
action = self.model.negotiator.GetLimits
limits = action.do_invoke(negotiator)
- return "<count value=\"%i\" />" % len(limits)
+ error = "False"
+ if "timeout" in limits:
+ val = 0
+ error = "True"
+ else:
+ val = len(limits)
+ err = "<error value=\"%s\" />" % error
+ count = "<count value=\"%i\" />" % val
+ return "%s%s" % (count, err)
class GetLimits(CuminAction):
def do_invoke(self, negotiator):
@@ -2437,6 +2442,8 @@
# wait for up to 5 seconds for completion to be called
wait(predicate, timeout=5)
+ if not self.got_data:
+ self.lim["timeout"] = True
return self.lim
class ModelPage(Page):
16 years, 2 months