rhmessaging commits: r3794 - store/tags.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-01-13 09:49:12 -0500 (Wed, 13 Jan 2010)
New Revision: 3794
Added:
store/tags/qpid-0.6-release/
Log:
Tag approximately matching creation of qpid's 0.6-release branch.
Copied: store/tags/qpid-0.6-release (from rev 3793, store/trunk)
14 years, 11 months
rhmessaging commits: r3793 - store/tags.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-01-13 09:48:08 -0500 (Wed, 13 Jan 2010)
New Revision: 3793
Removed:
store/tags/qpid-0.6-release/
Log:
On reflection, it would be better to tag trunk at this point, so deleting this tag before creating a new one of the same name
14 years, 11 months
rhmessaging commits: r3792 - in store/trunk/cpp/tests: cluster and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-01-13 09:31:33 -0500 (Wed, 13 Jan 2010)
New Revision: 3792
Modified:
store/trunk/cpp/tests/Makefile.am
store/trunk/cpp/tests/cluster/Makefile.am
Log:
Updated Makefile.am file to correct old and missing names which get used in "make dist".
Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am 2010-01-13 13:08:34 UTC (rev 3791)
+++ store/trunk/cpp/tests/Makefile.am 2010-01-13 14:31:33 UTC (rev 3792)
@@ -78,13 +78,17 @@
EXTRA_DIST = \
clean.sh \
failing_python_tests.txt \
+ new_python_tests \
+ old_python_tests \
persistence.py \
- python_tests \
- run_python_tests \
+ run_long_python_tests \
+ run_old_python_tests \
+ run_new_python_tests \
run_test \
start_broker \
stop_broker \
system_test.sh \
+ tests_env.sh \
MessageUtils.h \
vg_check \
.valgrindrc \
@@ -109,4 +113,4 @@
check-short: all
$(MAKE) check TESTS="$(SHORT_TESTS)" SUBDIRS=.
-
\ No newline at end of file
+
Modified: store/trunk/cpp/tests/cluster/Makefile.am
===================================================================
--- store/trunk/cpp/tests/cluster/Makefile.am 2010-01-13 13:08:34 UTC (rev 3791)
+++ store/trunk/cpp/tests/cluster/Makefile.am 2010-01-13 14:31:33 UTC (rev 3792)
@@ -50,6 +50,8 @@
abs_srcdir=$(abs_srcdir)
EXTRA_DIST = \
+ cluster_tests_env.sh \
+ run_cluster_test \
run_cluster_tests
check-long:
14 years, 11 months
rhmessaging commits: r3791 - store/tags.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-01-13 08:08:34 -0500 (Wed, 13 Jan 2010)
New Revision: 3791
Added:
store/tags/qpid-0.6-release/
Log:
Tag matching creation of qpid's 0.6-release branch. The last checkin on this tag was 3755.
Copied: store/tags/qpid-0.6-release (from rev 3755, store/trunk)
14 years, 11 months
rhmessaging commits: r3790 - in mgmt/trunk: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-01-12 16:47:25 -0500 (Tue, 12 Jan 2010)
New Revision: 3790
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/test.py
mgmt/trunk/mint/python/mint/database.py
mgmt/trunk/mint/python/mint/expire.py
mgmt/trunk/mint/python/mint/main.py
mgmt/trunk/mint/python/mint/model.py
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/python/mint/schemalocal.py
mgmt/trunk/mint/python/mint/schemaparser.py
mgmt/trunk/mint/python/mint/sql.py
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
mgmt/trunk/mint/python/mint/util.py
mgmt/trunk/mint/python/mint/vacuum.py
Log:
Four-space tabs, and pythonic naming
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/cumin/python/cumin/model.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -25,9 +25,9 @@
config = app.config
self.mint = Mint(config)
- self.mint.updateEnabled = False
- self.mint.expireEnabled = False
- self.mint.vacuumEnabled = False
+ self.mint.update_enabled = False
+ self.mint.expire_enabled = False
+ self.mint.vacuum_enabled = False
self.lock = Lock()
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/cumin/python/cumin/test.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -24,7 +24,7 @@
log.info("Waiting for the broker to connect")
def connect():
- if self.app.model.mint.model.isConnected():
+ if self.app.model.mint.model.agents:
log.info("The broker is connected")
return True
@@ -36,7 +36,7 @@
self.user = Subject.getByName("tester")
if not self.user:
- self.user = Subject(name="tester")
+ self.user = Subject(name="tester", password="XXX")
self.user.syncUpdate()
super(CuminTest, self).do_run(session)
Modified: mgmt/trunk/mint/python/mint/database.py
===================================================================
--- mgmt/trunk/mint/python/mint/database.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/database.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -9,153 +9,153 @@
log = logging.getLogger("mint.database")
class MintDatabase(object):
- def __init__(self, app):
- self.app = app
+ def __init__(self, app):
+ self.app = app
- def getConnection(self):
- return connectionForURI(self.app.config.data).getConnection()
+ def get_connection(self):
+ return connectionForURI(self.app.config.data).getConnection()
- def check(self):
- self.checkConnection()
+ def check(self):
+ self.check_connection()
- def init(self):
- sqlhub.processConnection = connectionForURI(self.app.config.data)
+ def init(self):
+ sqlhub.processConnection = connectionForURI(self.app.config.data)
- def checkConnection(self):
- conn = self.getConnection()
+ def check_connection(self):
+ conn = self.get_connection()
- try:
- cursor = conn.cursor()
- cursor.execute("select now()")
- finally:
- conn.close()
+ try:
+ cursor = conn.cursor()
+ cursor.execute("select now()")
+ finally:
+ conn.close()
- def checkSchema(self):
- pass
+ def check_schema(self):
+ pass
- def dropSchema(self):
- conn = self.getConnection()
+ def drop_schema(self):
+ conn = self.get_connection()
- try:
- cursor = conn.cursor()
+ try:
+ cursor = conn.cursor()
- try:
- cursor.execute("drop schema public cascade")
- except ProgrammingError:
- log.warn("The schema is already dropped")
+ try:
+ cursor.execute("drop schema public cascade")
+ except ProgrammingError:
+ log.warn("The schema is already dropped")
- conn.commit()
- finally:
- conn.close()
+ conn.commit()
+ finally:
+ conn.close()
- def __splitSQLStatements(self, text):
- result = list()
- unmatchedQuote = False
- tmpStmt = ""
+ 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)
+ 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 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
+ if unmatchedQuote:
+ result.append(tmpStmt.lstrip())
+ return result
- def loadSchema(self):
- paths = list()
+ def load_schema(self):
+ paths = list()
- paths.append(os.path.join(self.app.config.home, "sql", "schema.sql"))
- paths.append(os.path.join(self.app.config.home, "sql", "indexes.sql"))
- paths.append(os.path.join(self.app.config.home, "sql", "triggers.sql"))
+ paths.append(os.path.join(self.app.config.home, "sql", "schema.sql"))
+ paths.append(os.path.join(self.app.config.home, "sql", "indexes.sql"))
+ paths.append(os.path.join(self.app.config.home, "sql", "triggers.sql"))
- scripts = list()
+ scripts = list()
- for path in paths:
- file = open(path, "r")
+ for path in paths:
+ file = open(path, "r")
- try:
- scripts.append((path, file.read()))
- finally:
- file.close()
+ try:
+ scripts.append((path, file.read()))
+ finally:
+ file.close()
- conn = self.getConnection()
+ conn = self.get_connection()
- try:
- cursor = conn.cursor()
+ try:
+ cursor = conn.cursor()
- try:
- cursor.execute("create schema public");
- except:
- conn.rollback()
- pass
+ try:
+ cursor.execute("create schema public");
+ except:
+ conn.rollback()
+ pass
- for path, text in scripts:
- stmts = self.__splitSQLStatements(text)
- count = 0
+ for path, text in scripts:
+ stmts = self.__splitSQLStatements(text)
+ count = 0
- for stmt in stmts:
- stmt = stmt.strip()
+ for stmt in stmts:
+ stmt = stmt.strip()
- if stmt:
- try:
- cursor.execute(stmt)
- except Exception, e:
- print "Failed executing statement:"
- print stmt
+ if stmt:
+ try:
+ cursor.execute(stmt)
+ except Exception, e:
+ print "Failed executing statement:"
+ print stmt
- raise e
+ raise e
- count += 1
+ count += 1
- print "Executed %i statements from file '%s'" % (count, path)
+ print "Executed %i statements from file '%s'" % (count, path)
- conn.commit()
+ conn.commit()
- info = MintInfo(version="0.1")
- info.sync()
+ info = MintInfo(version="0.1")
+ info.sync()
- # Standard roles
+ # Standard roles
- user = Role(name="user")
- user.sync()
+ user = Role(name="user")
+ user.sync()
- admin = Role(name="admin")
- admin.sync()
- finally:
- conn.close()
+ admin = Role(name="admin")
+ admin.sync()
+ finally:
+ conn.close()
- def checkSchema(self):
- conn = self.getConnection()
+ def check_schema(self):
+ conn = self.get_connection()
- try:
- cursor = conn.cursor()
+ try:
+ cursor = conn.cursor()
- try:
- cursor.execute("select version from mint_info");
- except Exception, e:
- print "No schema present"
- return
+ try:
+ cursor.execute("select version from mint_info");
+ except Exception, e:
+ print "No schema present"
+ return
- for rec in cursor:
- print "OK (version %s)" % rec[0]
- return;
+ for rec in cursor:
+ print "OK (version %s)" % rec[0]
+ return;
- print "No schema present"
- finally:
- conn.close()
+ print "No schema present"
+ finally:
+ conn.close()
Modified: mgmt/trunk/mint/python/mint/expire.py
===================================================================
--- mgmt/trunk/mint/python/mint/expire.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/expire.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -8,75 +8,79 @@
log = logging.getLogger("mint.expire")
class ExpireThread(MintDaemonThread):
- def __init__(self, app):
- super(ExpireThread, self).__init__(app)
+ def __init__(self, app):
+ super(ExpireThread, self).__init__(app)
- self.keepCurrStats = False
+ self.keep_curr_stats = False
- self.ops = []
- self.attrs = dict()
+ self.ops = []
+ self.attrs = dict()
- def init(self):
- frequency = self.app.expireFrequency
- threshold = self.app.expireThreshold
+ def init(self):
+ frequency = self.app.expire_frequency
+ threshold = self.app.expire_threshold
- for cls in mint.schema.statsClasses:
- self.ops.append(SqlExpire(eval(cls), self.keepCurrStats))
- for cls in mint.schema.entityClasses:
- self.ops.append(SqlExpire(eval(cls), self.keepCurrStats))
+ for cls in mint.schema.statsClasses:
+ self.ops.append(SqlExpire(eval(cls), self.keep_curr_stats))
+ for cls in mint.schema.entityClasses:
+ self.ops.append(SqlExpire(eval(cls), self.keep_curr_stats))
- self.attrs["threshold"] = threshold
+ self.attrs["threshold"] = threshold
- frequency_out, frequency_unit = self.__convertTimeUnits(frequency)
- threshold_out, threshold_unit = self.__convertTimeUnits(threshold)
- log.debug("Expiring database records older than %d %s, every %d %s" % \
- (threshold_out, threshold_unit, frequency_out, frequency_unit))
+ frequency_out, frequency_unit = self.__convertTimeUnits(frequency)
+ threshold_out, threshold_unit = self.__convertTimeUnits(threshold)
- def run(self):
- frequency = self.app.expireFrequency
+ args = (threshold_out, threshold_unit, frequency_out, frequency_unit)
- while True:
- if self.stopRequested:
- break
+ log.debug("Expiring database records older than %d %s, every %d %s" \
+ % args)
+
- up = ExpireUpdate()
- self.app.updateThread.enqueue(up)
+ def run(self):
+ frequency = self.app.expire_frequency
- sleep(frequency)
+ while True:
+ if self.stop_requested:
+ break
- def __convertTimeUnits(self, t):
- if t / (24*3600) >= 1:
- t_out = t / (24*3600)
- t_unit = "days"
- elif t / 3600 >= 1:
- t_out = t / 3600
- t_unit = "hours"
- elif t / 60 >= 1:
- t_out = t / 60
- t_unit = "minutes"
- else:
- t_out = t
- t_unit = "seconds"
- return (t_out, t_unit)
+ up = ExpireUpdate()
+ self.app.update_thread.enqueue(up)
+ sleep(frequency)
+
+ def __convertTimeUnits(self, t):
+ if t / (24 * 3600) >= 1:
+ t_out = t / (24 * 3600)
+ t_unit = "days"
+ elif t / 3600 >= 1:
+ t_out = t / 3600
+ t_unit = "hours"
+ elif t / 60 >= 1:
+ t_out = t / 60
+ t_unit = "minutes"
+ else:
+ t_out = t
+ t_unit = "seconds"
+ return (t_out, t_unit)
+
class ExpireUpdate(Update):
- def do_process(self, conn, stats):
- attrs = self.thread.app.expireThread.attrs
+ def do_process(self, conn, stats):
+ attrs = self.thread.app.expire_thread.attrs
- cursor = conn.cursor()
- total = 0
+ cursor = conn.cursor()
+ total = 0
- for op in self.thread.app.expireThread.ops:
- log.debug("Running expire op %s", op)
+ for op in self.thread.app.expire_thread.ops:
+ log.debug("Running expire op %s", op)
- count = op.execute(cursor, attrs)
+ count = op.execute(cursor, attrs)
- conn.commit()
+ conn.commit()
- log.debug("%i records expired", count)
+ log.debug("%i records expired", count)
- total += count
+ total += count
- log.debug("%i total records expired", total)
+ log.debug("%i total records expired", total)
- stats.expired += 1
+ stats.expired += 1
Modified: mgmt/trunk/mint/python/mint/main.py
===================================================================
--- mgmt/trunk/mint/python/mint/main.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/main.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -15,111 +15,111 @@
log = logging.getLogger("mint.main")
class Mint(Lifecycle):
- def __init__(self, config):
- self.log = log
+ def __init__(self, config):
+ self.log = log
- self.config = config
- self.database = MintDatabase(self)
- self.model = MintModel(self)
+ self.config = config
+ self.database = MintDatabase(self)
+ self.model = MintModel(self)
- self.updateEnabled = True
- self.updateThread = UpdateThread(self)
+ self.update_enabled = True
+ self.update_thread = UpdateThread(self)
- self.expireEnabled = True
- self.expireFrequency = self.config.expire_frequency
- self.expireThreshold = self.config.expire_threshold
- self.expireThread = ExpireThread(self)
+ self.expire_enabled = True
+ self.expire_frequency = self.config.expire_frequency
+ self.expire_threshold = self.config.expire_threshold
+ self.expire_thread = ExpireThread(self)
- self.vacuumEnabled = True
- self.vacuumThread = VacuumThread(self)
+ self.vacuum_enabled = True
+ self.vacuum_thread = VacuumThread(self)
- def check(self):
- self.database.check()
- self.model.check()
+ def check(self):
+ self.database.check()
+ self.model.check()
- def do_init(self):
- self.database.init()
- self.model.init()
+ def do_init(self):
+ self.database.init()
+ self.model.init()
- def state(cond):
- return cond and "enabled" or "disabled"
+ def state(cond):
+ return cond and "enabled" or "disabled"
- log.info("Updates are %s", state(self.updateEnabled))
- log.info("Expiration is %s", state(self.expireEnabled))
+ log.info("Updates are %s", state(self.update_enabled))
+ log.info("Expiration is %s", state(self.expire_enabled))
- self.updateThread.init()
- self.expireThread.init()
- self.vacuumThread.init()
+ self.update_thread.init()
+ self.expire_thread.init()
+ self.vacuum_thread.init()
- def do_start(self):
- self.model.start()
+ def do_start(self):
+ self.model.start()
- if self.updateEnabled:
- self.updateThread.start()
+ if self.update_enabled:
+ self.update_thread.start()
- if self.expireEnabled:
- self.expireThread.start()
+ if self.expire_enabled:
+ self.expire_thread.start()
- if self.vacuumEnabled:
- self.vacuumThread.start()
+ if self.vacuum_enabled:
+ self.vacuum_thread.start()
- def do_stop(self):
- self.model.stop()
+ def do_stop(self):
+ self.model.stop()
- if self.updateEnabled:
- self.updateThread.stop()
+ if self.update_enabled:
+ self.update_thread.stop()
- if self.expireEnabled:
- self.expireThread.stop()
+ if self.expire_enabled:
+ self.expire_thread.stop()
- if self.vacuumEnabled:
- self.vacuumThread.stop()
+ if self.vacuum_enabled:
+ self.vacuum_thread.stop()
class MintConfig(Config):
- def __init__(self):
- super(MintConfig, self).__init__()
+ def __init__(self):
+ super(MintConfig, self).__init__()
- hdef = os.path.normpath("/var/lib/cumin")
- hdef = os.environ.get("CUMIN_HOME", hdef)
- self.home = os.environ.get("MINT_HOME", hdef)
+ hdef = os.path.normpath("/var/lib/cumin")
+ hdef = os.environ.get("CUMIN_HOME", hdef)
+ self.home = os.environ.get("MINT_HOME", hdef)
- if not os.path.isdir(self.home):
- raise Exception("Home path '%s' is not a directory")
+ if not os.path.isdir(self.home):
+ raise Exception("Home path '%s' is not a directory")
- param = ConfigParameter(self, "data", str)
- param.default = "postgresql://mint@localhost/mint"
+ param = ConfigParameter(self, "data", str)
+ param.default = "postgresql://mint@localhost/mint"
- param = ConfigParameter(self, "qmf", str)
- param.default = "amqp://localhost"
+ param = ConfigParameter(self, "qmf", str)
+ param.default = "amqp://localhost"
- param = ConfigParameter(self, "log-file", str)
- param.default = os.path.join(self.home, "log", "mint.log")
+ param = ConfigParameter(self, "log-file", str)
+ param.default = os.path.join(self.home, "log", "mint.log")
- param = ConfigParameter(self, "log-level", str)
- param.default = "warn"
+ param = ConfigParameter(self, "log-level", str)
+ param.default = "warn"
- param = ConfigParameter(self, "debug", bool)
- param.default = False
+ param = ConfigParameter(self, "debug", bool)
+ param.default = False
- param = ConfigParameter(self, "expire-frequency", int)
- param.default = 600 # 10 minutes
+ param = ConfigParameter(self, "expire-frequency", int)
+ param.default = 600 # 10 minutes
- param = ConfigParameter(self, "expire-threshold", int)
- param.default = 24 * 3600 # 1 day
+ param = ConfigParameter(self, "expire-threshold", int)
+ param.default = 24 * 3600 # 1 day
- def init(self):
- super(MintConfig, self).init()
+ def init(self):
+ super(MintConfig, self).init()
- self.load_file(os.path.join(self.home, "etc", "cumin.conf"))
- self.load_file(os.path.join(self.home, "etc", "mint.conf"))
+ self.load_file(os.path.join(self.home, "etc", "cumin.conf"))
+ self.load_file(os.path.join(self.home, "etc", "mint.conf"))
- self.load_file(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
- self.load_file(os.path.join(os.path.expanduser("~"), ".mint.conf"))
+ self.load_file(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
+ self.load_file(os.path.join(os.path.expanduser("~"), ".mint.conf"))
- enable_logging("mint", self.log_level, self.log_file)
+ enable_logging("mint", self.log_level, self.log_file)
def get_addr_for_vhost(vhost):
- broker = vhost.broker
- host = broker.system.nodeName
- port = broker.port
- return (host, port)
+ broker = vhost.broker
+ host = broker.system.nodeName
+ port = broker.port
+ return (host, port)
Modified: mgmt/trunk/mint/python/mint/model.py
===================================================================
--- mgmt/trunk/mint/python/mint/model.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/model.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -15,233 +15,234 @@
log = logging.getLogger("mint.model")
class MintModel(Lifecycle):
- def __init__(self, app):
- self.log = log
+ def __init__(self, app):
+ self.log = log
- assert mint.schema.model is None
- mint.schema.model = self
+ assert mint.schema.model is None
+ mint.schema.model = self
- self.app = app
+ self.app = app
- self.qmf_session = None
- self.qmf_brokers = list()
+ self.qmf_session = None
+ self.qmf_brokers = list()
- # qmfAgentId => MintAgent
- self.agents = dict()
+ # qmfAgentId => MintAgent
+ self.agents = dict()
- # int seq => callable
- self.outstanding_method_calls = dict()
+ # int seq => callable
+ self.outstanding_method_calls = dict()
- self.lock = RLock()
+ self.lock = RLock()
- def check(self):
- pass
+ def check(self):
+ pass
- def do_init(self):
- assert self.qmf_session is None
+ def do_init(self):
+ assert self.qmf_session is None
- self.qmf_session = Session(MintConsole(self),
- manageConnections=True,
- rcvObjects=self.app.updateEnabled)
+ self.qmf_session = Session(MintConsole(self),
+ manageConnections=True,
+ rcvObjects=self.app.update_enabled)
- def do_start(self):
- # Clean up any transient objects that a previous instance may have
- # left behind in the DB; it's basically an unconstrained agent
- # disconnect update, for any agent
+ def do_start(self):
+ # Clean up any transient objects that a previous instance may
+ # have left behind in the DB; it's basically an unconstrained
+ # agent disconnect update, for any agent
- up = AgentDisconnectUpdate(None)
- self.app.updateThread.enqueue(up)
+ up = AgentDisconnectUpdate(None)
+ self.app.update_thread.enqueue(up)
- uris = [x.strip() for x in self.app.config.qmf.split(",")]
+ uris = [x.strip() for x in self.app.config.qmf.split(",")]
- for uri in uris:
- self.add_broker(uri)
+ for uri in uris:
+ self.add_broker(uri)
- def do_stop(self):
- for qbroker in self.qmf_brokers:
- self.qmf_session.delBroker(qbroker)
+ def do_stop(self):
+ for qbroker in self.qmf_brokers:
+ self.qmf_session.delBroker(qbroker)
- def add_broker(self, url):
- log.info("Adding qmf broker at %s", url)
+ def add_broker(self, url):
+ log.info("Adding qmf broker at %s", url)
- self.lock.acquire()
- try:
- qbroker = self.qmf_session.addBroker(url)
- self.qmf_brokers.append(qbroker)
- finally:
- self.lock.release()
+ self.lock.acquire()
+ try:
+ qbroker = self.qmf_session.addBroker(url)
+ self.qmf_brokers.append(qbroker)
+ finally:
+ self.lock.release()
class MintAgent(object):
- def __init__(self, model, agent):
- self.model = model
- self.agent = agent
+ def __init__(self, model, agent):
+ self.model = model
+ self.agent = agent
- self.id = str(QmfAgentId.fromAgent(agent))
+ self.id = str(QmfAgentId.fromAgent(agent))
- self.last_heartbeat = None
+ self.last_heartbeat = None
- # qmfObjectId => int database id
- self.database_ids = MintCache()
+ # qmfObjectId => int database id
+ self.database_ids = MintCache()
- # qmfObjectId => list of ModelUpdate objects
- self.deferred_updates = defaultdict(list)
+ # qmfObjectId => list of ModelUpdate objects
+ self.deferred_updates = defaultdict(list)
- self.model.lock.acquire()
- try:
- assert self.id not in self.model.agents
- self.model.agents[self.id] = self
- finally:
- self.model.lock.release()
+ self.model.lock.acquire()
+ try:
+ assert self.id not in self.model.agents
+ self.model.agents[self.id] = self
+ finally:
+ self.model.lock.release()
- def callMethod(self, mintObject, methodName, callback, args):
- classKey = ClassKey(mintObject.qmfClassKey)
- objectId = QmfObjectId.fromString(mintObject.qmfObjectId).toObjectId()
+ def call_method(self, object, name, callback, args):
+ classKey = ClassKey(object.qmfClassKey)
+ objectId = QmfObjectId.fromString(object.qmfObjectId).toObjectId()
- self.model.lock.acquire()
- try:
- broker = self.agent.getBroker()
+ self.model.lock.acquire()
+ try:
+ broker = self.agent.getBroker()
- seq = self.model.qmf_session._sendMethodRequest \
- (broker, classKey, objectId, methodName, args)
+ seq = self.model.qmf_session._sendMethodRequest \
+ (broker, classKey, objectId, name, args)
- if seq is not None:
- self.model.outstanding_method_calls[seq] = callback
+ if seq is not None:
+ self.model.outstanding_method_calls[seq] = callback
- return seq
- finally:
- self.model.lock.release()
+ return seq
+ finally:
+ self.model.lock.release()
- def delete(self):
- self.model.lock.acquire()
- try:
- del self.model.agents[self.id]
- finally:
- self.model.lock.release()
-
- self.model = None
+ def delete(self):
+ self.model.lock.acquire()
+ try:
+ del self.model.agents[self.id]
+ finally:
+ self.model.lock.release()
- def __repr__(self):
- return "%s(%s)" % (self.__class__.__name__, self.id)
+ self.model = None
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, self.id)
+
class MintConsole(Console):
- def __init__(self, model):
- self.model = model
+ def __init__(self, model):
+ self.model = model
- self.deferred_object_prop_calls = defaultdict(list)
- self.deferred_object_stat_calls = defaultdict(list)
+ self.deferred_object_prop_calls = defaultdict(list)
+ self.deferred_object_stat_calls = defaultdict(list)
- def brokerConnected(self, qbroker):
- log.info("Broker at %s:%i is connected", qbroker.host, qbroker.port)
+ def brokerConnected(self, qbroker):
+ log.info("Broker at %s:%i is connected", qbroker.host, qbroker.port)
- def brokerInfo(self, qbroker):
- # Now we have a brokerId to use to generate fully qualified agent
- # IDs
+ def brokerInfo(self, qbroker):
+ # Now we have a brokerId to use to generate fully qualified agent
+ # IDs
- for qagent in qbroker.getAgents():
- MintAgent(self.model, qagent)
+ for qagent in qbroker.getAgents():
+ MintAgent(self.model, qagent)
- def brokerDisconnected(self, qbroker):
- log.info("Broker at %s:%i is disconnected", qbroker.host, qbroker.port)
+ def brokerDisconnected(self, qbroker):
+ log.info("Broker at %s:%i is disconnected", qbroker.host, qbroker.port)
- def newAgent(self, qagent):
- log.info("Creating %s", qagent)
+ def newAgent(self, qagent):
+ log.info("Creating %s", qagent)
- # Some agents come down without a brokerId, meaning we can't
- # generate a fully qualified agent ID for them. Those we handle
- # in brokerInfo.
+ # Some agents come down without a brokerId, meaning we can't
+ # generate a fully qualified agent ID for them. Those we handle
+ # in brokerInfo.
- if qagent.getBroker().brokerId:
- agent = MintAgent(self.model, qagent)
+ if qagent.getBroker().brokerId:
+ agent = MintAgent(self.model, qagent)
- # XXX This business is to handle an agent-vs-agent-data ordering
- # problem
+ # XXX This business is to handle an agent-vs-agent-data ordering
+ # problem
- objectPropCalls = self.deferred_object_prop_calls[agent.id]
+ objectPropCalls = self.deferred_object_prop_calls[agent.id]
- for broker, object in objectPropCalls:
- self.objectProps(broker, object)
+ for broker, object in objectPropCalls:
+ self.objectProps(broker, object)
- objectStatCalls = self.deferred_object_stat_calls[agent.id]
+ objectStatCalls = self.deferred_object_stat_calls[agent.id]
- for broker, object in objectStatCalls:
- self.objectStats(broker, object)
+ for broker, object in objectStatCalls:
+ self.objectStats(broker, object)
- def delAgent(self, qagent):
- log.info("Deleting %s", qagent)
+ def delAgent(self, qagent):
+ log.info("Deleting %s", qagent)
- id = str(QmfAgent.fromAgent(qagent))
+ id = str(QmfAgentId.fromAgent(qagent))
- agent = self.model.agents[id]
- agent.delete()
-
- up = AgentDisconnectUpdate(agent)
- self.model.app.updateThread.enqueue(up)
+ agent = self.model.agents[id]
+ agent.delete()
- def heartbeat(self, qagent, timestamp):
- timestamp = timestamp / 1000000000
+ up = AgentDisconnectUpdate(agent)
+ self.model.app.update_thread.enqueue(up)
- id = str(QmfAgentId.fromAgent(qagent))
+ def heartbeat(self, qagent, timestamp):
+ timestamp = timestamp / 1000000000
- agent = self.model.agents[id]
- agent.last_heartbeat = datetime.fromtimestamp(timestamp)
+ id = str(QmfAgentId.fromAgent(qagent))
- def newPackage(self, name):
- log.info("New package %s", name)
+ agent = self.model.agents[id]
+ agent.last_heartbeat = datetime.fromtimestamp(timestamp)
- def newClass(self, kind, classKey):
- log.info("New class %s", classKey)
+ def newPackage(self, name):
+ log.info("New package %s", name)
- def objectProps(self, broker, object):
- if not self.model.app.updateThread.isAlive():
- return
+ def newClass(self, kind, classKey):
+ log.info("New class %s", classKey)
- self.model.lock.acquire()
- try:
- id = str(QmfAgentId.fromObject(object))
+ def objectProps(self, broker, object):
+ if not self.model.app.update_thread.isAlive():
+ return
- try:
- agent = self.model.agents[id]
- except KeyError:
- self.deferred_object_prop_calls[id].append((broker, object))
- return
- finally:
- self.model.lock.release()
+ self.model.lock.acquire()
+ try:
+ id = str(QmfAgentId.fromObject(object))
- up = PropertyUpdate(agent, object)
- self.model.app.updateThread.enqueue(up)
+ try:
+ agent = self.model.agents[id]
+ except KeyError:
+ self.deferred_object_prop_calls[id].append((broker, object))
+ return
+ finally:
+ self.model.lock.release()
- def objectStats(self, broker, object):
- """ Invoked when an object is updated. """
+ up = PropertyUpdate(agent, object)
+ self.model.app.update_thread.enqueue(up)
- if not self.model.app.updateThread.isAlive():
- return
+ def objectStats(self, broker, object):
+ """ Invoked when an object is updated. """
- self.model.lock.acquire()
- try:
- id = str(QmfAgentId.fromObject(object))
+ if not self.model.app.update_thread.isAlive():
+ return
- try:
- agent = self.model.agents[id]
- except KeyError:
- self.deferred_object_stat_calls[id].append((broker, object))
- return
- finally:
- self.model.lock.release()
+ self.model.lock.acquire()
+ try:
+ id = str(QmfAgentId.fromObject(object))
- up = StatisticUpdate(agent, object)
- self.model.app.updateThread.enqueue(up)
+ try:
+ agent = self.model.agents[id]
+ except KeyError:
+ self.deferred_object_stat_calls[id].append((broker, object))
+ return
+ finally:
+ self.model.lock.release()
- def event(self, broker, event):
- """ Invoked when an event is raised. """
- pass
+ up = StatisticUpdate(agent, object)
+ self.model.app.update_thread.enqueue(up)
- def methodResponse(self, broker, seq, response):
- log.info("Method response for request %i received from %s", seq, broker)
- log.debug("Response: %s", response)
+ def event(self, broker, event):
+ """ Invoked when an event is raised. """
+ pass
- self.model.lock.acquire()
- try:
- callback = self.model.outstanding_method_calls.pop(seq)
- callback(response.text, response.outArgs)
- finally:
- self.model.lock.release()
+ def methodResponse(self, broker, seq, response):
+ log.info("Method response for request %i received from %s",
+ seq, broker)
+ log.debug("Response: %s", response)
+
+ self.model.lock.acquire()
+ try:
+ callback = self.model.outstanding_method_calls.pop(seq)
+ callback(response.text, response.outArgs)
+ finally:
+ self.model.lock.release()
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/schema.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -165,7 +165,7 @@
if Id is not None:
args.append(Id)
- agent.callMethod(self, "Submit", callback, args)
+ agent.call_method(self, "Submit", callback, args)
def GetAd(self, callback, Id, JobAd):
try:
@@ -180,7 +180,7 @@
if JobAd is not None:
args.append(JobAd)
- agent.callMethod(self, "GetAd", callback, args)
+ agent.call_method(self, "GetAd", callback, args)
def SetAttribute(self, callback, Id, Name, Value):
try:
@@ -197,7 +197,7 @@
if Value is not None:
args.append(Value)
- agent.callMethod(self, "SetAttribute", callback, args)
+ agent.call_method(self, "SetAttribute", callback, args)
def Hold(self, callback, Id, Reason):
try:
@@ -212,7 +212,7 @@
if Reason is not None:
args.append(Reason)
- agent.callMethod(self, "Hold", callback, args)
+ agent.call_method(self, "Hold", callback, args)
def Release(self, callback, Id, Reason):
try:
@@ -227,7 +227,7 @@
if Reason is not None:
args.append(Reason)
- agent.callMethod(self, "Release", callback, args)
+ agent.call_method(self, "Release", callback, args)
def Remove(self, callback, Id, Reason):
try:
@@ -242,7 +242,7 @@
if Reason is not None:
args.append(Reason)
- agent.callMethod(self, "Remove", callback, args)
+ agent.call_method(self, "Remove", callback, args)
def Fetch(self, callback, Id, File, Start, End, Data):
try:
@@ -263,7 +263,7 @@
if Data is not None:
args.append(Data)
- agent.callMethod(self, "Fetch", callback, args)
+ agent.call_method(self, "Fetch", callback, args)
def GetStates(self, callback, Submission, State, Count):
try:
@@ -280,7 +280,7 @@
if Count is not None:
args.append(Count)
- agent.callMethod(self, "GetStates", callback, args)
+ agent.call_method(self, "GetStates", callback, args)
def GetJobs(self, callback, Submission, Jobs):
try:
@@ -295,7 +295,7 @@
if Jobs is not None:
args.append(Jobs)
- agent.callMethod(self, "GetJobs", callback, args)
+ agent.call_method(self, "GetJobs", callback, args)
def echo(self, callback, sequence, body):
try:
@@ -310,7 +310,7 @@
if body is not None:
args.append(body)
- agent.callMethod(self, "echo", callback, args)
+ agent.call_method(self, "echo", callback, args)
class SchedulerStats(SQLObject):
class sqlmeta:
@@ -405,7 +405,7 @@
if Limits is not None:
args.append(Limits)
- agent.callMethod(self, "GetLimits", callback, args)
+ agent.call_method(self, "GetLimits", callback, args)
def SetLimit(self, callback, Name, Max):
try:
@@ -420,7 +420,7 @@
if Max is not None:
args.append(Max)
- agent.callMethod(self, "SetLimit", callback, args)
+ agent.call_method(self, "SetLimit", callback, args)
def GetStats(self, callback, Name, Ad):
try:
@@ -435,7 +435,7 @@
if Ad is not None:
args.append(Ad)
- agent.callMethod(self, "GetStats", callback, args)
+ agent.call_method(self, "GetStats", callback, args)
def SetPriority(self, callback, Name, Priority):
try:
@@ -450,7 +450,7 @@
if Priority is not None:
args.append(Priority)
- agent.callMethod(self, "SetPriority", callback, args)
+ agent.call_method(self, "SetPriority", callback, args)
def SetPriorityFactor(self, callback, Name, PriorityFactor):
try:
@@ -465,7 +465,7 @@
if PriorityFactor is not None:
args.append(PriorityFactor)
- agent.callMethod(self, "SetPriorityFactor", callback, args)
+ agent.call_method(self, "SetPriorityFactor", callback, args)
def SetUsage(self, callback, Name, Usage):
try:
@@ -480,7 +480,7 @@
if Usage is not None:
args.append(Usage)
- agent.callMethod(self, "SetUsage", callback, args)
+ agent.call_method(self, "SetUsage", callback, args)
def GetRawConfig(self, callback, Name, Value):
try:
@@ -495,7 +495,7 @@
if Value is not None:
args.append(Value)
- agent.callMethod(self, "GetRawConfig", callback, args)
+ agent.call_method(self, "GetRawConfig", callback, args)
def SetRawConfig(self, callback, Name, Value):
try:
@@ -510,7 +510,7 @@
if Value is not None:
args.append(Value)
- agent.callMethod(self, "SetRawConfig", callback, args)
+ agent.call_method(self, "SetRawConfig", callback, args)
def Reconfig(self, callback):
try:
@@ -521,7 +521,7 @@
args = list()
- agent.callMethod(self, "Reconfig", callback, args)
+ agent.call_method(self, "Reconfig", callback, args)
class NegotiatorStats(SQLObject):
class sqlmeta:
@@ -616,7 +616,7 @@
if Subsystem is not None:
args.append(Subsystem)
- agent.callMethod(self, "Start", callback, args)
+ agent.call_method(self, "Start", callback, args)
def Stop(self, callback, Subsystem):
try:
@@ -629,7 +629,7 @@
if Subsystem is not None:
args.append(Subsystem)
- agent.callMethod(self, "Stop", callback, args)
+ agent.call_method(self, "Stop", callback, args)
class MasterStats(SQLObject):
class sqlmeta:
@@ -753,7 +753,7 @@
args = list()
- agent.callMethod(self, "reloadACLFile", callback, args)
+ agent.call_method(self, "reloadACLFile", callback, args)
class AclStats(SQLObject):
class sqlmeta:
@@ -802,7 +802,7 @@
if brokerId is not None:
args.append(brokerId)
- agent.callMethod(self, "stopClusterNode", callback, args)
+ agent.call_method(self, "stopClusterNode", callback, args)
def stopFullCluster(self, callback):
try:
@@ -813,7 +813,7 @@
args = list()
- agent.callMethod(self, "stopFullCluster", callback, args)
+ agent.call_method(self, "stopFullCluster", callback, args)
class ClusterStats(SQLObject):
class sqlmeta:
@@ -912,7 +912,7 @@
if by is not None:
args.append(by)
- agent.callMethod(self, "expand", callback, args)
+ agent.call_method(self, "expand", callback, args)
class JournalStats(SQLObject):
class sqlmeta:
@@ -1024,7 +1024,7 @@
if body is not None:
args.append(body)
- agent.callMethod(self, "echo", callback, args)
+ agent.call_method(self, "echo", callback, args)
def connect(self, callback, host, port, durable, authMechanism, username, password, transport):
"""Establish a connection to another broker"""
@@ -1050,7 +1050,7 @@
if transport is not None:
args.append(transport)
- agent.callMethod(self, "connect", callback, args)
+ agent.call_method(self, "connect", callback, args)
def queueMoveMessages(self, callback, srcQueue, destQueue, qty):
"""Move messages from one queue to another"""
@@ -1068,7 +1068,7 @@
if qty is not None:
args.append(qty)
- agent.callMethod(self, "queueMoveMessages", callback, args)
+ agent.call_method(self, "queueMoveMessages", callback, args)
class BrokerStats(SQLObject):
class sqlmeta:
@@ -1177,7 +1177,7 @@
if request is not None:
args.append(request)
- agent.callMethod(self, "purge", callback, args)
+ agent.call_method(self, "purge", callback, args)
class QueueStats(SQLObject):
class sqlmeta:
@@ -1362,7 +1362,7 @@
args = list()
- agent.callMethod(self, "close", callback, args)
+ agent.call_method(self, "close", callback, args)
class ClientConnectionStats(SQLObject):
class sqlmeta:
@@ -1409,7 +1409,7 @@
args = list()
- agent.callMethod(self, "close", callback, args)
+ agent.call_method(self, "close", callback, args)
def bridge(self, callback, durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync):
"""Bridge messages over the link"""
@@ -1441,7 +1441,7 @@
if sync is not None:
args.append(sync)
- agent.callMethod(self, "bridge", callback, args)
+ agent.call_method(self, "bridge", callback, args)
class LinkStats(SQLObject):
class sqlmeta:
@@ -1492,7 +1492,7 @@
args = list()
- agent.callMethod(self, "close", callback, args)
+ agent.call_method(self, "close", callback, args)
class BridgeStats(SQLObject):
class sqlmeta:
@@ -1537,7 +1537,7 @@
args = list()
- agent.callMethod(self, "solicitAck", callback, args)
+ agent.call_method(self, "solicitAck", callback, args)
def detach(self, callback):
try:
@@ -1548,7 +1548,7 @@
args = list()
- agent.callMethod(self, "detach", callback, args)
+ agent.call_method(self, "detach", callback, args)
def resetLifespan(self, callback):
try:
@@ -1559,7 +1559,7 @@
args = list()
- agent.callMethod(self, "resetLifespan", callback, args)
+ agent.call_method(self, "resetLifespan", callback, args)
def close(self, callback):
try:
@@ -1570,7 +1570,7 @@
args = list()
- agent.callMethod(self, "close", callback, args)
+ agent.call_method(self, "close", callback, args)
class SessionStats(SQLObject):
class sqlmeta:
Modified: mgmt/trunk/mint/python/mint/schemalocal.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemalocal.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/schemalocal.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -3,73 +3,74 @@
from mint.util import *
class Subject(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- name = StringCol(unique=True, notNone=True)
- password = StringCol()
- lastChallenged = TimestampCol(default=None)
- lastLoggedIn = TimestampCol(default=None)
- lastLoggedOut = TimestampCol(default=None)
- roles = SQLRelatedJoin("Role", intermediateTable="subject_role_mapping",
- createRelatedTable=False)
+ name = StringCol(unique=True, notNone=True)
+ password = StringCol()
+ lastChallenged = TimestampCol(default=None)
+ lastLoggedIn = TimestampCol(default=None)
+ lastLoggedOut = TimestampCol(default=None)
+ roles = SQLRelatedJoin("Role",
+ intermediateTable="subject_role_mapping",
+ createRelatedTable=False)
- def getByName(cls, name):
- try:
- return Subject.selectBy(name=name)[0]
- except IndexError:
- pass
+ def getByName(cls, name):
+ try:
+ return Subject.selectBy(name=name)[0]
+ except IndexError:
+ pass
- getByName = classmethod(getByName)
+ getByName = classmethod(getByName)
class Role(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- name = StringCol(unique=True, notNone=True)
- subjects = SQLRelatedJoin("Subject",
- intermediateTable="subject_role_mapping",
- createRelatedTable=False)
+ name = StringCol(unique=True, notNone=True)
+ subjects = SQLRelatedJoin("Subject",
+ intermediateTable="subject_role_mapping",
+ createRelatedTable=False)
- def getByName(cls, name):
- try:
- return Role.selectBy(name=name)[0]
- except IndexError:
- pass
+ def getByName(cls, name):
+ try:
+ return Role.selectBy(name=name)[0]
+ except IndexError:
+ pass
- getByName = classmethod(getByName)
+ getByName = classmethod(getByName)
class SubjectRoleMapping(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- subject = ForeignKey("Subject", notNull=True, cascade=True)
- role = ForeignKey("Role", notNull=True, cascade=True)
- unique = DatabaseIndex(subject, role, unique=True)
+ subject = ForeignKey("Subject", notNull=True, cascade=True)
+ role = ForeignKey("Role", notNull=True, cascade=True)
+ unique = DatabaseIndex(subject, role, unique=True)
class ObjectNotFound(Exception):
- pass
+ pass
class MintInfo(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- version = StringCol(default="0.1", notNone=True)
+ version = StringCol(default="0.1", notNone=True)
class BrokerGroup(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- name = StringCol(unique=True, notNone=True)
- brokers = SQLRelatedJoin("Broker",
- intermediateTable="broker_group_mapping",
- createRelatedTable=False)
+ name = StringCol(unique=True, notNone=True)
+ brokers = SQLRelatedJoin("Broker",
+ intermediateTable="broker_group_mapping",
+ createRelatedTable=False)
class BrokerGroupMapping(SQLObject):
- class sqlmeta:
- lazyUpdate = True
+ class sqlmeta:
+ lazyUpdate = True
- broker = ForeignKey("Broker", notNull=True, cascade=True)
- brokerGroup = ForeignKey("BrokerGroup", notNull=True, cascade=True)
- unique = DatabaseIndex(broker, brokerGroup, unique=True)
+ broker = ForeignKey("Broker", notNull=True, cascade=True)
+ brokerGroup = ForeignKey("BrokerGroup", notNull=True, cascade=True)
+ unique = DatabaseIndex(broker, brokerGroup, unique=True)
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -194,7 +194,7 @@
self.pythonOutput += " except KeyError:\n"
self.pythonOutput += " raise Exception(\"Agent not found\")\n\n"
self.pythonOutput += actualArgs + "\n"
- self.pythonOutput += " agent.callMethod(self, \"%s\", " % elem["@name"]
+ self.pythonOutput += " agent.call_method(self, \"%s\", " % elem["@name"]
self.pythonOutput += "callback, args)\n"
def endClass(self):
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/sql.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -1,4 +1,5 @@
import logging, mint
+
from time import clock
from sqlobject import MixedCaseUnderscoreStyle
@@ -7,243 +8,244 @@
dbStyle = MixedCaseUnderscoreStyle()
profile = None
-def transformTable(table):
- try:
- table = mint.schema.schemaReservedWordsMap[table]
- except KeyError:
- pass
+def transform_table(table):
+ try:
+ table = mint.schema.schemaReservedWordsMap[table]
+ except KeyError:
+ pass
- table = table[0] + table[1:] # XXX why is this necessary?
- table = dbStyle.pythonClassToDBTable(table)
+ table = table[0] + table[1:] # XXX why is this necessary?
+ table = dbStyle.pythonClassToDBTable(table)
- return table
+ return table
-def transformColumn(column):
- return dbStyle.pythonAttrToDBColumn(column)
+def transform_column(column):
+ return dbStyle.pythonAttrToDBColumn(column)
class SqlOperation(object):
- def __init__(self, name):
- self.name = name
+ def __init__(self, name):
+ self.name = name
- self.time = None
- self.text = None
+ self.time = None
+ self.text = None
- if profile:
- profile.ops.append(self)
+ if profile:
+ profile.ops.append(self)
- def key(self):
- if hasattr(self, "cls"):
- return "%s(%s)" % (self.name, getattr(self, "cls").__name__)
- else:
- return self.name
+ def key(self):
+ if hasattr(self, "cls"):
+ return "%s(%s)" % (self.name, getattr(self, "cls").__name__)
+ else:
+ return self.name
- def __repr__(self):
- return self.key()
+ def __repr__(self):
+ return self.key()
- def generate(self):
- pass
+ def generate(self):
+ pass
- def execute(self, cursor, values=None):
- self.text = self.generate()
+ def execute(self, cursor, values=None):
+ self.text = self.generate()
- try:
- if profile:
- start = clock()
- cursor.execute(self.text, values)
- self.time = clock() - start
- else:
- cursor.execute(self.text, values)
- return cursor.rowcount
- except:
- log.warn("Text: %s", self.text)
+ try:
+ if profile:
+ start = clock()
+ cursor.execute(self.text, values)
+ self.time = clock() - start
+ else:
+ cursor.execute(self.text, values)
+ return cursor.rowcount
+ except:
+ log.warn("Text: %s", self.text)
- if values:
- for item in values.items():
- log.warn(" %-20s %r", *item)
+ if values:
+ for item in values.items():
+ log.warn(" %-20s %r", *item)
- raise
+ raise
class SqlGetId(SqlOperation):
- def __init__(self, cls):
- super(SqlGetId, self).__init__("get_id")
+ def __init__(self, cls):
+ super(SqlGetId, self).__init__("get_id")
- self.cls = cls
+ self.cls = cls
- def generate(self):
- table = self.cls.sqlmeta.table
+ def generate(self):
+ table = self.cls.sqlmeta.table
- return """
- select id
- from %s
- where qmf_agent_id = %%(qmfAgentId)s and qmf_object_id = %%(qmfObjectId)s
- """ % table
+ return """
+ select id
+ from %s
+ where qmf_agent_id = %%(qmfAgentId)s and qmf_object_id = %%(qmfObjectId)s
+ """ % table
class SqlSetStatsRefs(SqlOperation):
- def __init__(self, cls):
- super(SqlSetStatsRefs, self).__init__("set_stats_refs")
+ def __init__(self, cls):
+ super(SqlSetStatsRefs, self).__init__("set_stats_refs")
- self.cls = cls
+ self.cls = cls
- def generate(self):
- table = self.cls.sqlmeta.table
+ def generate(self):
+ table = self.cls.sqlmeta.table
- return """
- update %s
- set stats_curr_id = %%(statsId)s, stats_prev_id = stats_curr_id
- where id = %%(id)s
- """ % table
+ return """
+ update %s
+ set stats_curr_id = %%(statsId)s, stats_prev_id = stats_curr_id
+ where id = %%(id)s
+ """ % table
class SqlInsert(SqlOperation):
- def __init__(self, cls, attrs):
- super(SqlInsert, self).__init__("insert")
+ def __init__(self, cls, attrs):
+ super(SqlInsert, self).__init__("insert")
- self.cls = cls
- self.attrs = attrs
+ self.cls = cls
+ self.attrs = attrs
- def generate(self):
- table = self.cls.sqlmeta.table
+ def generate(self):
+ table = self.cls.sqlmeta.table
- cols = list()
- vals = list()
+ cols = list()
+ vals = list()
- for name in self.attrs:
- cols.append(transformColumn(name))
- vals.append("%%(%s)s" % name)
+ for name in self.attrs:
+ cols.append(transform_column(name))
+ vals.append("%%(%s)s" % name)
- colsSql = ", ".join(cols)
- valsSql = ", ".join(vals)
+ colsSql = ", ".join(cols)
+ valsSql = ", ".join(vals)
- insert = "insert into %s (%s) values (%s)" % (table, colsSql, valsSql)
- select = "select currval('%s_id_seq')" % table
+ insert = "insert into %s (%s) values (%s)" % (table, colsSql, valsSql)
+ select = "select currval('%s_id_seq')" % table
- sql = "%s; %s" % (insert, select)
+ sql = "%s; %s" % (insert, select)
- return sql
+ return sql
class SqlUpdate(SqlOperation):
- def __init__(self, cls, attrs):
- super(SqlUpdate, self).__init__("update")
+ def __init__(self, cls, attrs):
+ super(SqlUpdate, self).__init__("update")
- self.cls = cls
- self.attrs = attrs
+ self.cls = cls
+ self.attrs = attrs
- def generate(self):
- table = self.cls.sqlmeta.table
+ def generate(self):
+ table = self.cls.sqlmeta.table
- elems = list()
+ elems = list()
- for name in self.attrs:
- elems.append("%s = %%(%s)s" % (transformColumn(name), name))
-
- elemsSql = ", ".join(elems)
+ for name in self.attrs:
+ elems.append("%s = %%(%s)s" % (transform_column(name), name))
+
+ elemsSql = ", ".join(elems)
- sql = "update %s set %s where id = %%(id)s" % (table, elemsSql)
+ sql = "update %s set %s where id = %%(id)s" % (table, elemsSql)
- return sql
+ return sql
class SqlExpire(SqlOperation):
- def __init__(self, cls, keepCurrStats):
- super(SqlExpire, self).__init__("expire")
+ def __init__(self, cls, keep_curr_stats):
+ super(SqlExpire, self).__init__("expire")
- self.cls = cls
- self.keepCurrStats = keepCurrStats
+ self.cls = cls
+ self.keep_curr_stats = keep_curr_stats
- def generate(self):
- table = self.cls.sqlmeta.table
+ def generate(self):
+ table = self.cls.sqlmeta.table
- if table.endswith("_stats"):
- parent_table = table[0:table.find("_stats")]
- sql = """
- delete from %s
- where qmf_update_time < now() - interval '%%(threshold)s seconds'
- """ % (table)
- if self.keepCurrStats:
- sql += " and id not in (select stats_curr_id from %s)" % (parent_table)
- else:
- sql = """
- delete from %s
- where qmf_delete_time < now() - interval '%%(threshold)s seconds'
- and qmf_persistent = 'f'
- """ % (table)
+ if table.endswith("_stats"):
+ parent_table = table[0:table.find("_stats")]
+ sql = """
+ delete from %s
+ where qmf_update_time < now() - interval '%%(threshold)s seconds'
+ """ % table
+ if self.keep_curr_stats:
+ sql += " and id not in (select stats_curr_id from %s)" \
+ % parent_table
+ else:
+ sql = """
+ delete from %s
+ where qmf_delete_time < now() - interval '%%(threshold)s seconds'
+ and qmf_persistent = 'f'
+ """ % table
- return sql
+ return sql
class SqlProfile(object):
- def __init__(self):
- self.ops = list()
- self.commitTime = 0.0
+ def __init__(self):
+ self.ops = list()
+ self.commit_time = 0.0
- def report(self):
- timesByKey = dict()
+ def report(self):
+ times_by_key = dict()
- executeTime = 0.0
+ execute_time = 0.0
- for op in self.ops:
- if op.time is not None:
- executeTime += op.time
+ for op in self.ops:
+ if op.time is not None:
+ execute_time += op.time
- try:
- times = timesByKey[op.key()]
+ try:
+ times = times_by_key[op.key()]
- if op.time is not None:
- times.append(op.time)
- except KeyError:
- if op.time is not None:
- timesByKey[op.key()] = list((op.time,))
+ if op.time is not None:
+ times.append(op.time)
+ except KeyError:
+ if op.time is not None:
+ times_by_key[op.key()] = list((op.time,))
- fmt = "%-40s %9.2f %9.2f %6i"
- records = list()
+ fmt = "%-40s %9.2f %9.2f %6i"
+ records = list()
- for key, values in timesByKey.items():
- count = len(values)
- ttime = sum(values) * 1000
- atime = ttime / float(count)
+ for key, values in times_by_key.items():
+ count = len(values)
+ ttime = sum(values) * 1000
+ atime = ttime / float(count)
- records.append((key, ttime, atime, count))
+ records.append((key, ttime, atime, count))
- print
+ print
- srecords = sorted(records, key=lambda x: x[1], reverse=True)
+ srecords = sorted(records, key=lambda x: x[1], reverse=True)
- for i, rec in enumerate(srecords):
- print fmt % rec
+ for i, rec in enumerate(srecords):
+ print fmt % rec
- if i >= 10:
- break
+ if i >= 10:
+ break
- print
+ print
- srecords = sorted(records, key=lambda x: x[2], reverse=True)
+ srecords = sorted(records, key=lambda x: x[2], reverse=True)
- for i, rec in enumerate(srecords):
- print fmt % rec
+ for i, rec in enumerate(srecords):
+ print fmt % rec
- if i >= 10:
- break
+ if i >= 10:
+ break
- print
- print "Total statement execute time: %9.3f seconds" % executeTime
- print "Total commit time: %9.3f seconds" % self.commitTime
+ print
+ print "Total statement execute time: %9.3f seconds" % execute_time
+ print "Total commit time: %9.3f seconds" % self.commit_time
class SqlAgentDisconnect(SqlOperation):
- def __init__(self, agent):
- super(SqlAgentDisconnect, self).__init__("disconnect_agent")
- self.agent = agent
+ def __init__(self, agent):
+ super(SqlAgentDisconnect, self).__init__("disconnect_agent")
+ self.agent = agent
- def generate(self):
- sql = ""
- for cls in mint.schema.entityClasses:
- sql += """
- update %s
- set qmf_delete_time = now()
- where qmf_persistent = 'f'
- and qmf_delete_time is null""" % (dbStyle.pythonClassToDBTable(cls))
- if self.agent:
- sql += """
- and qmf_agent_id = %(qmf_agent_id)s;
- """
- else:
- sql += """;
- """
- return sql
+ def generate(self):
+ sql = ""
+ for cls in mint.schema.entityClasses:
+ sql += """
+ update %s
+ set qmf_delete_time = now()
+ where qmf_persistent = 'f'
+ and qmf_delete_time is null""" % (dbStyle.pythonClassToDBTable(cls))
+ if self.agent:
+ sql += """
+ and qmf_agent_id = %(qmf_agent_id)s;
+ """
+ else:
+ sql += """;
+ """
+ return sql
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/tools.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -155,8 +155,8 @@
enable_logging("mint", "debug", sys.stderr)
app = Mint(self.config)
- app.updateEnabled = False
- app.expireEnabled = False
+ app.update_enabled = False
+ app.expire_enabled = False
self.database = MintDatabase(app)
self.database.check()
@@ -195,13 +195,13 @@
class LoadSchema(Command):
def run(self, opts, args):
- self.parent.database.loadSchema()
+ self.parent.database.load_schema()
print "The schema is loaded"
class DropSchema(Command):
def run(self, opts, args):
if "force" in opts:
- self.parent.database.dropSchema()
+ self.parent.database.drop_schema()
print "The schema is dropped"
else:
raise CommandException \
@@ -210,8 +210,8 @@
class ReloadSchema(Command):
def run(self, opts, args):
if "force" in opts:
- self.parent.database.dropSchema()
- self.parent.database.loadSchema()
+ self.parent.database.drop_schema()
+ self.parent.database.load_schema()
print "The schema is reloaded"
else:
raise CommandException \
@@ -219,7 +219,7 @@
class CheckSchema(Command):
def run(self, opts, args):
- self.parent.database.checkSchema()
+ self.parent.database.check_schema()
class AddUser(Command):
def run(self, opts, args):
@@ -471,7 +471,7 @@
sleep(1)
- stats = app.updateThread.stats
+ stats = app.update_thread.stats
enq = stats.enqueued
deq = stats.dequeued
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/update.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -24,7 +24,7 @@
self.updates = UpdateQueue(slotCount=2)
def init(self):
- self.conn = self.app.database.getConnection()
+ self.conn = self.app.database.get_connection()
self.stats = UpdateStats()
def enqueue(self, update):
@@ -42,7 +42,7 @@
def run(self):
while True:
- if self.stopRequested:
+ if self.stop_requested:
break
try:
Modified: mgmt/trunk/mint/python/mint/util.py
===================================================================
--- mgmt/trunk/mint/python/mint/util.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/util.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -15,21 +15,21 @@
log = logging.getLogger("mint.util")
class MintDaemonThread(Thread):
- def __init__(self, app):
- super(MintDaemonThread, self).__init__()
+ def __init__(self, app):
+ super(MintDaemonThread, self).__init__()
- self.app = app
+ self.app = app
- self.stopRequested = False
+ self.stop_requested = False
- self.setDaemon(True)
+ self.setDaemon(True)
- def init(self):
- pass
+ def init(self):
+ pass
- def stop(self):
- assert self.stopRequested is False
- self.stopRequested = True
+ def stop(self):
+ assert self.stop_requested is False
+ self.stop_requested = True
def prompt_password():
password = None
@@ -46,72 +46,72 @@
return password
class QmfAgentId(object):
- def __init__(self, brokerId, brokerBank, agentBank):
- assert brokerId
+ def __init__(self, brokerId, brokerBank, agentBank):
+ assert brokerId
- self.brokerId = brokerId
- self.brokerBank = brokerBank
- self.agentBank = agentBank
+ self.brokerId = brokerId
+ self.brokerBank = brokerBank
+ self.agentBank = agentBank
- def fromObject(cls, object):
- broker = object.getBroker()
+ def fromObject(cls, object):
+ broker = object.getBroker()
- brokerId = broker.getBrokerId()
- brokerBank = broker.getBrokerBank()
- agentBank = object.getObjectId().getAgentBank()
+ brokerId = broker.getBrokerId()
+ brokerBank = broker.getBrokerBank()
+ agentBank = object.getObjectId().getAgentBank()
- return cls(brokerId, brokerBank, agentBank)
+ return cls(brokerId, brokerBank, agentBank)
- def fromAgent(cls, agent):
- broker = agent.getBroker()
+ def fromAgent(cls, agent):
+ broker = agent.getBroker()
- brokerId = broker.getBrokerId()
- brokerBank = broker.getBrokerBank()
- agentBank = agent.getAgentBank()
+ brokerId = broker.getBrokerId()
+ brokerBank = broker.getBrokerBank()
+ agentBank = agent.getAgentBank()
- return cls(brokerId, brokerBank, agentBank)
+ return cls(brokerId, brokerBank, agentBank)
- def fromString(cls, string):
- brokerId, brokerBank, agentBank = string.split(".")
+ def fromString(cls, string):
+ brokerId, brokerBank, agentBank = string.split(".")
- brokerBank = int(brokerBank)
- agentBank = int(agentBank)
+ brokerBank = int(brokerBank)
+ agentBank = int(agentBank)
- return cls(brokerId, brokerBank, agentBank)
+ return cls(brokerId, brokerBank, agentBank)
- fromObject = classmethod(fromObject)
- fromAgent = classmethod(fromAgent)
- fromString = classmethod(fromString)
+ fromObject = classmethod(fromObject)
+ fromAgent = classmethod(fromAgent)
+ fromString = classmethod(fromString)
- def __str__(self):
- return "%s.%i.%i" % (self.brokerId, self.brokerBank, self.agentBank)
+ def __str__(self):
+ return "%s.%i.%i" % (self.brokerId, self.brokerBank, self.agentBank)
class QmfObjectId(object):
- def __init__(self, first, second):
- self.first = first
- self.second = second
+ def __init__(self, first, second):
+ self.first = first
+ self.second = second
- def fromObject(cls, object):
- oid = object.getObjectId()
+ def fromObject(cls, object):
+ oid = object.getObjectId()
- return cls(oid.first, oid.second)
+ return cls(oid.first, oid.second)
- def fromString(cls, string):
- first, second = string.split(".")
+ def fromString(cls, string):
+ first, second = string.split(".")
- first = int(first)
- second = int(second)
+ first = int(first)
+ second = int(second)
- return cls(first, second)
+ return cls(first, second)
- fromObject = classmethod(fromObject)
- fromString = classmethod(fromString)
+ fromObject = classmethod(fromObject)
+ fromString = classmethod(fromString)
- def toObjectId(self):
- return ObjectId(None, self.first, self.second)
+ def toObjectId(self):
+ return ObjectId(None, self.first, self.second)
- def __str__(self):
- return "%i.%i" % (self.first, self.second)
+ def __str__(self):
+ return "%i.%i" % (self.first, self.second)
password_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Modified: mgmt/trunk/mint/python/mint/vacuum.py
===================================================================
--- mgmt/trunk/mint/python/mint/vacuum.py 2010-01-12 11:36:02 UTC (rev 3789)
+++ mgmt/trunk/mint/python/mint/vacuum.py 2010-01-12 21:47:25 UTC (rev 3790)
@@ -6,11 +6,11 @@
class VacuumThread(MintDaemonThread):
def run(self):
while True:
- if self.stopRequested:
+ if self.stop_requested:
break
up = VacuumUpdate()
- self.app.updateThread.enqueue(up)
+ self.app.update_thread.enqueue(up)
sleep(60 * 10)
14 years, 11 months
rhmessaging commits: r3789 - store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb.
by rhmessaging-commits@lists.jboss.org
Author: rgemmell
Date: 2010-01-12 06:36:02 -0500 (Tue, 12 Jan 2010)
New Revision: 3789
Modified:
store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java
Log:
Updated error handling to cease the process at first issue and ensure clear appearance of success/failure
Modified: store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java
===================================================================
--- store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java 2010-01-11 22:17:57 UTC (rev 3788)
+++ store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java 2010-01-12 11:36:02 UTC (rev 3789)
@@ -59,7 +59,17 @@
{
BDBStoreBindingsWorkaround tool = new BDBStoreBindingsWorkaround(args);
- tool.start();
+ try
+ {
+ tool.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ _logger.error("Error during workaround process");
+ //Shut down the JVM, the ShutdownHook will stop the VirtualHosts if initialised.
+ System.exit(1);
+ }
//Shut down the JVM gracefully, the ShutdownHook will stop the VirtualHosts.
System.exit(0);
@@ -116,24 +126,19 @@
}
}
- protected void start()
+ protected void start() throws Exception
{
_initialised = false;
_logger.info("BDBStore BindingsWorkaround process commencing");
loadVirtualHosts();
-
- if (!_initialised)
- {
- System.exit(1);
- }
addDurableExchangesToStoreIfRequired();
_logger.info("Workaround process complete");
}
- private void loadVirtualHosts()
+ private void loadVirtualHosts() throws Exception
{
final File configFile = _config.getConfigFile();
@@ -141,7 +146,7 @@
{
_logger.error("Config file not found:" + configFile.getAbsolutePath());
_logger.error("Options: [-c <broker config file>] : Defaults to \"$QPID_HOME/etc/config.xml\"");
- return;
+ System.exit(1);
}
else
{
@@ -165,14 +170,12 @@
catch (ConfigurationException e)
{
_logger.error("Unable to load configuration due to configuration error: " + e.getMessage());
- e.printStackTrace();
- System.exit(1);
+ throw e;
}
catch (Exception e)
{
- _logger.error("Unable to load configuration due to: " + e.getMessage());
- e.printStackTrace();
- System.exit(1);
+ _logger.error("Unable to load VirtualHosts due to: " + e.getMessage());
+ throw e;
}
}
@@ -214,7 +217,7 @@
}
}
- private static List<AMQShortString> getBDBStoreExchangeNames(final VirtualHost vhost, final BDBMessageStore store)
+ private static List<AMQShortString> getBDBStoreExchangeNames(final VirtualHost vhost, final BDBMessageStore store) throws AMQException, DatabaseException
{
final List<AMQShortString> exchanges = new ArrayList<AMQShortString>();
@@ -245,16 +248,21 @@
{
store.visitExchanges(exchangeVisitor);
}
- catch (Exception e)
+ catch (AMQException e)
{
_logger.error("Error retrieving exiting Exchange names from the store: " + e.getMessage());
- e.printStackTrace();
+ throw e;
}
+ catch (DatabaseException e)
+ {
+ _logger.error("Error retrieving exiting Exchange names from the store: " + e.getMessage());
+ throw e;
+ }
return exchanges;
}
- private static void addDurableExchangesToStoreIfRequired()
+ private static void addDurableExchangesToStoreIfRequired() throws AMQException, DatabaseException
{
Collection<VirtualHost> vhosts = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts();
@@ -299,7 +307,7 @@
catch (AMQException e)
{
_logger.error("Error adding entry to store for Exchange '" + exchangeName + "':" + e.getMessage());
- e.printStackTrace();
+ throw e;
}
}
}
14 years, 11 months
rhmessaging commits: r3788 - mgmt/trunk/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-01-11 17:17:57 -0500 (Mon, 11 Jan 2010)
New Revision: 3788
Modified:
mgmt/trunk/mint/bin/mint-database
Log:
Clean up messages
Modified: mgmt/trunk/mint/bin/mint-database
===================================================================
--- mgmt/trunk/mint/bin/mint-database 2010-01-11 22:00:14 UTC (rev 3787)
+++ mgmt/trunk/mint/bin/mint-database 2010-01-11 22:17:57 UTC (rev 3788)
@@ -128,11 +128,11 @@
# Does it have a schema loaded?
run "psql -d cumin -U cumin -h localhost -c '\q'" postgres || {
- echo "The database is not accessible"
+ echo "The database is not accessible."
exit 1
}
- echo "The database is ready"
+ echo "The database is ready."
;;
configure)
check-environment
@@ -145,8 +145,8 @@
i_stopped_postgres=""
if run "/sbin/service postgresql status"; then
- echo "The database server is running. To proceed with configuration, I need to stop it"
- echo "(I'll start it again after I'm done)."
+ echo "The database server is running. To proceed with configuration,"
+ echo "I need to stop it (I'll start it again after I'm done)."
if confirmed; then
run "/sbin/service postgresql stop"
@@ -155,7 +155,8 @@
fi
test -d "$pgdata" || {
- echo "The database server is not initialized. To proceed, I need to initialize it."
+ echo "The database server is not initialized. To proceed, I need to"
+ echo "initialize it."
if confirmed; then
initdb
@@ -168,7 +169,8 @@
run "/sbin/service postgresql start"
fi
- echo "The database server is configured. You can now run 'mint-database create'."
+ echo "The database server is configured. Make sure postgresql is running"
+ echo "and run 'mint-database create'."
# chkconfig stuff ?
;;
@@ -188,7 +190,7 @@
run "dropdb ${dbname}" postgres
run "dropuser ${dbname}" postgres
- echo "The database is destroyed"
+ echo "The database is destroyed."
;;
*)
echo "Configure and check the mint database"
14 years, 11 months
rhmessaging commits: r3787 - mgmt/trunk/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-01-11 17:00:14 -0500 (Mon, 11 Jan 2010)
New Revision: 3787
Modified:
mgmt/trunk/mint/bin/mint-database
Log:
Use the defines
Modified: mgmt/trunk/mint/bin/mint-database
===================================================================
--- mgmt/trunk/mint/bin/mint-database 2010-01-11 21:57:14 UTC (rev 3786)
+++ mgmt/trunk/mint/bin/mint-database 2010-01-11 22:00:14 UTC (rev 3787)
@@ -20,7 +20,7 @@
# Is it initialized?
# Is it running?
- test -d /var/lib/pgsql/data || {
+ test -d "$pgdata" || {
echo "The database is not initialized. Run 'mint-database configure'."
exit 1
}
@@ -74,7 +74,7 @@
record_pattern = re.compile('^\w*(local|host|hostssl|hostnossl)')
database_name = "cumin"
-path = "/var/lib/pgsql/data/pg_hba.conf"
+path = "$pghbaconf"
file = open(path, "r")
lines = list()
@@ -154,7 +154,7 @@
fi
fi
- test -d /var/lib/pgsql/data || {
+ test -d "$pgdata" || {
echo "The database server is not initialized. To proceed, I need to initialize it."
if confirmed; then
14 years, 11 months
rhmessaging commits: r3786 - mgmt/trunk/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-01-11 16:57:14 -0500 (Mon, 11 Jan 2010)
New Revision: 3786
Modified:
mgmt/trunk/mint/bin/mint-database
Log:
Can't use local outside of a function
Modified: mgmt/trunk/mint/bin/mint-database
===================================================================
--- mgmt/trunk/mint/bin/mint-database 2010-01-11 21:04:28 UTC (rev 3785)
+++ mgmt/trunk/mint/bin/mint-database 2010-01-11 21:57:14 UTC (rev 3786)
@@ -142,7 +142,7 @@
exit 1
fi
- local i_stopped_postgres=""
+ i_stopped_postgres=""
if run "/sbin/service postgresql status"; then
echo "The database server is running. To proceed with configuration, I need to stop it"
14 years, 11 months
rhmessaging commits: r3785 - in mgmt/trunk: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-01-11 16:04:28 -0500 (Mon, 11 Jan 2010)
New Revision: 3785
Modified:
mgmt/trunk/cumin/python/cumin/messaging/broker.py
mgmt/trunk/mint/python/mint/model.py
mgmt/trunk/mint/python/mint/update.py
Log:
More pythonic naming
Modified: mgmt/trunk/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/broker.py 2010-01-11 20:39:58 UTC (rev 3784)
+++ mgmt/trunk/cumin/python/cumin/messaging/broker.py 2010-01-11 21:04:28 UTC (rev 3785)
@@ -87,10 +87,10 @@
agent = self.app.model.mint.model.agents.get(data["qmf_agent_id"])
if agent:
- if agent.lastHeartbeat is None:
+ if agent.last_heartbeat is None:
return fmt_none()
else:
- return fmt_datetime(agent.lastHeartbeat)
+ return fmt_datetime(agent.last_heartbeat)
class ClusterColumn(SqlTableColumn):
def render_title(self, session, data):
Modified: mgmt/trunk/mint/python/mint/model.py
===================================================================
--- mgmt/trunk/mint/python/mint/model.py 2010-01-11 20:39:58 UTC (rev 3784)
+++ mgmt/trunk/mint/python/mint/model.py 2010-01-11 21:04:28 UTC (rev 3785)
@@ -23,15 +23,15 @@
self.app = app
+ self.qmf_session = None
+ self.qmf_brokers = list()
+
# qmfAgentId => MintAgent
self.agents = dict()
# int seq => callable
self.outstanding_method_calls = dict()
- self.qmf_session = None
- self.qmf_brokers = list()
-
self.lock = RLock()
def check(self):
@@ -71,10 +71,6 @@
finally:
self.lock.release()
- def getMintAgent(self, qagent):
- id = str(QmfAgentId.fromAgent(qagent))
- return self.agents[id]
-
class MintAgent(object):
def __init__(self, model, agent):
self.model = model
@@ -82,13 +78,13 @@
self.id = str(QmfAgentId.fromAgent(agent))
- self.lastHeartbeat = None
+ self.last_heartbeat = None
# qmfObjectId => int database id
- self.databaseIds = MintCache()
+ self.database_ids = MintCache()
# qmfObjectId => list of ModelUpdate objects
- self.deferredUpdates = defaultdict(list)
+ self.deferred_updates = defaultdict(list)
self.model.lock.acquire()
try:
@@ -173,7 +169,9 @@
def delAgent(self, qagent):
log.info("Deleting %s", qagent)
- agent = self.model.getMintAgent(qagent)
+ id = str(QmfAgent.fromAgent(qagent))
+
+ agent = self.model.agents[id]
agent.delete()
up = AgentDisconnectUpdate(agent)
@@ -182,9 +180,11 @@
def heartbeat(self, qagent, timestamp):
timestamp = timestamp / 1000000000
- agent = self.model.getMintAgent(qagent)
- agent.lastHeartbeat = datetime.fromtimestamp(timestamp)
+ id = str(QmfAgentId.fromAgent(qagent))
+ agent = self.model.agents[id]
+ agent.last_heartbeat = datetime.fromtimestamp(timestamp)
+
def newPackage(self, name):
log.info("New package %s", name)
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2010-01-11 20:39:58 UTC (rev 3784)
+++ mgmt/trunk/mint/python/mint/update.py 2010-01-11 21:04:28 UTC (rev 3785)
@@ -166,7 +166,7 @@
foreignKey = name + "_id"
object_id = str(QmfObjectId(oid.first, oid.second))
- id = self.agent.databaseIds.get(object_id)
+ id = self.agent.database_ids.get(object_id)
if id is None:
# XXX don't want oid around much
@@ -204,7 +204,7 @@
except ReferenceException, e:
log.info("Referenced object %r not found", e.sought)
- self.agent.deferredUpdates[self.object_id].append(self)
+ self.agent.deferred_updates[self.object_id].append(self)
stats.deferred += 1
@@ -234,7 +234,7 @@
# 2. Object is in mint's db, but id is not yet cached
# 3. Object is in mint's db, and id is cached
- id = self.agent.databaseIds.get(self.object_id)
+ id = self.agent.database_ids.get(self.object_id)
if id is None:
# Case 1 or 2
@@ -266,7 +266,7 @@
assert cursor.rowcount == 1
- self.agent.databaseIds.set(self.object_id, id)
+ self.agent.database_ids.set(self.object_id, id)
else:
# Case 3
@@ -278,7 +278,7 @@
#assert cursor.rowcount == 1
try:
- updates = self.agent.deferredUpdates.pop(self.object_id)
+ updates = self.agent.deferred_updates.pop(self.object_id)
if updates:
log.info("Reenqueueing %i deferred updates", len(updates))
@@ -288,7 +288,7 @@
except KeyError:
pass
- self.agent.databaseIds.commit()
+ self.agent.database_ids.commit()
stats.prop_updated += 1
@@ -302,7 +302,7 @@
statsCls = getattr(mint, "%sStats" % cls.__name__)
- id = self.agent.databaseIds.get(self.object_id)
+ id = self.agent.database_ids.get(self.object_id)
if id is None:
stats.dropped += 1
14 years, 11 months