rhmessaging commits: r2930 - in mgmt/trunk/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-04 18:52:51 -0500 (Thu, 04 Dec 2008)
New Revision: 2930
Modified:
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/schemaparser.py
mgmt/trunk/mint/python/mint/update.py
mgmt/trunk/mint/sql/triggers.sql
Log:
enable use of triggers to update current/previous statistics
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-04 22:39:37 UTC (rev 2929)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-04 23:52:51 UTC (rev 2930)
@@ -74,6 +74,35 @@
finally:
conn.close()
+ def __splitSQLStatements(self, text):
+ result = list()
+ unmatchedQuote = False
+ tmpStmt = ""
+
+ for stmt in text.split(";"):
+ stmt = stmt.rstrip()
+ quotePos = stmt.find("'")
+ while quotePos > 0:
+ quotePos += 1
+ if quotePos < len(stmt):
+ if stmt[quotePos] != "'":
+ unmatchedQuote = not unmatchedQuote
+ else:
+ # ignore 2 single quotes
+ quotePos += 1
+ quotePos = stmt.find("'", quotePos)
+
+ if len(stmt.lstrip()) > 0:
+ tmpStmt += stmt + ";"
+ if not unmatchedQuote:
+ # single quote has been matched/closed, generate statement
+ result.append(tmpStmt.lstrip())
+ tmpStmt = ""
+
+ if unmatchedQuote:
+ result.append(tmpStmt.lstrip())
+ return result
+
def createSchema(self, file_paths):
conn = self.getConnection()
@@ -96,8 +125,7 @@
pass
for path, text in scripts:
- # TODO: fix splitting of sql statements by ';' before enabling triggers
- stmts = text.split(";")
+ stmts = self.__splitSQLStatements(text)
count = 0
for stmt in stmts:
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-12-04 22:39:37 UTC (rev 2929)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-12-04 23:52:51 UTC (rev 2930)
@@ -135,7 +135,7 @@
pythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
colPythonName = self.style.dbColumnToPythonAttr(schemaName)
keyPythonName = self.style.dbTableToPythonClass(schemaName)
- self.sqlTriggersOutput += "DROP TRIGGER update_stats ON %s; \n" % (self.style.pythonClassToDBTable(pythonName))
+ #self.sqlTriggersOutput += "DROP TRIGGER update_stats ON %s; \n" % (self.style.pythonClassToDBTable(pythonName))
self.sqlTriggersOutput += "CREATE TRIGGER update_stats AFTER INSERT ON %s \n" % (self.style.pythonClassToDBTable(pythonName))
self.sqlTriggersOutput += " FOR EACH ROW EXECUTE PROCEDURE update_stats(); \n\n"
else:
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-04 22:39:37 UTC (rev 2929)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-04 23:52:51 UTC (rev 2930)
@@ -319,13 +319,8 @@
op = SqlInsert(statsCls, attrs)
op.execute(cursor, attrs)
- statsId = cursor.fetchone()[0]
-
log.debug("%s(%s) created", statsCls.__name__, id)
- op = SqlSetStatsRefs(cls)
- op.execute(cursor, {"statsId": statsId, "id": id})
-
class MethodUpdate(ModelUpdate):
def __init__(self, model, broker, seq, response):
super(MethodUpdate, self).__init__(model, broker, response)
Modified: mgmt/trunk/mint/sql/triggers.sql
===================================================================
--- mgmt/trunk/mint/sql/triggers.sql 2008-12-04 22:39:37 UTC (rev 2929)
+++ mgmt/trunk/mint/sql/triggers.sql 2008-12-04 23:52:51 UTC (rev 2930)
@@ -14,95 +14,72 @@
END
' LANGUAGE plpgsql;
-DROP TRIGGER update_stats ON slot_stats;
CREATE TRIGGER update_stats AFTER INSERT ON slot_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON job_stats;
CREATE TRIGGER update_stats AFTER INSERT ON job_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON scheduler_stats;
CREATE TRIGGER update_stats AFTER INSERT ON scheduler_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON submitter_stats;
CREATE TRIGGER update_stats AFTER INSERT ON submitter_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON negotiator_stats;
CREATE TRIGGER update_stats AFTER INSERT ON negotiator_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON collector_stats;
CREATE TRIGGER update_stats AFTER INSERT ON collector_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON master_stats;
CREATE TRIGGER update_stats AFTER INSERT ON master_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON acl_stats;
CREATE TRIGGER update_stats AFTER INSERT ON acl_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON cluster_stats;
CREATE TRIGGER update_stats AFTER INSERT ON cluster_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON store_stats;
CREATE TRIGGER update_stats AFTER INSERT ON store_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON journal_stats;
CREATE TRIGGER update_stats AFTER INSERT ON journal_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON system_stats;
CREATE TRIGGER update_stats AFTER INSERT ON system_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON broker_stats;
CREATE TRIGGER update_stats AFTER INSERT ON broker_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON agent_stats;
CREATE TRIGGER update_stats AFTER INSERT ON agent_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON vhost_stats;
CREATE TRIGGER update_stats AFTER INSERT ON vhost_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON queue_stats;
CREATE TRIGGER update_stats AFTER INSERT ON queue_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON exchange_stats;
CREATE TRIGGER update_stats AFTER INSERT ON exchange_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON binding_stats;
CREATE TRIGGER update_stats AFTER INSERT ON binding_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON client_connection_stats;
CREATE TRIGGER update_stats AFTER INSERT ON client_connection_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON link_stats;
CREATE TRIGGER update_stats AFTER INSERT ON link_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON bridge_stats;
CREATE TRIGGER update_stats AFTER INSERT ON bridge_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON session_stats;
CREATE TRIGGER update_stats AFTER INSERT ON session_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
-DROP TRIGGER update_stats ON sysimage_stats;
CREATE TRIGGER update_stats AFTER INSERT ON sysimage_stats
FOR EACH ROW EXECUTE PROCEDURE update_stats();
17 years, 4 months
rhmessaging commits: r2929 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-04 17:39:37 -0500 (Thu, 04 Dec 2008)
New Revision: 2929
Modified:
mgmt/trunk/mint/python/mint/dbexpire.py
mgmt/trunk/mint/python/mint/update.py
Log:
Convert mint threads to use the DaemonThread in util; this fixes the C-c issues
Modified: mgmt/trunk/mint/python/mint/dbexpire.py
===================================================================
--- mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-04 20:26:02 UTC (rev 2928)
+++ mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-04 22:39:37 UTC (rev 2929)
@@ -4,16 +4,14 @@
from threading import Thread
from mint.schema import *
from sql import *
+from util import *
log = logging.getLogger("mint.dbexpire")
-class DBExpireThread(Thread):
+class DBExpireThread(MintDaemonThread):
def __init__(self, model, frequency, threshold, keepCurrStats=False):
- super(DBExpireThread, self).__init__()
+ super(DBExpireThread, self).__init__(model)
- self.model = model
- self.setDaemon(False)
- self.stopRequested = False
self.frequency = frequency
self.threshold = threshold
self.keepCurrStats = keepCurrStats
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-04 20:26:02 UTC (rev 2928)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-04 22:39:37 UTC (rev 2929)
@@ -13,23 +13,20 @@
from time import clock
from sql import *
from collections import deque
+from util import *
log = logging.getLogger("mint.update")
-class ModelUpdateThread(Thread):
+class ModelUpdateThread(MintDaemonThread):
def __init__(self, model):
- super(ModelUpdateThread, self).__init__()
+ super(ModelUpdateThread, self).__init__(model)
- self.model = model
self.updates = UpdateQueue(slotCount=2)
- self.stopRequested = False
self.enqueueCount = 0
self.dequeueCount = 0
self.commitThreshold = 100
- self.setDaemon(False)
-
def enqueue(self, update):
try:
self.updates.put(update)
@@ -85,10 +82,7 @@
broker.objectDatabaseIds.rollback()
log.exception("Update failed")
-
- def stop(self):
- self.stopRequested = True
-
+
class ReferenceException(Exception):
def __init__(self, sought):
self.sought = sought
17 years, 4 months
rhmessaging commits: r2928 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-04 15:26:02 -0500 (Thu, 04 Dec 2008)
New Revision: 2928
Modified:
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Fix the Job frame icon.
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-12-04 20:17:36 UTC (rev 2927)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-12-04 20:26:02 UTC (rev 2928)
@@ -399,14 +399,3 @@
}
}
}
-
-[JobView.html]
-<script type="text/javascript">
-{script}
-</script>
-
-{status}
-<h1><img src="resource?name=job-36.png" alt="job" />{title}</h1>
-{summary}
-{tabs}
-
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-04 20:17:36 UTC (rev 2927)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-04 20:26:02 UTC (rev 2928)
@@ -2381,6 +2381,9 @@
def get_object_name(self, job):
return job.CustomId
+ def get_icon_href(self, session):
+ return "resource?name=job-36.png"
+
class DateAdProperty(AdProperty):
def render_datetime(self, session, value):
# XXX
17 years, 4 months
rhmessaging commits: r2927 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-04 15:17:36 -0500 (Thu, 04 Dec 2008)
New Revision: 2927
Modified:
mgmt/trunk/cumin/python/cumin/pool.strings
Log:
Removing the >> from the Show All Slots button.
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-12-04 19:53:12 UTC (rev 2926)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-12-04 20:17:36 UTC (rev 2927)
@@ -77,9 +77,9 @@
</script>
[ShowAllSlots.html]
- <ul class="actions {class}" style="margin: 1em;">
- <li><a class="nav" href="{href}">Show All Slots</a></li>
- </ul>
+ <div style="margin:1em;">
+ <a href="{href}"><button class="{class}" type="button" tabindex="100" >Show All Slots</button></a>
+ </div>
[MachineVisualization.javascript]
function got_machine_grid(obj, id) {
17 years, 4 months
rhmessaging commits: r2926 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-04 14:53:12 -0500 (Thu, 04 Dec 2008)
New Revision: 2926
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/slot.py
mgmt/trunk/cumin/python/cumin/slot.strings
mgmt/trunk/cumin/python/cumin/system.py
Log:
Using slot.qmf_update_time to determine which slot to use when there are multiple collectors.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-04 19:50:51 UTC (rev 2925)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-04 19:53:12 UTC (rev 2926)
@@ -2035,6 +2035,10 @@
def render_sql_where(self, session, pool):
elems = list()
elems.append("s.pool = %(pool)s")
+ recent = self.get_recent_sql_where(session)
+ if recent:
+ elems.append(recent)
+
if self.__machine:
elems.append("machine = %(machine)s")
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-12-04 19:50:51 UTC (rev 2925)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-12-04 19:53:12 UTC (rev 2926)
@@ -266,7 +266,13 @@
return self.frame.get_args(session)
def render_sql_where(self, session, pool):
- return "where s.pool = %(pool)s"
+ elems = list()
+ elems.append("s.pool = %(pool)s")
+ recent = self.get_recent_sql_where(session)
+ if recent:
+ elems.append(recent)
+
+ return "where %s" % " and ".join(elems)
def get_sql_values(self, session, pool):
return {"pool": pool.id}
@@ -274,13 +280,22 @@
def render_title(self, session, pool):
count = self.get_item_count(session, pool)
return "Slots %s" % fmt_count(count)
+
+ def filter(self, session, system, slots):
+ return slots
class PoolMachineSet(MachineSet):
def get_args(self, session):
return self.frame.get_args(session)
def render_sql_where(self, session, pool):
- return "where s.pool = %(pool)s"
+ elems = list()
+ elems.append("s.pool = %(pool)s")
+ recent = self.get_recent_sql_where(session)
+ if recent:
+ elems.append(recent)
+
+ return "where %s" % " and ".join(elems)
def get_sql_values(self, session, pool):
return {"pool": pool.id}
@@ -476,6 +491,10 @@
def render_sql_where(self, session, pool):
elems = list()
elems.append("s.pool = %(pool)s")
+ recent = self.get_recent_sql_where(session)
+ if recent:
+ elems.append(recent)
+
return "where %s" % " and ".join(elems)
def get_sql_values(self, session, pool):
Modified: mgmt/trunk/cumin/python/cumin/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.py 2008-12-04 19:50:51 UTC (rev 2925)
+++ mgmt/trunk/cumin/python/cumin/slot.py 2008-12-04 19:53:12 UTC (rev 2926)
@@ -11,7 +11,15 @@
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.job")
-class SlotSet(CuminTable):
+class UniqueSlot(CuminTable):
+ def get_recent_sql_where(self, session):
+ return """
+ (s.qmf_update_time =
+ (select max(qmf_update_time)
+ from slot as ss
+ where s.name = ss.name))"""
+
+class SlotSet(UniqueSlot):
def __init__(self, app, name):
super(SlotSet, self).__init__(app, name)
@@ -22,8 +30,8 @@
def render_title(self, session, data):
return "Name"
-class MachineSet(CuminTable):
+class MachineSet(UniqueSlot):
pass
-class SlotStatSet(CuminTable):
- pass
\ No newline at end of file
+class SlotStatSet(UniqueSlot):
+ pass
Modified: mgmt/trunk/cumin/python/cumin/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.strings 2008-12-04 19:50:51 UTC (rev 2925)
+++ mgmt/trunk/cumin/python/cumin/slot.strings 2008-12-04 19:53:12 UTC (rev 2926)
@@ -1,6 +1,6 @@
[SlotSet.sql]
-select distinct
- s.name as id,
+select
+ s.id,
s.name,
s.machine,
s.system,
@@ -9,7 +9,6 @@
c.activity
from slot as s
left outer join slot_stats as c on c.id = s.stats_curr_id
-left outer join slot_stats as p on p.id = s.stats_prev_id
left outer join job as j on j.custom_id = s.job_id
{sql_where}
{sql_orderby}
@@ -17,21 +16,20 @@
[SlotSet.count_sql]
select count(1)
-from (select distinct name, machine, system, pool, qmf_delete_time from slot as s {sql_where}) as s
+from (select distinct name from slot as s {sql_where}) as s
-
[SlotStatSet.sql]
select
- sum(case activity when 'Idle' then 1 else 0 end) / coll_count as idle,
- sum(1) / coll_count as total
-from (select
- machine, s.pool, c.activity, count(coll.id) as coll_count
- from slot as s
- left outer join slot_stats as c on c.id = s.stats_curr_id
- left outer join collector as coll on coll.pool = s.pool
- group by machine, s.pool, c.activity, s.stats_curr_id) as s
+ sum(case activity when 'Idle' then 1 else 0 end) as idle,
+ sum(1) as total
+from (select
+ s.name,
+ s.pool,
+ s.qmf_update_time,
+ c.activity
+from slot as s
+left outer join slot_stats as c on c.id = s.stats_curr_id) as s
{sql_where}
-group by coll_count
[SlotStatSet.count_sql]
1
@@ -40,21 +38,22 @@
select
machine as id,
machine,
- sum(case activity when 'Busy' then 1 else 0 end) / coll_count as busy,
- sum(case activity when 'Idle' then 1 else 0 end) / coll_count as idle,
- sum(1) / coll_count as total
+ sum(case activity when 'Busy' then 1 else 0 end) as busy,
+ sum(case activity when 'Idle' then 1 else 0 end) as idle,
+ sum(1) as total
from
(select
- machine, s.pool, c.activity, count(coll.id) as coll_count
- from slot as s
- left outer join slot_stats as c on c.id = s.stats_curr_id
- left outer join collector as coll on coll.pool = s.pool
- group by machine, s.pool, c.activity, s.stats_curr_id) as s
+ s.name,
+ s.machine,
+ s.pool,
+ s.qmf_update_time,
+ c.activity
+ from slot as s
+ left outer join slot_stats as c on c.id = s.stats_curr_id) as s
{sql_where}
-group by machine, coll_count
+group by machine
{sql_orderby}
[MachineSet.count_sql]
-select count(*)
-from
- (select 1 from slot group by machine) as l
+select count(1)
+from (select distinct machine from slot) as s
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-12-04 19:50:51 UTC (rev 2925)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-12-04 19:53:12 UTC (rev 2926)
@@ -143,13 +143,15 @@
def render_sql_where(self, session, system):
elems = list()
elems.append("system = %(nodeName)s")
- elems.append("s.qmf_delete_time is null")
+ recent = self.get_recent_sql_where(session)
+ if recent:
+ elems.append(recent)
+
return "where %s" % " and ".join(elems)
-
+
def get_sql_values(self, session, system):
return {"nodeName": system.nodeName}
-
class SystemServices(ItemSet):
def render_title(self, session, *args):
return "Services"
17 years, 4 months
rhmessaging commits: r2925 - mgmt/trunk/mint/sql.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-04 14:50:51 -0500 (Thu, 04 Dec 2008)
New Revision: 2925
Modified:
mgmt/trunk/mint/sql/indexes.sql
Log:
Adding index on slot.name to improve query performance
Modified: mgmt/trunk/mint/sql/indexes.sql
===================================================================
--- mgmt/trunk/mint/sql/indexes.sql 2008-12-04 19:42:44 UTC (rev 2924)
+++ mgmt/trunk/mint/sql/indexes.sql 2008-12-04 19:50:51 UTC (rev 2925)
@@ -5,3 +5,5 @@
create index queue_stats_queue_id_idx on queue_stats (queue_id);
create index exchange_stats_exchange_id_idx on exchange_stats (exchange_id);
create index client_stats_client_id_idx on client_connection_stats (client_connection_id);
+
+create index slot_name_idx on slot (name);
17 years, 4 months
rhmessaging commits: r2924 - in mgmt/trunk: mint/bin and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-04 14:42:44 -0500 (Thu, 04 Dec 2008)
New Revision: 2924
Added:
mgmt/trunk/mint/bin/mint-server
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/tools.py
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
Log:
Make mint run out of process by default
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-03 22:26:35 UTC (rev 2923)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-04 19:42:44 UTC (rev 2924)
@@ -20,9 +20,13 @@
class CuminModel(object):
def __init__(self, app, data_uri):
self.app = app
- self.data = MintModel(data_uri, dbExpireFrequency=app.config.expire_frequency, \
- dbExpireThreshold=app.config.expire_threshold, debug=False)
+ self.data = MintModel(data_uri,
+ dbExpireFrequency=app.config.expire_frequency,
+ dbExpireThreshold=app.config.expire_threshold,
+ debug=False)
+ self.data.updateObjects = False
+
self.classes = list()
self.invocations = set()
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2008-12-03 22:26:35 UTC (rev 2923)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2008-12-04 19:42:44 UTC (rev 2924)
@@ -1,4 +1,4 @@
-import sys, os, re
+import sys, os, re, signal
from parsley.config import *
from parsley.command import *
@@ -6,6 +6,7 @@
from mint import *
from getpass import getpass
from psycopg2 import IntegrityError
+from subprocess import Popen
from util import *
from cumin import Cumin, CuminServer, CuminConfig
@@ -432,6 +433,21 @@
opt = CommandOption(self, "ssl")
opt.description = "Serve web pages using SSL"
+ def start_mint_process(self, config, opts):
+ args = ["mint-server",
+ "--data", self.config.data,
+ "--log-file", self.config.log_file,
+ "--log-level", self.config.log_level,
+ "--expire-frequency", str(self.config.expire_frequency),
+ "--expire-threshold", str(self.config.expire_threshold)]
+
+ if "debug" in opts or config.debug:
+ args.append("--debug")
+
+ pop = Popen(args)
+
+ return pop.pid
+
def do_run(self, opts, args):
self.config.load_dict(opts)
@@ -468,14 +484,24 @@
log.error("SSL key file '%s' not found" % kpath)
sys.exit(1)
+ mint_pid = None
+
try:
app.start()
try:
+ mint_pid = self.start_mint_process(self.config, opts)
+ except:
+ log.exception("Failed starting mint process")
+
+ try:
server.start()
finally:
server.stop()
finally:
+ if mint_pid is not None:
+ os.kill(mint_pid, signal.SIGTERM)
+
app.stop()
class CuminTestTool(BaseCuminTool):
Added: mgmt/trunk/mint/bin/mint-server
===================================================================
--- mgmt/trunk/mint/bin/mint-server (rev 0)
+++ mgmt/trunk/mint/bin/mint-server 2008-12-04 19:42:44 UTC (rev 2924)
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import sys, os, logging
+
+from mint.tools import MintServerTool
+
+def main():
+ root = logging.getLogger("mint")
+ root.setLevel(logging.DEBUG)
+
+ h = logging.StreamHandler()
+ h.setLevel(logging.DEBUG)
+ root.addHandler(h)
+
+ MintServerTool("mint-server").main()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
Property changes on: mgmt/trunk/mint/bin/mint-server
___________________________________________________________________
Name: svn:executable
+ *
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-03 22:26:35 UTC (rev 2923)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-04 19:42:44 UTC (rev 2924)
@@ -311,7 +311,7 @@
self.__lock = RLock()
self.dbConn = None
- self.mgmtSession = qmf.console.Session(self, manageConnections=True)
+ self.qmfSession = None
self.updateThread = update.ModelUpdateThread(self)
self.dbExpireThread = dbexpire.DBExpireThread \
@@ -340,6 +340,11 @@
def init(self):
sqlhub.processConnection = self.dbConn = connectionForURI(self.dataUri)
+ assert self.qmfSession is None
+
+ self.qmfSession = qmf.console.Session \
+ (self, manageConnections=True, rcvObjects=self.updateObjects)
+
def start(self):
self.updateThread.start()
self.dbExpireThread.start()
@@ -357,7 +362,7 @@
finally:
self.unlock()
- seq = self.mgmtSession._sendMethodRequest \
+ seq = self.qmfSession._sendMethodRequest \
(broker.qmfBroker, ClassKey(classKey), objId, methodName, args)
if seq is not None:
@@ -373,7 +378,7 @@
self.lock()
try:
- qbroker = self.mgmtSession.addBroker(url)
+ qbroker = self.qmfSession.addBroker(url)
mbroker = MintBroker(url, qbroker)
# Can't add the by-id mapping here, as the id is not set yet;
@@ -393,7 +398,7 @@
self.lock()
try:
- self.mgmtSession.delBroker(mbroker.qmfBroker)
+ self.qmfSession.delBroker(mbroker.qmfBroker)
del self.mintBrokersByQmfBroker[mbroker.qmfBroker]
del self.mintBrokersById[mbroker.qmfId]
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-12-03 22:26:35 UTC (rev 2923)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-12-04 19:42:44 UTC (rev 2924)
@@ -69,6 +69,35 @@
self.init()
self.run()
+class MintServerTool(BaseMintTool):
+ def __init__(self, name):
+ super(MintServerTool, self).__init__(name)
+
+ def init(self):
+ super(MintServerTool, self).init()
+
+ def do_run(self, opts, args):
+ ddef = "postgresql://cumin@localhost/cumin"
+ freqDefault = 600 # 10 minutes
+ thresholdDefault = 24 * 3600 # 1 day
+ model = MintModel(opts.get("data", ddef),
+ int(opts.get("expire-frequency", freqDefault)),
+ int(opts.get("expire-threshold", thresholdDefault)),
+ debug=True)
+
+ model.check()
+ model.init()
+ model.start()
+
+ try:
+ for arg in args[1:]:
+ model.addBroker(arg)
+
+ while True:
+ sleep(2)
+ finally:
+ model.stop()
+
class MintBenchTool(BaseMintTool):
def __init__(self, name):
super(MintBenchTool, self).__init__(name)
@@ -80,8 +109,10 @@
ddef = "postgresql://cumin@localhost/cumin"
freqDefault = 600 # 10 minutes
thresholdDefault = 24 * 3600 # 1 day
- model = MintModel(opts.get("data", ddef), opts.get("expire-frequency", freqDefault), \
- opts.get("expire-threshold", thresholdDefault), debug=True)
+ model = MintModel(opts.get("data", ddef),
+ int(opts.get("expire-frequency", freqDefault)),
+ int(opts.get("expire-threshold", thresholdDefault)),
+ debug=True)
model.check()
model.init()
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-03 22:26:35 UTC (rev 2923)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-04 19:42:44 UTC (rev 2924)
@@ -273,8 +273,6 @@
pass
def processBroker(self, cursor, id):
- print "self.broker.databaseId", self.broker.databaseId
-
if self.broker.databaseId is None:
op = SqlGetBrokerRegistration()
op.execute(cursor, {"url": self.broker.url})
17 years, 4 months
rhmessaging commits: r2923 - in mgmt/trunk: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-03 17:26:35 -0500 (Wed, 03 Dec 2008)
New Revision: 2923
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/update.py
Log:
Use the right mintBrokers mapping
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-03 22:12:02 UTC (rev 2922)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-03 22:26:35 UTC (rev 2923)
@@ -258,9 +258,9 @@
def get_session_by_registration(self, reg):
assert reg.broker
- assert reg.broker.qmfBrokerId in self.model.data.mintBrokers
+ assert reg.broker.qmfBrokerId in self.model.data.mintBrokersById
- broker = self.model.data.mintBrokers[reg.broker.qmfBrokerId]
+ broker = self.model.data.mintBrokersById[reg.broker.qmfBrokerId]
return broker.getAmqpSession()
class CuminActionInvocation(object):
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-03 22:12:02 UTC (rev 2922)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-03 22:26:35 UTC (rev 2923)
@@ -510,8 +510,6 @@
log.exception(e)
def do_run(self):
- log.info("Polling")
-
regUrls = set()
for reg in BrokerRegistration.select():
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-03 22:12:02 UTC (rev 2922)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-03 22:26:35 UTC (rev 2923)
@@ -236,8 +236,6 @@
log.debug("%s(%i) created", cls.__name__, id)
- if cls is Broker:
- self.processBroker(cursor, id)
else:
# Case 2
@@ -249,6 +247,9 @@
assert cursor.rowcount == 1
self.broker.objectDatabaseIds.set(oid, id)
+
+ if cls is Broker:
+ self.processBroker(cursor, id)
else:
# Case 3
@@ -272,6 +273,8 @@
pass
def processBroker(self, cursor, id):
+ print "self.broker.databaseId", self.broker.databaseId
+
if self.broker.databaseId is None:
op = SqlGetBrokerRegistration()
op.execute(cursor, {"url": self.broker.url})
17 years, 4 months
rhmessaging commits: r2922 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-03 17:12:02 -0500 (Wed, 03 Dec 2008)
New Revision: 2922
Modified:
mgmt/trunk/cumin/python/cumin/system.py
Log:
Fix which sysimage object the broker displays under
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-12-03 22:10:29 UTC (rev 2921)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-12-03 22:12:02 UTC (rev 2922)
@@ -170,9 +170,11 @@
except Exception, e:
pass
- brokers = Broker.select("system_id = '%i'" % system.id)
+ # using a loop instead of an sql select with an outer join
+ brokers = Broker.select()
for broker in brokers:
- daemons.append(BrokerRegistration.get(broker.registrationID))
+ if broker.system.nodeName == system.nodeName:
+ daemons.append(BrokerRegistration.get(broker.registrationID))
return daemons
17 years, 4 months
rhmessaging commits: r2921 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-03 17:10:29 -0500 (Wed, 03 Dec 2008)
New Revision: 2921
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
Log:
Don't display slot vis when there are no slots
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-12-03 21:55:29 UTC (rev 2920)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-12-03 22:10:29 UTC (rev 2921)
@@ -154,7 +154,7 @@
self.add_child(ajax)
self.max_px = 480.0
- self.max_item_em = 28.0
+ self.max_item_px = 28.0
self.max_columns = 20.0
self.max_background_cols = 15 # max columns with background image
@@ -177,9 +177,8 @@
def get_grid_width(self, session):
count = len(self.cells.get_items(session))
columns = self.cells.calculate_columns(count)
- # we have approx 15em to work with
- # we'd like each column to be between 1em and 2em
- width = float(columns) * self.max_item_em
+ # we have approx 480px to work with
+ width = float(columns) * self.max_item_px
if width > self.max_px:
width = self.max_px
extra = 3.0 * columns # left right border plus 1 right margin
@@ -188,7 +187,7 @@
return int(width + extra)
def render_grid_width(self, session):
- width = self.get_grid_width(session)
+ width = self.get_grid_width(session) or self.max_px
return "%ipx" % int(width)
class GridCells(ItemSet):
@@ -201,12 +200,19 @@
self.sticky = self.Sticky(app, "sticky_info")
self.add_child(self.sticky)
+ def render(self, session, *args):
+ count = len(self.get_items(session))
+ if count == 0:
+ return "0 slots found"
+ else:
+ return super(StatUtilizationGrid.GridCells, self).render(session, *args)
+
def do_get_items(self, session):
cells = self.parent.get_cells(session)
self.items.set(session, cells)
self.width.set(session,
self.calculate_cell_width(len(cells)))
- return cells
+ return cells
def render_cell_id(self, session, cell):
return cell["id"]
@@ -226,10 +232,10 @@
def calculate_cell_width(self, count):
columns = self.calculate_columns(count)
- width = self.parent.max_item_em
+ width = self.parent.max_item_px
if columns:
min = self.parent.max_px / float(columns)
- width = min > self.parent.max_item_em and self.parent.max_item_em or min
+ width = min > self.parent.max_item_px and self.parent.max_item_px or min
return "%ipx" % int(width)
def render_href(self, session, cell):
@@ -296,6 +302,10 @@
return self.name
class Legend(ItemSet):
+ def render(self, session, *args):
+ if len(self.parent.cells.get_items(session)) > 0:
+ return super(StatUtilizationGrid.Legend, self).render(session, *args)
+
def do_get_items(self, session, *args):
return self.parent.get_colors(session)
17 years, 4 months