[rhmessaging-commits] rhmessaging commits: r2670 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Oct 21 16:31:18 EDT 2008


Author: eallen
Date: 2008-10-21 16:31:18 -0400 (Tue, 21 Oct 2008)
New Revision: 2670

Modified:
   mgmt/trunk/cumin/python/cumin/negotiator.py
   mgmt/trunk/cumin/python/cumin/negotiator.strings
Log:
Tied negotiator start/stop into master.
Fixed logic for Negotiator started column. Now using rec_time less than 2 minutes old as determining factor for started.

Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py	2008-10-21 20:29:31 UTC (rev 2669)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py	2008-10-21 20:31:18 UTC (rev 2670)
@@ -54,9 +54,13 @@
             return "Started"
 
         def render_content(self, session, data):
-            started = data[self.name]
-            return started and "Yes" or "No" 
-
+            value = data["rec_time"]
+            expiry_time = datetime.now() - timedelta(minutes=2)
+            if value and value > expiry_time:
+                return "Yes"
+            else:
+                return "No"
+            
     class StartButton(FormButton):
         def process_submit(self, session):
             ids = self.parent.ids.get(session)
@@ -126,8 +130,8 @@
 
     def process_item(self, session, item):
         negotiator = Negotiator.get(item)
-        action = self.app.model.negotiator.start
-        action.invoke(negotiator)
+        action = self.app.model.master.start
+        action.invoke(negotiator, {"subsystem": "NEGOTIATOR"})
         self.process_cancel(session)
 
 class NegStop(CuminBulkActionForm):
@@ -142,7 +146,7 @@
 
     def process_item(self, session, item):
         negotiator = Negotiator.get(item)
-        action = self.app.model.negotiator.stop
-        action.invoke(negotiator)
+        action = self.app.model.master.stop
+        action.invoke(negotiator, {"subsystem": "NEGOTIATOR"})
         self.process_cancel(session)
 

Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings	2008-10-21 20:29:31 UTC (rev 2669)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings	2008-10-21 20:31:18 UTC (rev 2670)
@@ -2,8 +2,12 @@
 select
   n.id,
   n.name,
-  n.daemon_start_time as started
+  n.daemon_start_time as started,
+  c.monitor_self_age as age,
+  c.rec_time
 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
 
 [NegotiatorSet.count_sql]
 select count(1) from negotiator




More information about the rhmessaging-commits mailing list