rhmessaging commits: r3577 - mgmt/trunk/etc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-13 15:43:18 -0400 (Thu, 13 Aug 2009)
New Revision: 3577
Modified:
mgmt/trunk/etc/Makefile.common
Log:
Remove unnecessary conditions from directory vars
Modified: mgmt/trunk/etc/Makefile.common
===================================================================
--- mgmt/trunk/etc/Makefile.common 2009-08-13 19:09:45 UTC (rev 3576)
+++ mgmt/trunk/etc/Makefile.common 2009-08-13 19:43:18 UTC (rev 3577)
@@ -1,27 +1,10 @@
-ifndef PREFIX
- PREFIX := /usr/local
-endif
+PREFIX := /usr/local
+PYTHON_LIB_DIR := ${PREFIX}/lib/python
+BIN_DIR := ${PREFIX}/bin
+ETC_DIR := ${PREFIX}/etc
+DOC_DIR := ${PREFIX}/share/doc
+SHARE_DIR := ${PREFIX}/share
-ifndef PYTHON_LIB_DIR
- PYTHON_LIB_DIR := ${PREFIX}/lib/python
-endif
-
-ifndef BIN_DIR
- BIN_DIR := ${PREFIX}/bin
-endif
-
-ifndef ETC_DIR
- ETC_DIR := ${PREFIX}/etc
-endif
-
-ifndef DOC_DIR
- DOC_DIR := ${PREFIX}/share/doc
-endif
-
-ifndef SHARE_DIR
- SHARE_DIR := ${PREFIX}/share
-endif
-
ifndef VAR_DIR
ifeq (${PREFIX}, /usr/local)
VAR_DIR := /var/local
15 years, 4 months
rhmessaging commits: r3576 - mgmt/trunk/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-13 15:09:45 -0400 (Thu, 13 Aug 2009)
New Revision: 3576
Modified:
mgmt/trunk/cumin/python/cumin/messaging/model.py
Log:
Default the count to 0 (meaning purge all) so that the aggregate purge operation works
Modified: mgmt/trunk/cumin/python/cumin/messaging/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/model.py 2009-08-13 16:17:31 UTC (rev 3575)
+++ mgmt/trunk/cumin/python/cumin/messaging/model.py 2009-08-13 19:09:45 UTC (rev 3576)
@@ -144,7 +144,7 @@
def do_enter(self, session, queue):
self.form.queue.set(session, queue)
- def do_invoke(self, completion, session, queue, count):
+ def do_invoke(self, completion, session, queue, count=0):
"""A count of 0 purges all"""
assert isinstance(queue, Queue)
15 years, 4 months
rhmessaging commits: r3575 - mgmt/trunk/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-13 12:17:31 -0400 (Thu, 13 Aug 2009)
New Revision: 3575
Modified:
mgmt/trunk/wooly/python/wooly/pages.strings
Log:
Removed unneeded template
Modified: mgmt/trunk/wooly/python/wooly/pages.strings
===================================================================
--- mgmt/trunk/wooly/python/wooly/pages.strings 2009-08-13 13:11:24 UTC (rev 3574)
+++ mgmt/trunk/wooly/python/wooly/pages.strings 2009-08-13 16:17:31 UTC (rev 3575)
@@ -35,13 +35,6 @@
// ]]>
</script>
-[UpdateScript.html]
-<script type="text/javascript">
- // <![CDATA[
- wooly.setIntervalUpdate('{url}', wooly.updatePage, {interval});
- // ]]>
-</script>
-
[UpdatePage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE widgets [
15 years, 4 months
rhmessaging commits: r3574 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-13 09:11:24 -0400 (Thu, 13 Aug 2009)
New Revision: 3574
Modified:
mgmt/trunk/cumin/python/cumin/grid/negotiator.py
Log:
Use ItemTable instead of CuminItemTable to prevent the get_item_count from getting called during do_process. This avoids making qmf calls every three seconds during the update.
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-08-12 19:58:32 UTC (rev 3573)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-08-13 13:11:24 UTC (rev 3574)
@@ -107,17 +107,18 @@
def render_content(self, session, group):
if group == self.parent.buttons_row:
return self.button.render(session)
+ elif group == self.parent.empty_row:
+ return ""
data = self.getter(session)
for x in data:
if x[0] == group:
return self.render_data(x)
-class NegotiatorOverviewTab(CuminItemTable):
+class NegotiatorOverviewTab(ItemTable):
def __init__(self, app, name, negotiator):
super(NegotiatorOverviewTab, self).__init__(app, name)
- self.update_enabled = False
self.defer_enabled = True
self.group_helper = GroupHelper(app, "groups", negotiator)
15 years, 4 months
rhmessaging commits: r3573 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-12 15:58:32 -0400 (Wed, 12 Aug 2009)
New Revision: 3573
Modified:
mgmt/trunk/mint/python/mint/model.py
Log:
Enlarge the scope of the locking in callMethod, to avoid handling method responses for calls that are not yet registered
Modified: mgmt/trunk/mint/python/mint/model.py
===================================================================
--- mgmt/trunk/mint/python/mint/model.py 2009-08-12 19:10:39 UTC (rev 3572)
+++ mgmt/trunk/mint/python/mint/model.py 2009-08-12 19:58:32 UTC (rev 3573)
@@ -224,20 +224,17 @@
self.lock()
try:
broker = self.mintBrokersById[brokerId]
- finally:
- self.unlock()
- seq = self.qmfSession._sendMethodRequest \
- (broker.qmfBroker, ClassKey(classKey), objId, methodName, args)
+ seq = self.qmfSession._sendMethodRequest \
+ (broker.qmfBroker, ClassKey(classKey), objId, methodName, args)
- if seq is not None:
- self.lock()
- try:
+ if seq is not None:
self.outstandingMethodCalls[seq] = callback
- finally:
- self.unlock()
- return seq
+ return seq
+ finally:
+ self.unlock()
+
def addBroker(self, url):
log.info("Adding qmf broker at %s", url)
15 years, 4 months
rhmessaging commits: r3572 - in mgmt/trunk/mint: xml and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-12 15:10:39 -0400 (Wed, 12 Aug 2009)
New Revision: 3572
Modified:
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/schemaparser.py
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
mgmt/trunk/mint/xml/Makefile
Log:
Note that this change requires reloading your schema
* Fix the URL for fetching the condor schema
* An experimental fix to convert unsigned 64-bit scope and object ids
to signed types instead; postgres can't consume the former
Submissions were failing to show up due to this
* Don't use the queue to process method updates; instead process them
immediately
* Remove the method update accounting that had existed for mint-bench
* Update to the latest schema
* Add a method to fetch the (host, port) for a given vhost
Modified: mgmt/trunk/mint/python/mint/main.py
===================================================================
--- mgmt/trunk/mint/python/mint/main.py 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/main.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -117,3 +117,9 @@
if self.debug:
enable_logging("mint", "debug", sys.stderr)
+
+def get_addr_for_vhost(vhost):
+ 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 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/model.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -380,15 +380,16 @@
return self.heartbeatsByAgentId.get(key)
def methodResponse(self, broker, seq, response):
- # XXX don't do this via the update thread?
+ log.debug("Method response for request %i received from %s", seq, broker)
+ log.debug("Response: %s", response)
- if not self.app.updateThread.isAlive():
- return
+ self.lock()
- mbroker = self.getMintBrokerByQmfBroker(broker)
- up = update.MethodUpdate(self, mbroker, seq, response)
+ try:
+ methodCallback = self.outstandingMethodCalls.pop(seq)
+ methodCallback(response.text, response.outArgs)
+ finally:
+ self.unlock()
- self.app.updateThread.enqueue(up)
-
def getAgentDBId(self, agent, brokerId):
return "%s.%d.%d" % (brokerId, agent.getBrokerBank(), agent.getAgentBank())
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/schema.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -184,7 +184,7 @@
actualArgs = list()
if JobAd is not None:
actualArgs.append(JobAd)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetAd",
callback, args=actualArgs)
@@ -194,7 +194,7 @@
actualArgs.append(Name)
if Value is not None:
actualArgs.append(Value)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetAttribute",
callback, args=actualArgs)
@@ -202,7 +202,7 @@
actualArgs = list()
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Hold",
callback, args=actualArgs)
@@ -210,7 +210,7 @@
actualArgs = list()
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Release",
callback, args=actualArgs)
@@ -218,7 +218,7 @@
actualArgs = list()
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Remove",
callback, args=actualArgs)
@@ -232,7 +232,7 @@
actualArgs.append(End)
if Data is not None:
actualArgs.append(Data)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Fetch",
callback, args=actualArgs)
@@ -284,7 +284,7 @@
actualArgs.append(Ad)
if Id is not None:
actualArgs.append(Id)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Submit",
callback, args=actualArgs)
@@ -294,7 +294,7 @@
actualArgs.append(Id)
if JobAd is not None:
actualArgs.append(JobAd)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetAd",
callback, args=actualArgs)
@@ -306,7 +306,7 @@
actualArgs.append(Name)
if Value is not None:
actualArgs.append(Value)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetAttribute",
callback, args=actualArgs)
@@ -316,7 +316,7 @@
actualArgs.append(Id)
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Hold",
callback, args=actualArgs)
@@ -326,7 +326,7 @@
actualArgs.append(Id)
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Release",
callback, args=actualArgs)
@@ -336,7 +336,7 @@
actualArgs.append(Id)
if Reason is not None:
actualArgs.append(Reason)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Remove",
callback, args=actualArgs)
@@ -352,10 +352,42 @@
actualArgs.append(End)
if Data is not None:
actualArgs.append(Data)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Fetch",
callback, args=actualArgs)
+ def GetStates(self, model, callback, Submission, State, Count):
+ actualArgs = list()
+ if Submission is not None:
+ actualArgs.append(Submission)
+ if State is not None:
+ actualArgs.append(State)
+ if Count is not None:
+ actualArgs.append(Count)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetStates",
+ callback, args=actualArgs)
+
+ def GetJobs(self, model, callback, Submission, Jobs):
+ actualArgs = list()
+ if Submission is not None:
+ actualArgs.append(Submission)
+ if Jobs is not None:
+ actualArgs.append(Jobs)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetJobs",
+ callback, args=actualArgs)
+
+ def echo(self, model, callback, sequence, body):
+ actualArgs = list()
+ if sequence is not None:
+ actualArgs.append(sequence)
+ if body is not None:
+ actualArgs.append(body)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "echo",
+ callback, args=actualArgs)
+
class SchedulerStats(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -450,7 +482,7 @@
actualArgs = list()
if Limits is not None:
actualArgs.append(Limits)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetLimits",
callback, args=actualArgs)
@@ -460,7 +492,7 @@
actualArgs.append(Name)
if Max is not None:
actualArgs.append(Max)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetLimit",
callback, args=actualArgs)
@@ -470,7 +502,7 @@
actualArgs.append(Name)
if Ad is not None:
actualArgs.append(Ad)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetStats",
callback, args=actualArgs)
@@ -480,7 +512,7 @@
actualArgs.append(Name)
if Priority is not None:
actualArgs.append(Priority)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetPriority",
callback, args=actualArgs)
@@ -490,7 +522,7 @@
actualArgs.append(Name)
if PriorityFactor is not None:
actualArgs.append(PriorityFactor)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetPriorityFactor",
callback, args=actualArgs)
@@ -500,7 +532,7 @@
actualArgs.append(Name)
if Usage is not None:
actualArgs.append(Usage)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetUsage",
callback, args=actualArgs)
@@ -510,7 +542,7 @@
actualArgs.append(Name)
if Value is not None:
actualArgs.append(Value)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetRawConfig",
callback, args=actualArgs)
@@ -520,13 +552,13 @@
actualArgs.append(Name)
if Value is not None:
actualArgs.append(Value)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetRawConfig",
callback, args=actualArgs)
def Reconfig(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Reconfig",
callback, args=actualArgs)
@@ -624,7 +656,7 @@
actualArgs = list()
if Subsystem is not None:
actualArgs.append(Subsystem)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Start",
callback, args=actualArgs)
@@ -632,7 +664,7 @@
actualArgs = list()
if Subsystem is not None:
actualArgs.append(Subsystem)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Stop",
callback, args=actualArgs)
@@ -763,7 +795,7 @@
def reloadACLFile(self, model, callback):
"""Reload the ACL file"""
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "reloadACLFile",
callback, args=actualArgs)
@@ -811,13 +843,13 @@
actualArgs = list()
if brokerId is not None:
actualArgs.append(brokerId)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "stopClusterNode",
callback, args=actualArgs)
def stopFullCluster(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "stopFullCluster",
callback, args=actualArgs)
@@ -919,7 +951,7 @@
actualArgs = list()
if by is not None:
actualArgs.append(by)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "expand",
callback, args=actualArgs)
@@ -1034,7 +1066,7 @@
actualArgs.append(sequence)
if body is not None:
actualArgs.append(body)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "echo",
callback, args=actualArgs)
@@ -1055,7 +1087,7 @@
actualArgs.append(password)
if transport is not None:
actualArgs.append(transport)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "connect",
callback, args=actualArgs)
@@ -1068,7 +1100,7 @@
actualArgs.append(destQueue)
if qty is not None:
actualArgs.append(qty)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "queueMoveMessages",
callback, args=actualArgs)
@@ -1183,7 +1215,7 @@
actualArgs = list()
if request is not None:
actualArgs.append(request)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "purge",
callback, args=actualArgs)
@@ -1338,7 +1370,7 @@
def close(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "close",
callback, args=actualArgs)
@@ -1384,7 +1416,7 @@
def close(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "close",
callback, args=actualArgs)
@@ -1411,7 +1443,7 @@
actualArgs.append(dynamic)
if sync is not None:
actualArgs.append(sync)
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "bridge",
callback, args=actualArgs)
@@ -1461,7 +1493,7 @@
def close(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "close",
callback, args=actualArgs)
@@ -1505,25 +1537,25 @@
def solicitAck(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "solicitAck",
callback, args=actualArgs)
def detach(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "detach",
callback, args=actualArgs)
def resetLifespan(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "resetLifespan",
callback, args=actualArgs)
def close(self, model, callback):
actualArgs = list()
- originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "close",
callback, args=actualArgs)
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -198,7 +198,7 @@
self.pythonOutput += "\n def %s(self, model, callback%s):\n" % (elem["@name"], formalArgs)
self.pythonOutput += comment
self.pythonOutput += actualArgs
- self.pythonOutput += " originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)\n"
+ self.pythonOutput += " originalId = ObjectId(None, self.qmfScopeId + 9223372036854775808L, self.qmfObjectId + 9223372036854775808L)\n"
self.pythonOutput += " model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, \"%s\",\n" % elem["@name"]
self.pythonOutput += " callback, args=actualArgs)\n"
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/tools.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -144,10 +144,10 @@
app.init()
app.start()
- head = "%6s %6s %6s %6s %6s %6s %6s %6s %6s" % \
+ head = "%6s %6s %6s %6s %6s %6s %6s %6s" % \
("enqs", "deqs", "depth", "drop", "defer",
- "prop", "stat", "meth", "exp")
- row = "%6i %6i %6i %6i %6i %6i %6i %6i %6i"
+ "prop", "stat", "exp")
+ row = "%6i %6i %6i %6i %6i %6i %6i %6i"
try:
for arg in args[1:]:
@@ -185,7 +185,6 @@
prop = ut.propUpdateCount
stat = ut.statUpdateCount
- meth = ut.methUpdateCount
exp = ut.expireUpdateCount
print row % (enq - enq_last,
@@ -195,7 +194,6 @@
dfr - dfr_last,
prop - prop_last,
stat - stat_last,
- meth - meth_last,
exp - exp_last)
enq_last = enq
@@ -205,7 +203,6 @@
prop_last = prop
stat_last = stat
- meth_last = meth
exp_last = exp
finally:
print "Totals:"
@@ -217,7 +214,6 @@
dfr,
prop,
stat,
- meth,
exp)
finally:
#from threading import enumerate
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/python/mint/update.py 2009-08-12 19:10:39 UTC (rev 3572)
@@ -31,7 +31,6 @@
self.dequeueCount = 0
self.statUpdateCount = 0
self.propUpdateCount = 0
- self.methUpdateCount = 0
self.expireUpdateCount = 0
self.dropCount = 0
self.deferCount = 0
@@ -237,8 +236,8 @@
log.debug("%s(%s) marked deleted", cls.__name__, oid)
- attrs["qmfScopeId"] = oid.first
- attrs["qmfObjectId"] = oid.second
+ attrs["qmfScopeId"] = oid.first - 9223372036854775808L
+ attrs["qmfObjectId"] = oid.second - 9223372036854775808L
attrs["qmfClassKey"] = str(self.object.getClassKey())
qmfBrokerId = str(self.broker.qmfBroker.getBrokerId())
attrs["qmfBrokerId"] = qmfBrokerId
@@ -379,23 +378,6 @@
thread.statUpdateCount += 1
-class MethodUpdate(ModelUpdate):
- def __init__(self, model, broker, seq, response):
- super(MethodUpdate, self).__init__(model, broker, response)
-
- self.seq = seq
-
- def process(self, thread):
- self.model.lock()
-
- try:
- methodCallback = self.model.outstandingMethodCalls.pop(self.seq)
- methodCallback(self.object.text, self.object.outArgs)
- finally:
- self.model.unlock()
-
- thread.methUpdateCount += 1
-
class ExpireUpdate(ModelUpdate):
def __init__(self, model):
super(ExpireUpdate, self).__init__(model, None, None)
Modified: mgmt/trunk/mint/xml/Makefile
===================================================================
--- mgmt/trunk/mint/xml/Makefile 2009-08-12 18:47:08 UTC (rev 3571)
+++ mgmt/trunk/mint/xml/Makefile 2009-08-12 19:10:39 UTC (rev 3572)
@@ -20,7 +20,7 @@
svn export http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/cluster/mana... qpid-cluster.xml
condor.xml:
- wget "http://git.et.redhat.com/?p=mrg-grid.git;a=blob_plain;f=src/management/co..." -O condor.xml
+ wget "http://git.et.redhat.com/?p=mrg-grid.git;a=blob_plain;f=src/management/co..." -O condor.xml
sesame.xml:
svn export http://anonsvn.jboss.org/repos/rhmessaging/mgmt/trunk/sesame/cpp/src/qmfg... sesame.xml
15 years, 4 months
rhmessaging commits: r3571 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-12 14:47:08 -0400 (Wed, 12 Aug 2009)
New Revision: 3571
Modified:
mgmt/trunk/cumin/python/cumin/grid/main.py
mgmt/trunk/cumin/python/cumin/grid/model.py
mgmt/trunk/cumin/python/cumin/grid/negotiator.py
mgmt/trunk/cumin/python/cumin/grid/negotiator.strings
Log:
Added tasks to negotiator to get/set config variables.
Modified: mgmt/trunk/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/main.py 2009-08-12 18:44:22 UTC (rev 3570)
+++ mgmt/trunk/cumin/python/cumin/grid/main.py 2009-08-12 18:47:08 UTC (rev 3571)
@@ -39,6 +39,11 @@
self.negotiator_stop = NegotiatorStopTask(app, negotiator)
self.negotiator_set_start = NegotiatorSetStartTask(app, negotiator)
self.negotiator_set_stop = NegotiatorSetStopTask(app, negotiator)
+ self.negotiator_edit_dynamic_quota = NegotiatorEditDynamicQuotaTask(app, negotiator)
+ self.negotiator_edit_static_quota = NegotiatorEditStaticQuotaTask(app, negotiator)
+ self.negotiator_edit_prio_factor = NegotiatorEditPrioFactorTask(app, negotiator)
+ self.negotiator_edit_regroup = NegotiatorEditRegroupTask(app, negotiator)
+ self.negotiator_add_group = NegotiatorAddGroupTask(app, negotiator)
self.frame = GridFrame(app, "grid")
app.main_page.main.grid = self.frame
Modified: mgmt/trunk/cumin/python/cumin/grid/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/model.py 2009-08-12 18:44:22 UTC (rev 3570)
+++ mgmt/trunk/cumin/python/cumin/grid/model.py 2009-08-12 18:47:08 UTC (rev 3571)
@@ -331,3 +331,68 @@
self.form = JobSetTaskForm(app, "job_set_remove", self, "Remove")
self.item_task = JobRemoveTask(app, cls)
+
+class NegotiatorGroupTask(QmfTask):
+ def __init__(self, app, cls):
+ super(NegotiatorGroupTask, self).__init__(app, cls)
+
+ self.navigable = False
+
+ def do_enter(self, session, negotiator):
+ self.form.object.set(session, negotiator)
+
+ def do_exit(self, session, negotiator):
+ self.app.main_page.main.grid.pool.negotiator.view.show(session)
+
+ def do_invoke(self, completion, session, negotiator, group, value):
+ assert isinstance(negotiator, Negotiator)
+
+ if group == "Reconfig":
+ negotiator.Reconfig(self.app.model.mint.model, completion)
+ else:
+ negotiator.SetRawConfig(self.app.model.mint.model, completion, group, value)
+
+class NegotiatorAddGroupTask(NegotiatorGroupTask):
+ def __init__(self, app, cls):
+ super(NegotiatorAddGroupTask, self).__init__(app, cls)
+
+ self.form = AddGroupForm(self.app, "negotiator_add_group", self)
+
+ def get_title(self, session):
+ return "Add Group"
+
+class NegotiatorEditRegroupTask(NegotiatorGroupTask):
+ def __init__(self, app, cls):
+ super(NegotiatorEditRegroupTask, self).__init__(app, cls)
+
+ self.form = EditRegroupForm(self.app, "negotiator_edit_regroup", self)
+
+ def get_title(self, session):
+ return "Edit Autoregroup"
+
+class NegotiatorEditPrioFactorTask(NegotiatorGroupTask):
+ def __init__(self, app, cls):
+ super(NegotiatorEditPrioFactorTask, self).__init__(app, cls)
+
+ self.form = EditPrioFactorForm(self.app, "negotiator_edit_prio_factor", self)
+
+ def get_title(self, session):
+ return "Edit Priority Factor"
+
+class NegotiatorEditDynamicQuotaTask(NegotiatorGroupTask):
+ def __init__(self, app, cls):
+ super(NegotiatorEditDynamicQuotaTask, self).__init__(app, cls)
+
+ self.form = EditDynamicQuotaForm(self.app, "negotiator_edit_dynamic_quota", self)
+
+ def get_title(self, session):
+ return "Edit Dynamic Quota"
+
+class NegotiatorEditStaticQuotaTask(NegotiatorGroupTask):
+ def __init__(self, app, cls):
+ super(NegotiatorEditStaticQuotaTask, self).__init__(app, cls)
+
+ self.form = EditStaticQuotaForm(self.app, "negotiator_edit_static_quota", self)
+
+ def get_title(self, session):
+ return "Edit Static Quota"
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-08-12 18:44:22 UTC (rev 3570)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-08-12 18:47:08 UTC (rev 3571)
@@ -1,4 +1,3 @@
-import logging
from wooly import *
from wooly.widgets import *
@@ -77,42 +76,645 @@
self.object = NegotiatorParameter(app, "id")
self.add_parameter(self.object)
- self.view = NegotiatorView(app, "view")
+ self.view = NegotiatorView(app, "view", self.object)
self.add_mode(self.view)
class NegotiatorView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, negotiator):
super(NegotiatorView, self).__init__(app, name)
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- overview = NegotiatorOverview(app, "overview")
+ overview = NegotiatorOverviewTab(app, "overview", negotiator)
self.__tabs.add_tab(overview)
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
-class NegotiatorOverview(Widget):
- def __init__(self, app, name):
- super(NegotiatorOverview, self).__init__(app, name)
+class QmfGroupColumn(ItemTableColumn):
+ def __init__(self, app, name, getter, button):
+ super(QmfGroupColumn, self).__init__(app, name)
- chart = self.PriorityPieChart(app, "chart")
- self.add_child(chart)
+ self.title = None
+ self.getter = getter
+ self.alignment = "right"
+ self.button = button
+ def render_title(self, session, *args):
+ return self.title
+
+ def render_content(self, session, group):
+ if group == self.parent.buttons_row:
+ return self.button.render(session)
+
+ data = self.getter(session)
+ for x in data:
+ if x[0] == group:
+ return self.render_data(x)
+
+class NegotiatorOverviewTab(CuminItemTable):
+ def __init__(self, app, name, negotiator):
+ super(NegotiatorOverviewTab, self).__init__(app, name)
+
+ self.update_enabled = False
+ self.defer_enabled = True
+
+ self.group_helper = GroupHelper(app, "groups", negotiator)
+ self.add_child(self.group_helper)
+
+ col = self.GroupColumn(app, "group", negotiator)
+ self.add_column(col)
+ self.set_default_column(col)
+
+ task = main.module.negotiator_edit_dynamic_quota
+ button = EditButton(app, "dynamic_button", negotiator, task)
+ self.add_child(button)
+ col = self.DynamicColumn(app, "dynamic", self.group_helper.get_dyn_quota, button)
+ col.title = "Dynamic Quota"
+ self.add_column(col)
+
+ task = main.module.negotiator_edit_static_quota
+ button = EditButton(app, "static_button", negotiator, task)
+ self.add_child(button)
+ col = self.StaticColumn(app, "static", self.group_helper.get_static_quota, button)
+ col.title = "Static Quota"
+ self.add_column(col)
+
+ task = main.module.negotiator_edit_prio_factor
+ button = EditButton(app, "prio_button", negotiator, task)
+ self.add_child(button)
+ col = self.FactorColumn(app, "factor", self.group_helper.get_priority_factor, button)
+ col.title = "Priority Factor"
+ self.add_column(col)
+
+ task = main.module.negotiator_edit_regroup
+ button = EditButton(app, "regroup_button", negotiator, task)
+ self.add_child(button)
+ col = self.RegroupColumn(app, "regroup", self.group_helper.get_regroups, button)
+ col.title = "Auto Regroup"
+ self.add_column(col)
+
+ self.buttons_row = "__buttons__"
+ self.empty_row = "__empty__"
+
def render_title(self, session):
- return "Overview"
+ return "Group Configuration"
- class PriorityPieChart(PieFlashChart):
- def __init__(self, app, name):
- super(NegotiatorOverview.PriorityPieChart, self).__init__(app, name)
+ def render_class(self, session, *args):
+ return "class=\"mobjects\""
- self.chart_type = "pie"
- self.stats = ("priority",)
+ def render_deferred_content(self, session, *args):
+ return "Loading..."
- def render_title(self, session, sched):
- return "Group Priority"
+ def do_get_items(self, session, *args):
+ groups = self.group_helper.get_group_names(session)
+ items = list(groups)
+ if self.reversed.get(session):
+ items = reversed(items)
+ if len(items):
+ items.append(self.buttons_row)
+ else:
+ items.append(self.empty_row)
+ return items
+
+ class GroupColumn(ItemTableColumn):
+ def __init__(self, app, name, negotiator):
+ super(NegotiatorOverviewTab.GroupColumn, self).__init__(app, name)
+
+ task = main.module.negotiator_add_group
+ self.button = EditButton(app, "add_group_button", negotiator, task)
+ self.add_child(self.button)
+
+ def render_title(self, session, *args):
+ return "Group"
+
+ def render_content(self, session, group):
+ if group == self.parent.buttons_row or group == self.parent.empty_row:
+ return self.button.render(session)
+
+ return group
+
+ class DynamicColumn(QmfGroupColumn):
+ def render_data(self, data):
+ return round(float(data[1]) * 100.0, 2)
+
+ class StaticColumn(QmfGroupColumn):
+ def render_data(self, data):
+ return data[2][2] and data[1] or "-"
+
+ class FactorColumn(QmfGroupColumn):
+ def render_data(self, data):
+ return data[2][2] and data[1] or "-"
+
+ class RegroupColumn(QmfGroupColumn):
+ def render_data(self, data):
+ return data[1]
+
+class GroupHelper(Widget):
+ def __init__(self, app, name, negotiator):
+ super(GroupHelper, self).__init__(app, name)
+
+ self.groups = self.GroupAttribute(app, "groups")
+ self.add_attribute(self.groups)
+
+ self.group_dyn_quotas = self.GroupAttribute(app, "group_dynamic_quotas")
+ self.add_attribute(self.group_dyn_quotas)
+
+ self.group_static_quotas = self.GroupAttribute(app, "group_static_quotas")
+ self.add_attribute(self.group_static_quotas)
+
+ self.group_autoregroups = self.GroupAttribute(app, "group_autoregroups")
+ self.add_attribute(self.group_autoregroups)
+
+ self.autoregroup = self.GroupAttribute(app, "autoregroup")
+ self.add_attribute(self.autoregroup)
+
+ self.group_factors = self.GroupAttribute(app, "group_factors")
+ self.add_attribute(self.group_factors)
+
+ self.negotiator = negotiator
+
+ def get_group_names(self, session):
+ groups = self.groups.get(session)
+ if len(groups) == 0:
+ negotiator = self.negotiator.get(session)
+ action = self.app.model.negotiator.GetRawConfig
+ groups = action.do_invoke(negotiator, "GROUP_NAMES", 10)
+ try:
+ groups = self.split_group_names(groups['Value'])
+ except Exception, e:
+ groups = []
+ if len(groups):
+ self.groups.set(session, groups)
+ return groups
+
+ def split_group_names(self, group_string):
+ groups = []
+ gsplit = group_string.split()
+ if len(gsplit) < 2:
+ gsplit = group_string.split(",")
+ for group in gsplit:
+ group = group.replace(",", "")
+ group = group.replace(" ", "")
+ groups.append(group)
+ return groups
+
+ def get_group_raw_config(self, session, config, attrib, groups=None):
+ configs = attrib.get(session)
+
+ if len(configs) == 0:
+ if groups is None:
+ groups = self.get_group_names(session)
+ negotiator = self.negotiator.get(session)
+ action = self.app.model.negotiator.GetConfigSet
+
+ raw_configs = action.do_invoke(negotiator, groups, config, "GetRawConfig", timeout=15)
+ for [group, data, status] in raw_configs:
+ configs.append([group, data['Value'], status])
+ attrib.set(session, configs)
+
+ return configs
+
+ def get_static_quota(self, session):
+ return self.get_group_raw_config(session,
+ "GROUP_QUOTA_",
+ self.group_static_quotas)
+
+ def get_dyn_quota(self, session):
+ return self.get_group_raw_config(session,
+ "GROUP_QUOTA_DYNAMIC_",
+ self.group_dyn_quotas)
+ def get_priority_factor(self, session):
+ return self.get_group_raw_config(session,
+ "GROUP_PRIO_FACTOR_",
+ self.group_factors)
+
+ def get_regroups(self, session):
+ return self.get_group_raw_config(session,
+ "GROUP_AUTOREGROUP_",
+ self.group_autoregroups)
+
+ def get_autoregroup(self, session):
+ return self.get_group_raw_config(session,
+ "GROUP_AUTOREGROUP",
+ self.autoregroup, [""])
+
+ def append_unclaimed_dyn_quota(self, session, quotas, force=False):
+ total = 0.0
+ for [group, value, status] in quotas:
+ try:
+ total = total + float(value)
+ except:
+ pass
+ if (total < 1.0) or force:
+ val = 1.0 - total
+ appended = list(quotas)
+ appended.append(['Unclaimed', str(val), ("OK", False, True)])
+ return appended
+ else:
+ return quotas
+
+ class GroupAttribute(Attribute):
+ def get_default(self, session):
+ return list()
+
+class AddGroupForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(AddGroupForm, self).__init__(app, name, task)
+
+ self.defer_enabled = True
+
+ self.object = NegotiatorParameter(app, "negotiator")
+ self.add_parameter(self.object)
+
+ self.group_helper = GroupHelper(app, "groups", self.object)
+ self.add_child(self.group_helper)
+
+ self.group_name = Parameter(app, "name")
+ self.add_parameter(self.group_name)
+
+ def render_title(self, session):
+ return "Add Group"
+
+ def render_group_name_path(self, session):
+ return self.group_name.path
+
+ def process_submit(self, session):
+ negotiator = self.object.get(session)
+ group_name = self.group_name.get(session)
+ original_groups = self.group_helper.get_group_names(session)
+
+ if self.is_valid(group_name):
+ original_groups.append(group_name)
+ new_groups = ", ".join(original_groups)
+ self.task.invoke(session, negotiator, "GROUP_NAMES", new_groups)
+ self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.exit_with_redirect(session, negotiator)
+
+ def is_valid(self, group):
+ ret = False
+ if len(group) and not "." in group and not " " in group:
+ ret = True
+ return ret
+
+class GroupForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(GroupForm, self).__init__(app, name, task)
+
+ self.defer_enabled = True
+
+ self.object = NegotiatorParameter(app, "negotiator")
+ self.add_parameter(self.object)
+
+ self.group_helper = GroupHelper(app, "groups", self.object)
+ self.add_child(self.group_helper)
+
+ group_name = Parameter(app, "gn")
+ self.add_parameter(group_name)
+
+ self.group_names = ListParameter(app, "group_names", group_name)
+ self.add_parameter(self.group_names)
+
+ original_value = Parameter(app, "ov")
+ self.add_parameter(original_value)
+
+ self.original_values = ListParameter(app, "original_values", original_value)
+ self.add_parameter(self.original_values)
+
+ def render_group_name(self, session, group):
+ return group[0]
+
+ def render_group_name_path(self, session, group):
+ return self.group_names.path
+
+ def render_original_value_path(self, session, group):
+ return self.original_values.path
+
+class EditPrioFactorForm(GroupForm):
+ def __init__(self, app, name, task):
+ super(EditPrioFactorForm, self).__init__(app, name, task)
+
+ self.field_tmpl = Template(self, "field_html")
+
+ factor = Parameter(app, "factor")
+ self.add_parameter(factor)
+
+ self.factors = ListParameter(app, "factors", factor)
+ self.add_parameter(self.factors)
+
+ def render_title(self, session):
+ return "Edit Group Priority Factor"
+
+ def render_form_class(self, session):
+ return "PrioFactorForm"
+
+ def render_data_col_header(self, session):
+ return "Priority Factor"
+
+ def render_chart(self, session):
+ return None
+
+ def render_groups(self, session):
+ writer = Writer()
+
+ groups = self.group_helper.get_priority_factor(session)
+ for group in groups:
+ self.field_tmpl.render(writer, session, group)
+
+ return writer.to_string()
+
+ def render_factor_name(self, session, group):
+ return self.factors.path
+
+ def render_factor_value(self, session, group):
+ return group[2][2] and group[1] or "--NOT SET--"
+
+ def process_submit(self, session):
+ negotiator = self.object.get(session)
+ factors = self.factors.get(session)
+ group_names = self.group_names.get(session)
+ original_values = self.original_values.get(session)
+
+ changed = False
+ for group, new_value, original_value in zip(group_names, factors, original_values):
+ if new_value != original_value:
+ if self.is_valid_factor(new_value):
+ self.task.invoke(session, negotiator, "GROUP_PRIO_FACTOR_"+group, new_value)
+ changed = True
+ if changed:
+ self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.exit_with_redirect(session, negotiator)
+
+ def is_valid_factor(self, value):
+ try:
+ factor = float(value)
+ except:
+ return False
+ return factor >= 1.0
+
+class EditDynamicQuotaForm(GroupForm):
+ def __init__(self, app, name, task):
+ super(EditDynamicQuotaForm, self).__init__(app, name, task)
+
+ self.field_tmpl = Template(self, "field_html")
+ self.unclaimed_tmpl = Template(self, "unclaimed_html")
+
+ quota = Parameter(app, "quota")
+ self.add_parameter(quota)
+
+ self.quotas = ListParameter(app, "quotas", quota)
+ self.add_parameter(self.quotas)
+
+ self.chart = PriorityPieChart(app, "chart", self.group_helper)
+ self.add_child(self.chart)
+
+ def render_title(self, session):
+ return "Edit Dynamic Group Quota"
+
+ def render_submit_content(self, session):
+ return "Change percentage"
+
+ def render_form_class(self, session):
+ return "priorityForm"
+
+ def render_data_col_header(self, session):
+ return "Percent of Slots"
+
+ def render_groups(self, session):
+ writer = Writer()
+
+ groups = self.group_helper.get_dyn_quota(session)
+ groups = self.group_helper.append_unclaimed_dyn_quota(session, groups, force=True)
+ for group in groups:
+ if group[0] == "Unclaimed":
+ self.unclaimed_tmpl.render(writer, session, group)
+ else:
+ self.field_tmpl.render(writer, session, group)
+
+ return writer.to_string()
+
+ def render_quota_name(self, session, group):
+ return self.quotas.path
+
+ def render_quota_value(self, session, group):
+ return round(float(group[1]) * 100.0, 2)
+
+ def render_chart_id(self, session):
+ return self.chart.render_id(session)
+
+ def process_submit(self, session):
+ negotiator = self.object.get(session)
+ quotas = self.quotas.get(session)
+ group_names = self.group_names.get(session)
+ original_values = self.original_values.get(session)
+
+ changed = False
+ for group, new_value, original_value in zip(group_names, quotas, original_values):
+ if group == "Unclaimed":
+ continue
+ quota = self.check_quota(new_value, original_value)
+ if quota:
+ self.task.invoke(session, negotiator, "GROUP_QUOTA_DYNAMIC_"+group, quota)
+ changed = True
+ if changed:
+ self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.exit_with_redirect(session, negotiator)
+
+ def check_quota(self, quota, original):
+ try:
+ pri = float(quota)
+ except:
+ return None
+ if pri < 0.0 or pri > 100.0:
+ return '0'
+
+ try:
+ original = float(original)
+ except:
+ original = 0
+ if pri == original:
+ return None
+
+ return str(pri / 100)
+
+class EditStaticQuotaForm(GroupForm):
+ def __init__(self, app, name, task):
+ super(EditStaticQuotaForm, self).__init__(app, name, task)
+
+ self.field_tmpl = Template(self, "field_html")
+
+ quota = Parameter(app, "quota")
+ self.add_parameter(quota)
+
+ self.quotas = ListParameter(app, "quotas", quota)
+ self.add_parameter(self.quotas)
+
+ def render_title(self, session):
+ return "Edit Static Group Quota"
+
+ def render_submit_content(self, session):
+ return "Change quota"
+
+ def render_form_class(self, session):
+ return "StaticQuotaForm"
+
+ def render_data_col_header(self, session):
+ return "Slots"
+
+ def render_chart(self, session):
+ return None
+
+ def render_groups(self, session):
+ writer = Writer()
+
+ groups = self.group_helper.get_static_quota(session)
+ for group in groups:
+ self.field_tmpl.render(writer, session, group)
+
+ return writer.to_string()
+
+ def render_quota_name(self, session, group):
+ return self.quotas.path
+
+ def render_quota_value(self, session, group):
+ return group[1]
+
+ def process_submit(self, session):
+ negotiator = self.object.get(session)
+ quotas = self.quotas.get(session)
+ group_names = self.group_names.get(session)
+ original_values = self.original_values.get(session)
+
+ changed = False
+ for group, new_value, original_value in zip(group_names, quotas, original_values):
+ if new_value != original_value:
+ self.task.invoke(session, negotiator, "GROUP_QUOTA_"+group, new_value)
+ changed = True
+ if changed:
+ self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.exit_with_redirect(session, negotiator)
+
+class EditRegroupForm(GroupForm):
+ def __init__(self, app, name, task):
+ super(EditRegroupForm, self).__init__(app, name, task)
+
+ self.field_tmpl = Template(self, "field_html")
+
+ self.regroup = DictParameter(app, "regroup")
+ self.add_parameter(self.regroup)
+
+ original_regroup = Parameter(app, "or")
+ self.add_parameter(original_regroup)
+
+ self.original_regroups = ListParameter(app, "original_regroups", original_regroup)
+ self.add_parameter(self.original_regroups)
+
+ def render_title(self, session):
+ return "Edit Autoregroup"
+
+ def render_form_class(self, session):
+ return "StaticQuotaForm"
+
+ def render_data_col_header(self, session):
+ return "Autoregroup"
+
+ def render_chart(self, session):
+ return None
+
+ def render_groups(self, session):
+ writer = Writer()
+
+ regroups = list(self.group_helper.get_regroups(session))
+ autoregroup = self.group_helper.get_autoregroup(session)
+ autoregroup[0][0] = "Default"
+ regroups.append(autoregroup[0])
+ for regroup in regroups:
+ self.field_tmpl.render(writer, session, regroup)
+
+ return writer.to_string()
+
+ def render_regroup_selected_TRUE(self, session, regroup):
+ if regroup[2][2]:
+ return (regroup[1] == 'TRUE') and "checked=\"checked\"" or ""
+
+ def render_regroup_selected_FALSE(self, session, regroup):
+ if regroup[2][2]:
+ return (regroup[1] == 'FALSE') and "checked=\"checked\"" or ""
+
+ def render_regroup_selected_UNDEFINED(self, session, regroup):
+ if not regroup[2][2]:
+ return "checked=\"checked\""
+
+ def render_regroup_path(self, session, regroup):
+ return self.regroup.get_instance_key(regroup[0])
+
+ def render_original_regroup_path(self, session, regroup):
+ return self.original_regroups.path
+
+ def render_regroup_value(self, session, regroup):
+ return regroup[2][2] and regroup[1] or "UNDEFINED"
+
+ def process_submit(self, session):
+ negotiator = self.object.get(session)
+ regroup = self.regroup.get(session)
+ group_names = self.group_names.get(session)
+ original_regroups = self.original_regroups.get(session)
+
+ changed = False
+ for group, original_value in zip(group_names, original_regroups):
+ if regroup[group] != original_value:
+ if group == "Default":
+ self.task.invoke(session, negotiator, "AUTOREGROUP", regroup[group])
+ else:
+ self.task.invoke(session, negotiator, "GROUP_AUTOREGROUP_"+group, regroup[group])
+ changed = True
+ if changed:
+ self.task.invoke(session, negotiator, "Reconfig", None)
+ self.task.exit_with_redirect(session, negotiator)
+
+class PriorityPieChart(StatFlashChart):
+ def __init__(self, app, name, groups):
+ super(PriorityPieChart, self).__init__(app, name)
+
+ self.chart_type = "pie"
+ self.fullpageable = False
+ self.update_enabled = False
+
+ self.groups = groups
+
+ def get_args(self, session):
+ return (self.frame.object.get(session),)
+
+ def render_title(self, session, object):
+ pass
+
+ def render_duration(self, session, *args):
+ pass
+
+ def render_width(self, session, *args):
+ return 360
+
+ def render_height(self, session, *args):
+ return 210
+
+
+ def get_href_params(self, session, object):
+ params = super(PriorityPieChart, self).get_href_params(session, object)
+ params.append("width=%i" % self.render_width(session))
+ params.append("height=%i" % self.render_height(session))
+
+ # send the group names and values to the chart page so we
+ # don't have to get them again
+ values = self.groups.get_dyn_quota(session)
+ values = self.groups.append_unclaimed_dyn_quota(session, values)
+ names = ["name=%s" % x[0] for x in values]
+ params.extend(names)
+ vals = ["value=%s" % str(x[1]) for x in values]
+ params.extend(vals)
+ return params
+
class NegotiatorStartForm(CuminTaskForm):
def __init__(self, app, name, task):
super(NegotiatorStartForm, self).__init__(app, name, task)
@@ -135,3 +737,11 @@
self.object = ListParameter(app, "negotiator", item)
self.add_parameter(self.object)
+
+class EditButton(ActionSet):
+ def __init__(self, app, name, negotiator, task):
+ super(EditButton, self).__init__(app, name)
+
+ link = TaskLink(app, "edit", task, negotiator)
+ self.add_child(link)
+
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.strings 2009-08-12 18:44:22 UTC (rev 3570)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.strings 2009-08-12 18:47:08 UTC (rev 3571)
@@ -15,3 +15,404 @@
select count(1) from negotiator as n
left outer join negotiator_stats as c on c.id = n.stats_curr_id
{sql_where}
+
+[GroupForm.css]
+div.deferredSpacer {
+ height: 10em;
+ background-color: #FFFFFF;
+ padding: 1em;
+}
+
+div.invalid {
+ font-size: .8em;
+ color: red;
+}
+
+[GroupForm.html]
+<form id="{id}" class="mform {form_class}" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <table class="PropertySet GroupPriorities">
+ <thead>
+ <tr>
+ <th>Group</th> <th>{data_col_header}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {groups}
+ </tbody>
+ </table>
+ {chart}<div style="clear:left;"><!-- --></div>
+ </div>
+ <div class="foot">
+ {submit}
+ {cancel}
+ </div>
+ <div>{hidden_inputs}</div>
+</form>
+<script type="text/javascript">
+<![CDATA[
+(function() {
+wooly.addPageUpdateListener( cumin.initializeGroupForm );
+}())
+]]>
+</script>
+
+[EditDynamicQuotaForm.css]
+form.priorityForm {
+ width: 60em !important;
+}
+form.priorityForm table, form.priorityForm div.StatValueChart {
+ float: left;
+}
+form.priorityForm table.GroupPriorities {
+ width: 50%;
+}
+form.priorityForm div.priorityChart {
+ margin-left: 2em;
+}
+form.priorityForm input {
+ text-align: right;
+}
+table.GroupPriorities input.disabled {
+ background-color: #FFF;
+ color: #555;
+ border: 0px solid #FFF;
+}
+
+div.slider {
+ width: 200px;
+ height: 2px;
+ background: #eee;
+ position: relative;
+ top: 8px;
+ border: 1px solid #000;
+}
+div.slider div.knob {
+ background: #000;
+ width: 8px;
+ height: 16px;
+ top: -7px;
+}
+
+.validation-failed {
+ border: 1px solid #f00;
+}
+
+[EditDynamicQuotaForm.javascript]
+cumin.init_sliders = function(priority_chart_id){
+ $$('div.slider').each(function(el, i){
+ var input = el.getParent("tr").getElement("input");
+ var val = input.value.toFloat();
+ var initial_knob = val * 100;
+ var slider = new Slider(el, el.getElement('.knob'), {
+ steps: 10000, // Steps from 0 to 100
+ range: [0, 10000], // min and max value
+ onChange: function (pos) {
+ var new_values = new Array();
+ var changedEl = this.element;
+ var changedInp = changedEl.getParent("tr").getElement("input");
+ changedInp.value = (Math.round(pos) / 100) + "";
+ // get the new total percent
+ var sum = 0.0;
+ var changedIndex = 0;
+ $$('div.slider').each(function (el, i) {
+ var inp = el.getParent("tr").getElement("input");
+ var val = parseFloat(inp.value);
+ sum += val;
+ new_values[new_values.length] = {'value': val, 'label': el.id, 'on-show': false };
+ if (el == changedEl)
+ changedIndex = new_values.length - 1;
+ });
+ if (sum > 100) {
+ var mySlider = changedEl.retrieve("myslider");
+ var val = pos - (sum - 100) * 100;
+ mySlider.set(val);
+ changedInp.value = (Math.round(val) / 100) + "";
+ new_values[changedIndex] = {'value': val / 100, 'label': changedEl.id, 'on-show': false };
+ }
+
+ var unclaimed = document.getElementById('Unclaimed');
+ if (unclaimed) {
+ if (sum < 100.0) {
+ var val = (100.0 - sum);
+ unclaimed.value = (Math.round(val * 100) / 100) + "";
+ new_values[new_values.length] = {'value': val, 'label': 'Unclaimed', 'on-show': false };
+ } else {
+ unclaimed.value = "0.0";
+ }
+ }
+
+ var chart = cumin.getFlashChart(priority_chart_id);
+ if (chart) {
+ var obj = {'values': new_values};
+ var myJson = JSON.encode(obj);
+ chart.setpieslice(changedEl.id, myJson);
+ }
+ }
+ }).set(initial_knob, false);
+ el.store('myslider', slider);
+ });
+}
+
+[EditDynamicQuotaForm.field_html]
+<tr>
+ <td>
+ {group_name}
+ </td>
+ <td>
+ <input class="validate-numeric IsPercent" type="text" name="{quota_name}" value="{quota_value}"
+ size="6" tabindex="100"/>
+ <!-- these are here so we don't need to reget the groups and values after a submit -->
+ <input type="hidden" name="{group_name_path}" value="{group_name}" />
+ <input type="hidden" name="{original_value_path}" value="{quota_value}" />
+ </td>
+ <td>
+ <div id="{group_name}" class="slider"><div class="knob"></div></div>
+ </td>
+</tr>
+
+[EditDynamicQuotaForm.unclaimed_html]
+<tr>
+ <td>
+ {group_name}
+ </td>
+ <td>
+ <input id="{group_name}" class="disabled" disabled="disabled" type="text" name="{quota_name}" value="{quota_value}"
+ size="6" tabindex="100"/>
+ <!-- these are here so we don't need to reget the groups and values after a submit -->
+ <input type="hidden" name="{group_name_path}" value="{group_name}" />
+ <input type="hidden" name="{original_value_path}" value="{quota_value}" />
+ </td>
+</tr>
+
+[EditDynamicQuotaForm.deferred_html]
+<form id="{id}" class="mform priorityForm" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <div class="deferredSpacer">Loading...</div>
+ </div>
+</form>
+<script type="text/javascript">
+<![CDATA[
+cumin.initializeGroupForm = function () {
+ var elem = $("{id}").elements[0];
+ elem.focus();
+ cumin.init_sliders("{chart_id}");
+
+ var myFormValidator = new FormValidator($('{id}'), {
+ onElementPass: function (el) {
+ var val = el.value.toFloat();
+ var sliderDiv = el.getParent("tr").getElement(".slider");
+ if (sliderDiv) {
+ var myslider = sliderDiv.retrieve('myslider');
+ if (myslider)
+ myslider.set(val * 100);
+ }
+ },
+ onElementFail: function (el, validators) {
+ //alert('failed');
+ },
+ evaluateOnSubmit: false,
+ evaluateFieldsOnBlur: false
+ });
+ myFormValidator.add('IsPercent', {
+ errorMsg: 'Values must be between 0 and 100.',
+ test: function(element) {
+ var val = element.get('value').toFloat();
+ return ((val >= 0) && (val <= 100))
+ }
+ });
+}
+]]>
+</script>
+
+[EditStaticQuotaForm.css]
+form.StaticQuotaForm {
+ width: 30em;
+}
+
+[EditStaticQuotaForm.field_html]
+<tr>
+ <td>
+ {group_name}
+ </td>
+ <td>
+ <input class="validate-numeric" type="text" name="{quota_name}" value="{quota_value}"
+ size="6" tabindex="100"/>
+ <!-- these are here so we don't need to reget the groups and values after a submit -->
+ <input type="hidden" name="{group_name_path}" value="{group_name}" />
+ <input type="hidden" name="{original_value_path}" value="{quota_value}" />
+ </td>
+</tr>
+
+[EditStaticQuotaForm.deferred_html]
+<form id="{id}" class="mform StaticQuotaForm" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <div class="deferredSpacer">Loading...</div>
+ </div>
+</form>
+<script type="text/javascript">
+<![CDATA[
+cumin.initializeGroupForm = function () {
+ var elem = $("{id}").elements[0];
+ elem.focus();
+
+ var myFormValidator = new FormValidator($('{id}'), {
+ evaluateOnSubmit: false,
+ evaluateFieldsOnBlur: false
+ });
+}
+]]>
+</script>
+
+[EditPrioFactorForm.css]
+form.mform.PrioFactorForm {
+ width: 32em;
+}
+[EditPrioFactorForm.field_html]
+<tr>
+ <td>
+ {group_name}
+ </td>
+ <td>
+ <input class="validate-numeric OneOrMore" type="text" name="{factor_name}" value="{factor_value}"
+ size="10" tabindex="100"/> <div class="invalid"></div>
+ <!-- these are here so we don't need to reget the groups and values after a submit -->
+ <input type="hidden" name="{group_name_path}" value="{group_name}" />
+ <input type="hidden" name="{original_value_path}" value="{factor_value}" />
+ </td>
+</tr>
+
+[EditPrioFactorForm.deferred_html]
+<form id="{id}" class="mform PrioFactorForm" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <div class="deferredSpacer">Loading...</div>
+ </div>
+</form>
+<script type="text/javascript">
+<![CDATA[
+cumin.initializeGroupForm = function () {
+ var elem = $("{id}").elements[0];
+ elem.focus();
+
+ var myFormValidator = new FormValidator($('{id}'), {
+ evaluateOnSubmit: false,
+ evaluateFieldsOnBlur: false,
+ onElementFail: function (el, validators) {
+ var span = el.getParent("td").getElement("div");
+ if (validators[0] == "validate-numeric")
+ span.set('text', "Must be a number.");
+ else
+ span.set('text', "Must be 1.0 or greater.");
+ },
+ onElementPass: function (el) {
+ el.getParent("td").getElement("div").set('text', "");
+ }
+ });
+
+ myFormValidator.add('OneOrMore', {
+ errorMsg: 'Values must be 1 or greater.',
+ test: function(element) {
+ var val = element.get('value').toFloat();
+ return (val >= 1);
+ }
+ });
+}
+]]>
+</script>
+
+[EditRegroupForm.field_html]
+<tr>
+ <td>
+ {group_name}
+ <input type="hidden" name="{group_name_path}" value="{group_name}" />
+ </td>
+ <td>
+ <input type="radio" name="{regroup_path}" {regroup_selected_TRUE} id="regroup_{group_name}_TRUE" value="TRUE" /> <label for="regroup_{group_name}_TRUE">TRUE</label>
+ <input type="radio" name="{regroup_path}" {regroup_selected_FALSE} id="regroup_{group_name}_FALSE" value="FALSE" /> <label for="regroup_{group_name}_FALSE">FALSE</label>
+ <input type="radio" name="{regroup_path}" {regroup_selected_UNDEFINED} id="regroup_{group_name}_UNDEFINED" value="UNDEFINED" /> <label for="regroup_{group_name}_UNDEFINED">NOT SET</label>
+ <input type="hidden" name="{original_regroup_path}" value="{regroup_value}" />
+ </td>
+</tr>
+
+[EditRegroupForm.deferred_html]
+<form id="{id}" class="mform StaticQuotaForm" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <div class="deferredSpacer">Loading...</div>
+ </div>
+</form>
+
+[AddGroupForm.css]
+form.mform.AddForm {
+ width: 30em;
+}
+form.mform.AddForm div.label, form.mform.AddForm input {
+ float: left;
+ margin: 1em 0 1em 1em;
+}
+
+[AddGroupForm.html]
+<form id="{id}" class="mform AddForm" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <div class="label">Group Name</div>
+ <input class="validate-nodot" type="text" name="{group_name_path}" value="" size="20" maxlength="40" />
+ <div style="clear: left;"><!-- --></div>
+ <div class="invalid"></div>
+ </div>
+ <div class="foot">
+ {submit}
+ {cancel}
+ </div>
+ <div>{hidden_inputs}</div>
+</form>
+<script type="text/javascript">
+<![CDATA[
+window.addEvent('domready', function () {
+ var elem = $("{id}").elements[0];
+ elem.focus();
+
+ var myFormValidator = new FormValidator($('{id}'), {
+ evaluateOnSubmit: false,
+ evaluateFieldsOnBlur: false,
+ onElementFail: function (el, validators) {
+ var span = el.getParent("div").getElement("div.invalid");
+ span.set('text', "Must not contain a .");
+ },
+ onElementPass: function (el) {
+ el.getParent("div").getElement("div.invalid").set('text', "");
+ }
+ });
+
+ myFormValidator.add('validate-nodot', {
+ errorMsg: '',
+ test: function(element) {
+ var bool = element.get('value').test(/\./,'i');
+ return !bool;
+ }
+ });
+});
+]]>
+</script>
+
+[EditButton.html]
+<ul class="actions">
+ <li>{edit}</li>
+</ul>
+
15 years, 4 months
rhmessaging commits: r3570 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-12 14:44:22 -0400 (Wed, 12 Aug 2009)
New Revision: 3570
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Removed hard-coded values from flash pie charts.
Allow flash charts to get the names and values of the pie slices from parameters. This avoids calling the qmf methods a second time.
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-08-12 18:38:49 UTC (rev 3569)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-08-12 18:44:22 UTC (rev 3570)
@@ -172,10 +172,10 @@
def render_stat_name(self, session, stat, object):
return stat.name
- def render_width(self, session, object):
+ def render_width(self, session, *args):
return 360
- def render_height(self, session, object):
+ def render_height(self, session, *args):
return 100
class StatStackedChart(StatValueChart):
@@ -212,16 +212,12 @@
params = self.get_href_params(session, object)
return "flashpage.html?" + ";".join(params)
- def render_width(self, session, object):
+ def render_width(self, session, *args):
return 360
- def render_height(self, session, object):
+ def render_height(self, session, *args):
return 120
-class PieFlashChart(StatFlashChart):
- def render_height(self, session, object):
- return 200
-
class ImageCache(object):
def __init__(self):
self.__files = dict() # {name: {"time": time_created, "file": file object, "cookie": (cookie values)}}
@@ -506,8 +502,10 @@
recent = None
if len(stats):
- stat = stats[0]
+ stat = stats[0]
recent = stat.recent(object)
+ else:
+ return
if self.samples.get(session):
return self.render_samples(session, recent)
@@ -654,10 +652,10 @@
id = self.parent.id.get(session)
return (cls.get(id),)
- def render_width(self, session, object):
+ def render_width(self, session, *args):
return self.parent.container_width.get(session)
- def render_height(self, session, object):
+ def render_height(self, session, *args):
return self.parent.container_height.get(session)
def render_img_href(self, session, object):
@@ -715,15 +713,20 @@
return x_axis
class FlashPieChart(Widget):
+ colors = ['#FF0000', '#0000FF', '#00FF00', '#00FFFF', '#FF00FF', '#000000', '#666600']
def __init__(self, app, name, page):
super(FlashPieChart, self).__init__(app, name)
self.page = page
- colors = ['#FF0000', '#0000FF', '#00FF00', '#FF00FF', '#00FFFF', '#000000', '#666600']
def create(self, session, object):
- #stat = self.page.stats.get(session)[0]
- #action = self.app.model.negotiator.GetStats
- #group_stats = action.do_invoke(negotiator, 'developer')
+ names = self.page.names.get(session)
+ values = self.page.values.get(session)
+
+ #cls = self.page.class_.get(session)
+ #action = self.page.action.get(session)
+ #method = getattr(cls, action)
+ #values1 = method.do_invoke(object)
+
chart = Chart()
chart.title.text = ""
chart.bg_colour = "#FFFFFF"
@@ -744,21 +747,24 @@
animation.type = "bounce"
animation.distance = 8
element.animate.append(animation)
+ element.tip = "#percent#"
- element.tip = "#percent# (Click to modify)"
- element.colours = self.colors
+ element.colours = []
+ for i in range(len(names)):
+ j = i % len(self.colors)
+ if names[i] == "Unclaimed":
+ color = "#EEEEEE"
+ else:
+ color = self.colors[j]
+ element.colours.append(color)
+ element.colours.append("#EEEEEE")
+
element.on_click = "ofc_change_priority"
id = self.page.chart_id.get(session)
- element.on_click_text = "#val#|#label#|%s" % id
- element.values = [
- {"value": 2, "label": "fah"},
- {"value": 4, "label": "Development"},
- {"value": 7, "label": "Accounting"},
- {"value": 70, "label": "Rendering"},
- {"value": 6, "label": "Reporting"},
- {"value": 9, "label": "Management"}
- ]
+ element.on_click_text = "#percent#|#val#|#label#|%s" % id
+ element.values = [{"label": name, "value": float(value)} for name, value in zip(names, values)]
+
chart.elements.append(element)
return chart.create()
@@ -1166,6 +1172,21 @@
self.chart_id = Parameter(app, "chart_id")
self.add_parameter(self.chart_id)
+ self.action = Parameter(app, "action")
+ self.add_parameter(self.action)
+
+ name = Parameter(app, "n")
+ self.add_parameter(name)
+
+ self.names = ListParameter(app, "name", name)
+ self.add_parameter(self.names)
+
+ val = Parameter(app, "v")
+ self.add_parameter(val)
+
+ self.values = ListParameter(app, "value", val)
+ self.add_parameter(self.values)
+
self.control_min = Parameter(app, "low")
ten_min_of_day = 10.0 / (24.0 * 60.0)
one_hour = 1 / 24.0
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2009-08-12 18:38:49 UTC (rev 3569)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2009-08-12 18:44:22 UTC (rev 3570)
@@ -298,19 +298,17 @@
</script>
[PieFlashChart.html]
-<div>
<div class="StatValueChart" id="{id}">
<h2>{title}</h2>
<div id="{id}_chart">
</div>
</div>
-</div>
<script type="text/javascript">
//<![CDATA[
var flashversion = swfobject.getFlashPlayerVersion();
if (flashversion.major >= 9) {
swfobject.embedSWF("resource?name=open-flash-chart.swf", "{id}_chart", "{width}", "{height}", "9.0.0", "",
- {"data-file":"{href}"});
+ {"data-file":"{href}"}, {wmode: 'opaque'});
}
//]]>
</script>
15 years, 4 months
rhmessaging commits: r3569 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-12 14:38:49 -0400 (Wed, 12 Aug 2009)
New Revision: 3569
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Qmftasks return the string "OK" in the status_code instead of the number 0.
Added CuminNegotiator actions for getting/ setting config variables.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-08-12 18:35:12 UTC (rev 3568)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-08-12 18:38:49 UTC (rev 3569)
@@ -155,6 +155,7 @@
self.form = None
self.aggregate = False
+ self.navigable = True
if self.cls:
if self.__class__ not in self.cls.tasks_by_class:
@@ -314,7 +315,7 @@
def completion(status_code, output_args):
invoc.last_change_time = datetime.now()
- if status_code == 0:
+ if status_code == 0 or status_code == "OK":
invoc.status = invoc.OK
else:
invoc.status = invoc.FAILED
@@ -2413,6 +2414,12 @@
action = GetStartedAction(self, "GetStarted")
action.navigable = False
+ action = self.GetConfigSet(self, "GetConfigSet")
+ action.navigable = False
+
+ action = self.GetRawConfig(self, "GetRawConfig")
+ action.navigable = False
+
def init(self):
super(CuminNegotiator, self).init()
@@ -2424,25 +2431,100 @@
def get_object_name(self, neg):
return neg.Name
+ class GetRawConfig(CuminAction):
+ def do_invoke(self, negotiator, config_name, timeout=5):
+ self.data = None
+ self.got_data = False
+ self.error = False
+
+ def completion(status, data):
+ self.data = data
+ self.got_data = True
+
+ def predicate():
+ return self.got_data or self.error
+
+ try:
+ negotiator.GetRawConfig(self.mint.model, completion, config_name, None)
+ except Exception, e:
+ self.error = True
+
+ wait(predicate, timeout=timeout)
+ return self.data
+
+ class GetConfigSet(CuminAction):
+ """ send a set or qmf requests at the same time and wait for
+ them all to complete or timeout """
+
+ def do_invoke(self, negotiator, groups, prepend="", method="GetStats", timeout=5):
+ def predicate(calls):
+ done = 0
+ for call in calls:
+ if call.done():
+ done = done + 1
+ return done == len(calls)
+
+ calls = list()
+ for group in groups:
+ call = self.StatGetter()
+ calls.append(call)
+ call.invoke(self.mint.model, negotiator, group, prepend, method, {'Value': 0})
+
+ wait(predicate, timeout=timeout, args=calls)
+
+ return [(call.group, call.data, (call.status, call.error, call.got_data))
+ for call in calls]
+
+ class StatGetter(object):
+ def invoke(self, model, negotiator, group, prepend, method, default):
+ self.data = default
+ self.group = group
+ self.got_data = False
+ self.error = False
+ self.status = None
+
+ def completion(status, data):
+ self.status = status
+ if (status == 0) or (status == "OK"):
+ self.data = data
+ self.got_data = True
+ else:
+ self.error = True
+
+ try:
+ if method == "GetStats":
+ negotiator.GetStats(model, completion, group, None)
+ elif method == "GetRawConfig":
+ negotiator.GetRawConfig(model, completion, prepend+group, None)
+ except Exception, e:
+ self.error = True
+
+ def done(self):
+ return self.got_data or self.error
+
class GetLimits(CuminAction):
def do_invoke(self, negotiator):
self.lim = dict()
self.got_data = False
+ self.error = False
def completion(status, data):
- self.lim = data["Limits"]
- self.got_data = True
+ try:
+ self.lim = data["Limits"]
+ self.got_data = True
+ except KeyError:
+ self.error = True
def predicate():
- return self.got_data
+ return self.got_data or self.error
try:
negotiator.GetLimits(self.mint.model, completion, None)
except Exception, e:
return self.lim
- # wait for up to 5 seconds for completion to be called
- wait(predicate, timeout=5)
+ # wait a couple of seconds for completion to be called
+ wait(predicate, timeout=2)
if not self.got_data:
self.lim["timeout"] = True
return self.lim
15 years, 4 months
rhmessaging commits: r3568 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-08-12 14:35:12 -0400 (Wed, 12 Aug 2009)
New Revision: 3568
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Added ability to not show tasks in the summary area by setting task.navigable = False.
Added ability to truncate table column for non-sql tables.
Prevented formPages from including the deferred and update scripts twice.
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-08-12 18:33:08 UTC (rev 3567)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-08-12 18:35:12 UTC (rev 3568)
@@ -399,7 +399,7 @@
return [(x.get_href(session, object),
x.get_title(session),
True)
- for x in cls.tasks if not x.aggregate]
+ for x in cls.tasks if x.navigable and not x.aggregate]
class CuminDetails(Widget):
# XXX make the object arg mandatory
@@ -469,7 +469,7 @@
x.get_title(session),
x.is_enabled(session, object))
for x in cls.tasks
- if not x.aggregate and x.form]
+ if not x.aggregate and x.form and x.navigable]
class StateSwitch(ItemSet):
def __init__(self, app, name):
@@ -644,6 +644,12 @@
self.header_class = TopTableColumnHeader
self.col_percent = 60
+class TruncatableItemTable(ItemTable):
+ def render_extra_class(self, session, *args):
+ """ if any columns are truncate, table needs a fixed layout """
+ return True in [True for x in self.columns
+ if isinstance(x, ClientTruncateColumn)] and " truncate" or ""
+
class TruncatableTable(SqlTable):
def render_extra_class(self, session, *args):
""" if any columns are truncate, table needs a fixed layout """
@@ -673,6 +679,20 @@
self.parent.count.set(session, count + 1)
return count
+class CuminItemTable(TruncatableItemTable):
+ def __init__(self, app, name):
+ super(CuminItemTable, self).__init__(app, name)
+
+ self.paginator = Paginator(app, "page")
+ self.add_child(self.paginator)
+
+ self.update_enabled = True
+
+ def do_process(self, session, *args):
+ super(CuminItemTable, self).do_process(session, *args)
+
+ self.paginator.set_count(session, self.get_item_count(session, *args))
+
class CuminTable(TruncatableTable):
def __init__(self, app, name):
super(CuminTable, self).__init__(app, name)
@@ -1239,9 +1259,9 @@
def __init__(self, app, name):
super(CuminFormPage, self).__init__(app, name)
- background = self.Background(app, "background")
- background.type = "text/html"
- self.add_child(background)
+ self.background = self.Background(app, "background")
+ self.background.type = "text/html"
+ self.add_child(self.background)
self.modes = ModeSet(app, "modes")
self.add_child(self.modes)
@@ -1250,6 +1270,14 @@
# for form in model tasks:
# self.add_mode(form)
+ def render_content(self, session):
+ writer = Writer()
+
+ writer.write(self.modes.render(session))
+ writer.write(self.background.render(session))
+
+ return writer.to_string()
+
class Background(BackgroundInclude):
def render_data(self, session):
form = self.parent.modes.mode.get(session)
15 years, 4 months