Author: eallen
Date: 2008-11-06 14:33:49 -0500 (Thu, 06 Nov 2008)
New Revision: 2761
Modified:
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
mgmt/trunk/cumin/python/cumin/limits.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.strings
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Changed the way daemon status is reported. No longer attempting to determine started or
stopped. Just displaying the last time the daemon sent an update.
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -112,7 +112,7 @@
def __init__(self, app, name):
super(CollectorView, self).__init__(app, name)
- status = CollectorStatus(app, "status")
+ status = self.CollectorStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -125,24 +125,10 @@
data = "model.xml?class=collector;id=%i" % coll.id
return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" %
data
-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 CollectorStatus(CuminStatus):
+ def render_title(self, session, object):
+ return "Collector 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-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -56,10 +56,3 @@
<div>{hidden_inputs}</div>
</form>
-
-[CollectorStatus.html]
-<div id="{id}" class="CuminStatus {color}">
- <h2>Collector Status</h2>
- {collector_status}
- <div id="recTime"></div>
-</div>
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -239,7 +239,8 @@
self.__tabs.add_tab(details)
class LimitsStatus(CuminStatus):
- pass
+ def render_title(self, session, *args):
+ return "Limits Status"
class LimitsJobSet(JobTab):
def get_visible_columns(self, session):
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -2586,6 +2586,9 @@
action = self.GetLimitCount(self, "GetLimitCount")
action.navigable = False
+ action = GetStartedAction(self, "GetStarted")
+ action.navigable = False
+
def init(self):
self.frame = self.model.frame.pool.negotiator
Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -27,9 +27,6 @@
self.add_column(col)
self.set_default_column(col)
- col = self.StartedColumn(app, "started")
- self.add_column(col)
-
col = self.SystemColumn(app, "system")
self.add_column(col)
@@ -64,29 +61,6 @@
return fmt_olink(branch, neg, name=data["name"])
- class StartedColumn(SqlTableColumn, AjaxField):
- def render_title(self, session, data):
- 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):
- 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"
@@ -140,7 +114,7 @@
def __init__(self, app, name):
super(NegotiatorView, self).__init__(app, name)
- status = NegotiatorStatus(app, "status")
+ status = self.NegotiatorStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -149,37 +123,15 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
-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))
-
- 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 NegotiatorStatus(StartStopStatus):
+ def get_url(self, session):
+ negotiator = self.get_args(session)[0]
+ if negotiator:
+ return "call.xml?class=negotiator;id=%i;method=GetStarted" %
negotiator.id
+
+ def render_title(self, session, *args):
+ 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-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -55,40 +55,3 @@
</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)
- }
-}
-
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -125,7 +125,7 @@
def __init__(self, app, name):
super(SchedulerView, self).__init__(app, name)
- status = SchedulerStatus(app, "status")
+ status = self.SchedulerStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -144,22 +144,15 @@
data = "model.xml?class=scheduler;id=%i" % sched.id
return "wooly.setIntervalUpdate('%s', updateScheduler, 3000)" %
data
-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"
+ class SchedulerStatus(StartStopStatus):
+ 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 render_title(self, session, *args):
+ return "Scheduler Status"
- 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-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -99,54 +99,3 @@
<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>
-
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -307,7 +307,6 @@
else:
return "green"
-
class CuminEditableProperties(PropertySet):
def __init__(self, app, name):
self.item_renderer=EditablePropertyRenderer(self, "property_html")
@@ -1099,6 +1098,19 @@
def elem_id(self, session):
return self.name
+class StartStopStatus(CuminStatus, AjaxField):
+ def render_start_stop_script(self, session, scheduler):
+ return self.render_script(session)
+
+ def render_color(self, session, scheduler):
+ return "clear"
+
+ def got_fn(self, session):
+ return "startstop_status"
+
+ def elem_id(self, session):
+ return self.render_id(session)
+
class MoreFieldSet(FieldForm, FormField):
def __init__(self, app, name):
super(MoreFieldSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -1041,4 +1041,40 @@
}
</script>
-
+[StartStopStatus.css]
+div.status_time {
+ font-size: 0.80em;
+ color: #444444;
+}
+
+[StartStopStatus.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 oRecTime = document.getElementById("recTime");
+ if (oRecTime) {
+ oRecTime.innerHTML = recTime;
+ fConfidence = parseFloat(confidence);
+ if (fConfidence < 75) { /* hasn't changed in approx 2.5 minutes */
+ color = "yellow";
+ } else {
+ color = "green";
+ }
+ elem.className = "CuminStatus " + color;
+ }
+ setTimeout("get_status()", 5000);
+ }
+}
+
+[StartStopStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>{title}</h2>
+ <div class="status_time">
+ Last update was <span id="recTime"></span>
+ </div>
+</div>{start_stop_script}
+