rhmessaging commits: r3435 - mgmt/trunk/cumin.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2009-06-08 14:24:33 -0400 (Mon, 08 Jun 2009)
New Revision: 3435
Modified:
mgmt/trunk/cumin/Makefile
Log:
add usergrid module to Makefile
Modified: mgmt/trunk/cumin/Makefile
===================================================================
--- mgmt/trunk/cumin/Makefile 2009-06-08 18:11:25 UTC (rev 3434)
+++ mgmt/trunk/cumin/Makefile 2009-06-08 18:24:33 UTC (rev 3435)
@@ -21,6 +21,8 @@
install -pm 0644 python/cumin/messaging/*.py python/cumin/messaging/*.pyc python/cumin/messaging/*.strings ${lib}/messaging
install -d ${lib}/grid
install -pm 0644 python/cumin/grid/*.py python/cumin/grid/*.pyc python/cumin/grid/*.strings ${lib}/grid
+ install -d ${lib}/usergrid
+ install -pm 0644 python/cumin/usergrid/*.py python/cumin/usergrid/*.pyc python/cumin/usergrid/*.strings ${lib}/usergrid
install -d ${lib}/inventory
install -pm 0644 python/cumin/inventory/*.py python/cumin/inventory/*.pyc python/cumin/inventory/*.strings ${lib}/inventory
install -d ${BIN_DIR}
15 years, 9 months
rhmessaging commits: r3434 - in mgmt/trunk/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2009-06-08 14:11:25 -0400 (Mon, 08 Jun 2009)
New Revision: 3434
Modified:
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/sql/schema.sql
mgmt/trunk/mint/sql/triggers.sql
Log:
updated schema
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2009-06-08 17:51:40 UTC (rev 3433)
+++ mgmt/trunk/mint/python/mint/schema.py 2009-06-08 18:11:25 UTC (rev 3434)
@@ -288,6 +288,74 @@
model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Submit",
callback, args=actualArgs)
+ def GetAd(self, model, callback, Id, JobAd):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if JobAd is not None:
+ actualArgs.append(JobAd)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "GetAd",
+ callback, args=actualArgs)
+
+ def SetAttribute(self, model, callback, Id, Name, Value):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if Name is not None:
+ actualArgs.append(Name)
+ if Value is not None:
+ actualArgs.append(Value)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "SetAttribute",
+ callback, args=actualArgs)
+
+ def Hold(self, model, callback, Id, Reason):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if Reason is not None:
+ actualArgs.append(Reason)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Hold",
+ callback, args=actualArgs)
+
+ def Release(self, model, callback, Id, Reason):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if Reason is not None:
+ actualArgs.append(Reason)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Release",
+ callback, args=actualArgs)
+
+ def Remove(self, model, callback, Id, Reason):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if Reason is not None:
+ actualArgs.append(Reason)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Remove",
+ callback, args=actualArgs)
+
+ def Fetch(self, model, callback, Id, File, Start, End, Data):
+ actualArgs = list()
+ if Id is not None:
+ actualArgs.append(Id)
+ if File is not None:
+ actualArgs.append(File)
+ if Start is not None:
+ actualArgs.append(Start)
+ if End is not None:
+ actualArgs.append(End)
+ if Data is not None:
+ actualArgs.append(Data)
+ originalId = ObjectId(None, self.qmfScopeId, self.qmfObjectId)
+ model.callMethod(self.qmfBrokerId, originalId, self.qmfClassKey, "Fetch",
+ callback, args=actualArgs)
+
class SchedulerStats(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -629,6 +697,44 @@
+class Submission(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+ qmfBrokerId = StringCol(length=1000, default=None)
+ qmfScopeId = BigIntCol(default=None)
+ qmfAgentId = StringCol(length=1000, default=None)
+ qmfObjectId = BigIntCol(default=None)
+ qmfIdsUnique = DatabaseIndex(qmfBrokerId, qmfScopeId, qmfObjectId, unique=True)
+ qmfClassKey = StringCol(length=1000, default=None)
+ qmfPersistent = BoolCol(default=None)
+ qmfUpdateTime = TimestampCol(default=None)
+ qmfCreateTime = TimestampCol(default=None)
+ qmfDeleteTime = TimestampCol(default=None)
+ statsCurr = ForeignKey('SubmissionStats', cascade='null', default=None)
+ statsCurrIndex = DatabaseIndex(statsCurr)
+ statsPrev = ForeignKey('SubmissionStats', cascade='null', default=None)
+ statsPrevIndex = DatabaseIndex(statsPrev)
+ classInfos = dict() # brokerId => classInfo
+ scheduler = ForeignKey('Scheduler', cascade='null', default=None)
+ submitter = ForeignKey('Submitter', cascade='null', default=None)
+ Name = StringCol(length=1000, default=None)
+
+
+class SubmissionStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+ qmfUpdateTime = TimestampCol(default=None)
+ submission = ForeignKey('Submission', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ Idle = BigIntCol(default=None)
+ Running = BigIntCol(default=None)
+ Removed = BigIntCol(default=None)
+ Completed = BigIntCol(default=None)
+ Held = BigIntCol(default=None)
+
+
+
+
class Acl(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -1540,6 +1646,16 @@
Grid.sqlmeta.addJoin(SQLMultipleJoin('GridStats', joinMethodName='stats'))
+classToSchemaNameMap['Submission'] = 'Submission'
+schemaNameToClassMap['Submission'] = Submission
+
+Scheduler.sqlmeta.addJoin(SQLMultipleJoin('Submission', joinMethodName='submissions'))
+
+Submitter.sqlmeta.addJoin(SQLMultipleJoin('Submission', joinMethodName='submissions'))
+
+
+Submission.sqlmeta.addJoin(SQLMultipleJoin('SubmissionStats', joinMethodName='stats'))
+
classToSchemaNameMap['Acl'] = 'Acl'
schemaNameToClassMap['Acl'] = Acl
@@ -1669,6 +1785,6 @@
Sysimage.sqlmeta.addJoin(SQLMultipleJoin('SysimageStats', joinMethodName='stats'))
-entityClasses = ['Slot', 'Job', 'Scheduler', 'Submitter', 'Negotiator', 'Collector', 'Master', 'Grid', 'Acl', 'Cluster', 'Store', 'Journal', 'System', 'Broker', 'Agent', 'Vhost', 'Queue', 'Exchange', 'Binding', 'ClientConnection', 'Link', 'Bridge', 'Session', 'Sysimage']
+entityClasses = ['Slot', 'Job', 'Scheduler', 'Submitter', 'Negotiator', 'Collector', 'Master', 'Grid', 'Submission', 'Acl', 'Cluster', 'Store', 'Journal', 'System', 'Broker', 'Agent', 'Vhost', 'Queue', 'Exchange', 'Binding', 'ClientConnection', 'Link', 'Bridge', 'Session', 'Sysimage']
-statsClasses = ['SlotStats', 'JobStats', 'SchedulerStats', 'SubmitterStats', 'NegotiatorStats', 'CollectorStats', 'MasterStats', 'GridStats', 'AclStats', 'ClusterStats', 'StoreStats', 'JournalStats', 'SystemStats', 'BrokerStats', 'AgentStats', 'VhostStats', 'QueueStats', 'ExchangeStats', 'BindingStats', 'ClientConnectionStats', 'LinkStats', 'BridgeStats', 'SessionStats', 'SysimageStats']
+statsClasses = ['SlotStats', 'JobStats', 'SchedulerStats', 'SubmitterStats', 'NegotiatorStats', 'CollectorStats', 'MasterStats', 'GridStats', 'SubmissionStats', 'AclStats', 'ClusterStats', 'StoreStats', 'JournalStats', 'SystemStats', 'BrokerStats', 'AgentStats', 'VhostStats', 'QueueStats', 'ExchangeStats', 'BindingStats', 'ClientConnectionStats', 'LinkStats', 'BridgeStats', 'SessionStats', 'SysimageStats']
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2009-06-08 17:51:40 UTC (rev 3433)
+++ mgmt/trunk/mint/sql/schema.sql 2009-06-08 18:11:25 UTC (rev 3434)
@@ -930,6 +930,38 @@
tpl_outstanding_ai_os_high BIGINT
);
+CREATE TABLE submission (
+ id SERIAL PRIMARY KEY,
+ qmf_broker_id VARCHAR(1000),
+ qmf_scope_id BIGINT,
+ qmf_agent_id VARCHAR(1000),
+ qmf_object_id BIGINT,
+ qmf_class_key VARCHAR(1000),
+ qmf_persistent BOOL,
+ qmf_update_time TIMESTAMP,
+ qmf_create_time TIMESTAMP,
+ qmf_delete_time TIMESTAMP,
+ stats_curr_id INT,
+ stats_prev_id INT,
+ scheduler_id INT,
+ submitter_id INT,
+ name VARCHAR(1000)
+);
+CREATE UNIQUE INDEX submission_qmfIdsUnique ON submission (qmf_broker_id, qmf_scope_id, qmf_object_id);
+CREATE INDEX submission_statsPrevIndex ON submission (stats_prev_id);
+CREATE INDEX submission_statsCurrIndex ON submission (stats_curr_id);
+
+CREATE TABLE submission_stats (
+ id SERIAL PRIMARY KEY,
+ qmf_update_time TIMESTAMP,
+ submission_id INT,
+ idle BIGINT,
+ running BIGINT,
+ removed BIGINT,
+ completed BIGINT,
+ held BIGINT
+);
+
CREATE TABLE submitter (
id SERIAL PRIMARY KEY,
qmf_broker_id VARCHAR(1000),
@@ -1227,6 +1259,16 @@
ALTER TABLE store_stats ADD CONSTRAINT store_id_exists FOREIGN KEY (store_id) REFERENCES store (id) ON DELETE SET NULL;
+ALTER TABLE submission ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES submission_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE submission ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES submission_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE submission ADD CONSTRAINT scheduler_id_exists FOREIGN KEY (scheduler_id) REFERENCES scheduler (id) ON DELETE SET NULL;
+
+ALTER TABLE submission ADD CONSTRAINT submitter_id_exists FOREIGN KEY (submitter_id) REFERENCES submitter (id) ON DELETE SET NULL;
+
+ALTER TABLE submission_stats ADD CONSTRAINT submission_id_exists FOREIGN KEY (submission_id) REFERENCES submission (id) ON DELETE SET NULL;
+
ALTER TABLE submitter ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES submitter_stats (id) ON DELETE SET NULL;
ALTER TABLE submitter ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES submitter_stats (id) ON DELETE SET NULL;
Modified: mgmt/trunk/mint/sql/triggers.sql
===================================================================
--- mgmt/trunk/mint/sql/triggers.sql 2009-06-08 17:51:40 UTC (rev 3433)
+++ mgmt/trunk/mint/sql/triggers.sql 2009-06-08 18:11:25 UTC (rev 3434)
@@ -121,6 +121,19 @@
CREATE INDEX grid_stats_update_time ON grid_stats (qmf_update_time);
+CREATE OR REPLACE FUNCTION update_submission_stats() RETURNS trigger AS '
+BEGIN
+ UPDATE submission SET stats_prev_id = stats_curr_id, stats_curr_id = new.id WHERE id = new.submission_id;
+ RETURN new;
+END
+' LANGUAGE plpgsql;
+
+CREATE TRIGGER update_submission_stats AFTER INSERT ON submission_stats
+ FOR EACH ROW EXECUTE PROCEDURE update_submission_stats();
+
+CREATE INDEX submission_stats_update_time ON submission_stats (qmf_update_time);
+
+
CREATE OR REPLACE FUNCTION update_acl_stats() RETURNS trigger AS '
BEGIN
UPDATE acl SET stats_prev_id = stats_curr_id, stats_curr_id = new.id WHERE id = new.acl_id;
15 years, 9 months
rhmessaging commits: r3433 - mgmt/trunk/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-06-08 13:51:40 -0400 (Mon, 08 Jun 2009)
New Revision: 3433
Modified:
mgmt/trunk/cumin/Makefile
Log:
Install the cumin modules
Modified: mgmt/trunk/cumin/Makefile
===================================================================
--- mgmt/trunk/cumin/Makefile 2009-06-08 16:06:37 UTC (rev 3432)
+++ mgmt/trunk/cumin/Makefile 2009-06-08 17:51:40 UTC (rev 3433)
@@ -15,6 +15,14 @@
install: build
install -d ${lib}
install -pm 0644 python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
+ install -d ${lib}/account
+ install -pm 0644 python/cumin/account/*.py python/cumin/account/*.pyc python/cumin/account/*.strings ${lib}/account
+ install -d ${lib}/messaging
+ install -pm 0644 python/cumin/messaging/*.py python/cumin/messaging/*.pyc python/cumin/messaging/*.strings ${lib}/messaging
+ install -d ${lib}/grid
+ install -pm 0644 python/cumin/grid/*.py python/cumin/grid/*.pyc python/cumin/grid/*.strings ${lib}/grid
+ install -d ${lib}/inventory
+ install -pm 0644 python/cumin/inventory/*.py python/cumin/inventory/*.pyc python/cumin/inventory/*.strings ${lib}/inventory
install -d ${BIN_DIR}
install -pm 0755 bin/* ${BIN_DIR}
install -d ${doc}
15 years, 9 months
rhmessaging commits: r3432 - in mgmt/trunk/cumin/python/cumin: account and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 12:06:37 -0400 (Mon, 08 Jun 2009)
New Revision: 3432
Added:
mgmt/trunk/cumin/python/cumin/account/
mgmt/trunk/cumin/python/cumin/account/__init__.py
mgmt/trunk/cumin/python/cumin/account/main.py
mgmt/trunk/cumin/python/cumin/account/main.strings
mgmt/trunk/cumin/python/cumin/account/user.py
mgmt/trunk/cumin/python/cumin/account/user.strings
Removed:
mgmt/trunk/cumin/python/cumin/user.py
mgmt/trunk/cumin/python/cumin/user.strings
Modified:
mgmt/trunk/cumin/python/cumin/__init__.py
mgmt/trunk/cumin/python/cumin/messaging/queue.py
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/page.strings
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Added "Your Account" to upper right corner of pages.
Created new AccountPage class
Moved the Account/My Jobs tabs to new page
Modified: mgmt/trunk/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/__init__.py 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/__init__.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -16,7 +16,8 @@
from demo import DemoData
from page import MainPage
from stat import StatChartPage, StatStackedPage, SlotMapPage
-from user import LoginPage, UserSession, UserSessionExpireThread
+from account.user import UserSession, UserSessionExpireThread
+from account import LoginPage, AccountPage
from datetime import timedelta
from qpid.util import URL
@@ -46,6 +47,8 @@
self.add_page(self.main_page)
self.set_default_page(self.main_page)
+ self.account_page = AccountPage(self, "account.html")
+ self.add_page(self.account_page)
self.add_page(DevelPage(self, "devel.html"))
self.add_page(ModelPage(self, "model.xml"))
self.add_page(CallPage(self, "call.xml"))
Added: mgmt/trunk/cumin/python/cumin/account/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/__init__.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/account/__init__.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -0,0 +1 @@
+from main import *
Added: mgmt/trunk/cumin/python/cumin/account/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/main.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/account/main.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -0,0 +1,277 @@
+from wooly import *
+from wooly.widgets import *
+from wooly.resources import *
+
+from cumin.widgets import *
+from cumin.util import *
+from cumin.grid.job import JobTab
+from user import UserSession
+
+from wooly import Session
+
+strings = StringCatalog(__file__)
+
+class AccountPage(CuminPage, ModeSet):
+ def __init__(self, app, name):
+ super(AccountPage, self).__init__(app, name)
+
+ self.account = AccountContainerView(app, "account")
+ self.add_mode(self.account)
+ self.set_default_frame(self.account)
+
+ def render_title(self, session):
+ return "MRG Account"
+
+class AccountContainerView(CuminMainView):
+ def __init__(self, app, name):
+ super(AccountContainerView, self).__init__(app, name)
+
+ self.main = AccountFrame(app, "main")
+ self.add_tab(self.main)
+
+ def render_admin_href(self, session):
+ return Session(self.app.main_page).marshal()
+
+class AccountFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(AccountFrame, self).__init__(app, name)
+
+ self.view = AccountView(app, "view")
+ self.add_mode(self.view)
+
+ self.change_password = ChangePasswordForm(app, "password")
+ self.add_mode(self.change_password)
+
+ def render_title(self, session):
+ return "Account"
+
+class AccountView(TabbedModeSet):
+ def __init__(self, app, name):
+ super(AccountView, self).__init__(app, name)
+
+ heading = self.Heading(app, "heading")
+ self.add_child(heading)
+
+ self.add_tab(self.AccountTab(app, "acct"))
+ self.add_tab(self.MyGridJobs(app, "jobs"))
+
+ def render_change_password_href(self, session):
+ branch = session.branch()
+ self.frame.change_password.show(branch)
+ return branch.marshal()
+
+ class Heading(CuminHeading):
+ def render_title(self, session):
+ return "Your Account"
+
+ def render_icon_href(self, session):
+ return "resource?name=action-36.png"
+
+ class AccountTab(ActionSet):
+ def render_title(self, session):
+ return "Account Settings"
+
+ def render_change_password_href(self, session):
+ branch = session.branch()
+ self.frame.change_password.show(branch)
+ return branch.marshal()
+
+ class MyGridJobs(JobTab):
+ def render_title(self, session):
+ return "Your Grid Jobs %s" % fmt_count(self.get_item_count(session))
+
+ def render_sql_where(self, session, *args):
+ if hasattr(session, "user_session"):
+ user = session.user_session.subject.name
+ else:
+ user = ""
+ elems = list()
+ elems.append("b.name like '%s%s'" % (user, "%"))
+ elems.append(self.get_phase_sql(session))
+ return "where %s" % " and ".join(elems)
+
+ def get_sql_values(self, session, *args):
+ pass
+
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["custom_group", "scheduler"])
+
+ def render_user(self, session, *args):
+ if hasattr(session, "user_session"):
+ return session.user_session.subject.name
+
+class LoginPage(HtmlPage):
+ def __init__(self, app, name):
+ super(LoginPage, self).__init__(app, name)
+
+ self.html_class = LoginPage.__name__
+
+ self.logout = BooleanParameter(app, "logout")
+ self.add_parameter(self.logout)
+
+ self.origin = self.Origin(app, "origin")
+ self.add_parameter(self.origin)
+
+ form = LoginForm(app, "form")
+ self.add_child(form)
+
+ def do_process(self, session):
+ if self.logout.get(session):
+ #id = session.get_cookie("session")
+ session.expire_cookie("session")
+
+ super(LoginPage, self).do_process(session)
+
+ def render_title(self, session):
+ return "Log In"
+
+ class Origin(Parameter):
+ def get_default(self, session):
+ return Session(self.app.main_page).marshal()
+
+class LoginForm(FieldForm):
+ def __init__(self, app, name):
+ super(LoginForm, self).__init__(app, name)
+
+ self.__login_invalid = Attribute(app, "login_invalid")
+ self.add_attribute(self.__login_invalid)
+
+ self.__name = self.Name(app, "name")
+ self.add_field(self.__name)
+ self.__name.input.size = 20
+
+ self.__password = self.Password(app, "password")
+ self.add_field(self.__password)
+ self.__password.input.size = 20
+
+ self.__submit = self.Submit(app, "submit")
+ self.add_child(self.__submit)
+
+ def do_process(self, session):
+ if self.__submit.get(session):
+ name = self.__name.get(session)
+ password = self.__password.get(session)
+
+ errors = self.validate(session)
+
+ if not errors:
+ try:
+ user = Subject.selectBy(name=name)[0]
+ except IndexError:
+ self.__login_invalid.set(session, True)
+ return
+
+ crypted = user.password
+
+ if crypted and crypt(password, crypted) == crypted:
+ # You're in!
+
+ usess = UserSession(self.app, user)
+ session.set_cookie("session", usess.id)
+
+ url = self.page.origin.get(session)
+
+ self.page.set_redirect_url(session, url)
+ else:
+ self.__login_invalid.set(session, True)
+
+ def render_operator_link(self, session):
+ email = self.app.config.operator_email
+
+ if email:
+ return "<a href=\"mailto:%s\">site operator</a>" % email
+ else:
+ return "site operator"
+
+ def render_login_invalid(self, session):
+ if self.__login_invalid.get(session):
+ return self.get_string("login_invalid")
+
+ class Name(StringField):
+ def render_title(self, session):
+ return "User Name"
+
+ class Password(PasswordField):
+ def render_title(self, session):
+ return "Password"
+
+ class Submit(FormButton):
+ def render_content(self, session):
+ return "Submit"
+
+class ChangePasswordForm(CuminFieldForm):
+ def __init__(self, app, name):
+ super(ChangePasswordForm, self).__init__(app, name)
+
+ self.__errors = self.Errors(app, "errors")
+ self.add_attribute(self.__errors)
+
+ self.__current = self.Current(app, "current")
+ self.add_field(self.__current)
+ self.__current.input.size = 20
+
+ self.__new0 = self.New0(app, "new0")
+ self.add_field(self.__new0)
+ self.__new0.input.size = 20
+
+ self.__new1 = self.New1(app, "new1")
+ self.add_field(self.__new1)
+ self.__new1.input.size = 20
+
+ def process_cancel(self, session):
+ branch = session.branch()
+ self.page.account.main.view.show(branch)
+ self.page.set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session):
+ curr = self.__current.get(session)
+ new0 = self.__new0.get(session)
+ new1 = self.__new1.get(session)
+
+ errors = self.validate(session)
+
+ subject = session.user_session.subject
+ crypted = subject.password
+
+ if crypt_password(curr, crypted) != crypted:
+ msg = "The current password you entered is incorrect"
+ self.__errors.get(session).append(msg)
+ errors.append(msg)
+
+ if new0 != new1:
+ msg = "The new passwords do not match"
+ self.__errors.get(session).append(msg)
+ errors.append(msg)
+
+ if not errors:
+ subject.password = crypt_password(new0)
+ subject.syncUpdate()
+
+ self.process_cancel(session)
+
+ def render_title(self, session):
+ return "Change Password"
+
+ def render_form_error(self, session):
+ errors = self.__errors.get(session)
+
+ if errors:
+ return "<ul class=\"errors\" style=\"margin:0; float:left;\"><li>" + \
+ ("</li><li>".join(errors)) + \
+ "</li></ul>"
+
+ class Current(PasswordField):
+ def render_title(self, session):
+ return "Current Password"
+
+ class New0(PasswordField):
+ def render_title(self, session):
+ return "New Password"
+
+ class New1(PasswordField):
+ def render_title(self, session):
+ return "Repeat New Password"
+
+ class Errors(Attribute):
+ def get_default(self, session):
+ return list()
Added: mgmt/trunk/cumin/python/cumin/account/main.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/main.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/account/main.strings 2009-06-08 16:06:37 UTC (rev 3432)
@@ -0,0 +1,128 @@
+[LoginPage.css]
+body.LoginPage {
+ background: #f7f7f7;
+ padding: 4em;
+}
+
+[LoginForm.css]
+form.LoginForm {
+ background: #fff;
+ width: 16em;
+ margin: 0 auto;
+ border: 1px solid #ddd;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+ padding: 2em;
+}
+
+form.LoginForm > h1 {
+ margin: 0 0 1em 0;
+}
+
+form.LoginForm h1 img {
+ vertical-align: -60%;
+ margin: 0 0.25em 0 0;
+}
+
+form.LoginForm input {
+ width: 12em;
+}
+
+form.LoginForm input.submit {
+ width: auto;
+}
+
+form.LoginForm > div.buttons {
+ margin: 1.5em 0 0 0;
+}
+
+form.LoginForm p.login_invalid {
+ color: red;
+}
+
+[LoginForm.html]
+<form id="{id}" class="LoginForm" method="post" action="?">
+ <h1><img src="resource?name=mrg-36.png"/> MRG Management</h1>
+
+ <p>Enter your user name and password to log in.</p>
+
+ <p>If you do not have an account or have trouble logging in, contact
+ the {operator_link}.</p>
+
+ {login_invalid}
+
+ {fields}
+
+ <div class="buttons">{submit}</div>
+
+ <div>{hidden_inputs}</div>
+</form>
+
+<script type="text/javascript">
+ $("{id}").elements[0].focus();
+
+</script>
+
+[LoginForm.login_invalid]
+<p class="login_invalid">The user name and password you entered do not
+match any account.</p>
+
+[AccountContainerView.html]
+<div id="head">
+ <div id="user">
+ Hi, {user_name}
+ <strong>·</strong>
+ <a id="account" onclick="wooly.clearUpdates()" href="{admin_href}">MRG Management</a>
+ <strong>·</strong>
+ <a id="logout" onclick="wooly.clearUpdates()" href="{logout_href}">Log Out</a>
+ </div>
+
+ <img id="logo" src="resource?name=rhlogo-32.png"/>
+
+</div>
+<div id="body">
+
+<div id="messages" style="display: {action_display};"><p title="close" onclick="cumin.hideActions()">x</p>{actions}</div>
+ {heartbeat}
+
+{content}</div>
+
+<div id="foot"/>
+
+[AccountView.html]
+<div class="oblock">
+ {heading}
+
+ <ul class="TabbedModeSet tabs">{tabs}</ul>
+ <div class="TabbedModeSet mode">{content}</div>
+</div>
+
+[AccountTab.html]
+<ul class="actions">
+ <a class="nav" href="{change_password_href}">Change Password</a>
+</ul>
+
+[MyGridJobs.html]
+<form id="{id}" method="post" action="?">
+<div class="rfloat">{phase}</div>
+Jobs submitted by {user}
+
+ <div class="sactions" style="clear:right;">
+ <h2>Act on Selected Jobs:</h2>
+ {hold} {release} {remove}
+ </div>
+
+ <table class="mobjects">
+ <thead>
+ <tr>
+ <th class="setnav" colspan="{column_count}">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
+ </table>
+ <div>{hidden_inputs}</div>
+</form>
Copied: mgmt/trunk/cumin/python/cumin/account/user.py (from rev 3426, mgmt/trunk/cumin/python/cumin/user.py)
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/user.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/account/user.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -0,0 +1,50 @@
+from wooly import *
+from wooly.widgets import *
+from wooly.resources import *
+from time import sleep
+from threading import Thread, Event
+from datetime import datetime, timedelta
+from crypt import crypt
+from qpid.datatypes import uuid4
+
+from cumin.widgets import *
+from cumin.util import *
+
+strings = StringCatalog(__file__)
+
+log = logging.getLogger("cumin.user")
+
+class UserSession(object):
+ def __init__(self, app, subject):
+ self.app = app
+ self.subject = subject
+ self.id = str(uuid4())
+ self.created = datetime.now()
+
+ self.app.user_sessions_by_id[self.id] = self
+
+ def delete(self):
+ del self.app.user_sessions_by_id[self.id]
+
+class UserSessionExpireThread(Thread):
+ def __init__(self, app):
+ super(UserSessionExpireThread, self).__init__()
+
+ self.app = app
+ self.setDaemon(True)
+
+ def run(self):
+ while True:
+ self.expire_sessions()
+ sleep(60)
+
+ def expire_sessions(self):
+ when = datetime.now() - timedelta(hours=2)
+ count = 0
+
+ for session in self.app.user_sessions_by_id.values():
+ if session.created < when:
+ session.delete()
+ count += 1
+
+ log.info("Expired %i user sessions", count)
Property changes on: mgmt/trunk/cumin/python/cumin/account/user.py
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mgmt/trunk/cumin/python/cumin/account/user.strings (from rev 3426, mgmt/trunk/cumin/python/cumin/user.strings)
===================================================================
Property changes on: mgmt/trunk/cumin/python/cumin/account/user.strings
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: mgmt/trunk/cumin/python/cumin/messaging/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/queue.py 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/messaging/queue.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -803,7 +803,7 @@
return self.frame.get_args(session)
def process_submit(self, session, binding):
- log.info("Removing binding %s" % binding)
+ log.info("Removing binding %s", binding)
self.process_cancel(session, binding)
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/page.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -59,9 +59,6 @@
self.view = HomeView(app, "view")
self.add_mode(self.view)
- self.change_password = ChangePasswordForm(app, "password")
- self.add_mode(self.change_password)
-
self.mservers_add = ManagementServerSetAdd(app, "mserversadd")
self.add_mode(self.mservers_add)
@@ -79,8 +76,6 @@
self.add_child(heading)
self.add_tab(self.OverviewTab(app, "over"))
- self.add_tab(self.MyGridJobs(app, "jobs"))
- self.add_tab(self.AccountTab(app, "acct"))
self.add_tab(ManagementServerSet(app, "servers"))
def render_change_password_href(self, session):
@@ -121,36 +116,3 @@
if count == 0:
return super(HomeView.OverviewTab.ManagementServerNotice,
self).do_render(session)
-
- class AccountTab(ActionSet):
- def render_title(self, session):
- return "Your Account"
-
- def render_change_password_href(self, session):
- branch = session.branch()
- self.frame.change_password.show(branch)
- return branch.marshal()
-
- class MyGridJobs(JobTab):
- def render_title(self, session):
- return "Your Grid Jobs %s" % fmt_count(self.get_item_count(session))
-
- def render_sql_where(self, session, *args):
- if hasattr(session, "user_session"):
- user = session.user_session.subject.name
- else:
- user = ""
- elems = list()
- elems.append("b.name like '%s%s'" % (user, "%"))
- elems.append(self.get_phase_sql(session))
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session, *args):
- pass
-
- def get_visible_columns(self, session):
- return self.get_request_visible_columns(session, ["custom_group", "scheduler"])
-
- def render_user(self, session, *args):
- if hasattr(session, "user_session"):
- return session.user_session.subject.name
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2009-06-08 16:06:37 UTC (rev 3432)
@@ -76,11 +76,6 @@
tab above to add a new server.
</div>
-[AccountTab.html]
-<ul class="actions">
- <a class="nav" href="{change_password_href}">Change Password</a>
-</ul>
-
[MessagingView.html]
<div class="oblock">
{heading}
@@ -104,28 +99,3 @@
<ul class="TabbedModeSet tabs">{tabs}</ul>
<div class="TabbedModeSet mode">{content}</div>
</div>
-
-[MyGridJobs.html]
-<form id="{id}" method="post" action="?">
-<div class="rfloat">{phase}</div>
-Jobs submitted by {user}
-
- <div class="sactions" style="clear:right;">
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
-
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
Deleted: mgmt/trunk/cumin/python/cumin/user.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/user.py 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/user.py 2009-06-08 16:06:37 UTC (rev 3432)
@@ -1,229 +0,0 @@
-from wooly import *
-from wooly.widgets import *
-from wooly.resources import *
-from time import sleep
-from threading import Thread, Event
-from random import randint
-from datetime import datetime, timedelta
-from crypt import crypt
-from qpid.datatypes import uuid4
-
-from widgets import *
-from util import *
-
-from wooly import Session
-
-strings = StringCatalog(__file__)
-
-log = logging.getLogger("cumin.user")
-
-class UserSession(object):
- def __init__(self, app, subject):
- self.app = app
- self.subject = subject
- self.id = str(uuid4())
- self.created = datetime.now()
-
- self.app.user_sessions_by_id[self.id] = self
-
- def delete(self):
- del self.app.user_sessions_by_id[self.id]
-
-class UserSessionExpireThread(Thread):
- def __init__(self, app):
- super(UserSessionExpireThread, self).__init__()
-
- self.app = app
- self.setDaemon(True)
-
- def run(self):
- while True:
- self.expire_sessions()
- sleep(60)
-
- def expire_sessions(self):
- when = datetime.now() - timedelta(hours=2)
- count = 0
-
- for session in self.app.user_sessions_by_id.values():
- if session.created < when:
- session.delete()
- count += 1
-
- log.debug("Expired %i user sessions", count)
-
-class LoginPage(HtmlPage):
- def __init__(self, app, name):
- super(LoginPage, self).__init__(app, name)
-
- self.html_class = LoginPage.__name__
-
- self.logout = BooleanParameter(app, "logout")
- self.add_parameter(self.logout)
-
- self.origin = self.Origin(app, "origin")
- self.add_parameter(self.origin)
-
- form = LoginForm(app, "form")
- self.add_child(form)
-
- def do_process(self, session):
- if self.logout.get(session):
- #id = session.get_cookie("session")
- session.expire_cookie("session")
-
- super(LoginPage, self).do_process(session)
-
- def render_title(self, session):
- return "Log In"
-
- class Origin(Parameter):
- def get_default(self, session):
- return Session(self.app.main_page).marshal()
-
-class LoginForm(FieldForm):
- def __init__(self, app, name):
- super(LoginForm, self).__init__(app, name)
-
- self.__login_invalid = Attribute(app, "login_invalid")
- self.add_attribute(self.__login_invalid)
-
- self.__name = self.Name(app, "name")
- self.add_field(self.__name)
- self.__name.input.size = 20
-
- self.__password = self.Password(app, "password")
- self.add_field(self.__password)
- self.__password.input.size = 20
-
- self.__submit = self.Submit(app, "submit")
- self.add_child(self.__submit)
-
- def do_process(self, session):
- if self.__submit.get(session):
- name = self.__name.get(session)
- password = self.__password.get(session)
-
- errors = self.validate(session)
-
- if not errors:
- try:
- user = Subject.selectBy(name=name)[0]
- except IndexError:
- self.__login_invalid.set(session, True)
- return
-
- crypted = user.password
-
- if crypted and crypt(password, crypted) == crypted:
- # You're in!
-
- usess = UserSession(self.app, user)
- session.set_cookie("session", usess.id)
-
- url = self.page.origin.get(session)
-
- self.page.set_redirect_url(session, url)
- else:
- self.__login_invalid.set(session, True)
-
- def render_operator_link(self, session):
- email = self.app.config.operator_email
-
- if email:
- return "<a href=\"mailto:%s\">site operator</a>" % email
- else:
- return "site operator"
-
- def render_login_invalid(self, session):
- if self.__login_invalid.get(session):
- return self.get_string("login_invalid")
-
- class Name(StringField):
- def render_title(self, session):
- return "User Name"
-
- class Password(PasswordField):
- def render_title(self, session):
- return "Password"
-
- class Submit(FormButton):
- def render_content(self, session):
- return "Submit"
-
-class ChangePasswordForm(CuminFieldForm):
- def __init__(self, app, name):
- super(ChangePasswordForm, self).__init__(app, name)
-
- self.__errors = self.Errors(app, "errors")
- self.add_attribute(self.__errors)
-
- self.__current = self.Current(app, "current")
- self.add_field(self.__current)
- self.__current.input.size = 20
-
- self.__new0 = self.New0(app, "new0")
- self.add_field(self.__new0)
- self.__new0.input.size = 20
-
- self.__new1 = self.New1(app, "new1")
- self.add_field(self.__new1)
- self.__new1.input.size = 20
-
- def process_cancel(self, session):
- branch = session.branch()
- self.page.main.home.view.show(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
- def process_submit(self, session):
- curr = self.__current.get(session)
- new0 = self.__new0.get(session)
- new1 = self.__new1.get(session)
-
- errors = self.validate(session)
-
- subject = session.user_session.subject
- crypted = subject.password
-
- if crypt_password(curr, crypted) != crypted:
- msg = "The current password you entered is incorrect"
- self.__errors.get(session).append(msg)
- errors.append(msg)
-
- if new0 != new1:
- msg = "The new passwords do not match"
- self.__errors.get(session).append(msg)
- errors.append(msg)
-
- if not errors:
- subject.password = crypt_password(new0)
- subject.syncUpdate()
-
- self.process_cancel(session)
-
- def render_title(self, session):
- return "Change Password"
-
- def render_form_error(self, session):
- errors = self.__errors.get(session)
-
- if errors:
- return "<ul class=\"errors\" style=\"margin:0; float:left;\"><li>" + \
- ("</li><li>".join(errors)) + \
- "</li></ul>"
-
- class Current(PasswordField):
- def render_title(self, session):
- return "Current Password"
-
- class New0(PasswordField):
- def render_title(self, session):
- return "New Password"
-
- class New1(PasswordField):
- def render_title(self, session):
- return "Repeat New Password"
-
- class Errors(Attribute):
- def get_default(self, session):
- return list()
Deleted: mgmt/trunk/cumin/python/cumin/user.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/user.strings 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/user.strings 2009-06-08 16:06:37 UTC (rev 3432)
@@ -1,68 +0,0 @@
-[LoginPage.css]
-body.LoginPage {
- background: #f7f7f7;
- padding: 4em;
-}
-
-[LoginForm.css]
-form.LoginForm {
- background: #fff;
- width: 16em;
- margin: 0 auto;
- border: 1px solid #ddd;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
- padding: 2em;
-}
-
-form.LoginForm > h1 {
- margin: 0 0 1em 0;
-}
-
-form.LoginForm h1 img {
- vertical-align: -60%;
- margin: 0 0.25em 0 0;
-}
-
-form.LoginForm input {
- width: 12em;
-}
-
-form.LoginForm input.submit {
- width: auto;
-}
-
-form.LoginForm > div.buttons {
- margin: 1.5em 0 0 0;
-}
-
-form.LoginForm p.login_invalid {
- color: red;
-}
-
-[LoginForm.html]
-<form id="{id}" class="LoginForm" method="post" action="?">
- <h1><img src="resource?name=mrg-36.png"/> MRG Management</h1>
-
- <p>Enter your user name and password to log in.</p>
-
- <p>If you do not have an account or have trouble logging in, contact
- the {operator_link}.</p>
-
- {login_invalid}
-
- {fields}
-
- <div class="buttons">{submit}</div>
-
- <div>{hidden_inputs}</div>
-</form>
-
-<script type="text/javascript">
- $("{id}").elements[0].focus();
-
-</script>
-
-[LoginForm.login_invalid]
-<p class="login_invalid">The user name and password you entered do not
-match any account.</p>
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2009-06-08 15:28:59 UTC (rev 3431)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2009-06-08 16:06:37 UTC (rev 3432)
@@ -163,6 +163,8 @@
<div id="user">
Hi, {user_name}
<strong>·</strong>
+ <a id="account" onclick="wooly.clearUpdates()" href="{account_href}">Your Account</a>
+ <strong>·</strong>
<a id="logout" onclick="wooly.clearUpdates()" href="{logout_href}">Log Out</a>
</div>
15 years, 9 months
rhmessaging commits: r3431 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 11:28:59 -0400 (Mon, 08 Jun 2009)
New Revision: 3431
Modified:
mgmt/trunk/cumin/python/cumin/grid/job.py
mgmt/trunk/cumin/python/cumin/grid/job.strings
Log:
For the job query, restore the join on stats; but only when needed.
Modified: mgmt/trunk/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/job.py 2009-06-08 14:47:22 UTC (rev 3430)
+++ mgmt/trunk/cumin/python/cumin/grid/job.py 2009-06-08 15:28:59 UTC (rev 3431)
@@ -93,6 +93,10 @@
elems.append("s.pool = %(pool)s")
return "where %s" % " and ".join(elems)
+ def render_stats_join(self, session, *args):
+ phase = self.phase.get(session)
+ return (phase == 'c') and "left outer join job_stats as c on c.id = j.stats_curr_id" or ""
+
def get_sql_values(self, session, *args):
pool = args[0]
return {"pool": pool.id}
Modified: mgmt/trunk/cumin/python/cumin/grid/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/job.strings 2009-06-08 14:47:22 UTC (rev 3430)
+++ mgmt/trunk/cumin/python/cumin/grid/job.strings 2009-06-08 15:28:59 UTC (rev 3431)
@@ -17,6 +17,7 @@
j.cmd,
j.qmf_delete_time
from job as j
+{stats_join}
inner join scheduler as s on s.id = j.scheduler_id
inner join submitter as b on b.id = j.submitter_id
{sql_where}
@@ -34,6 +35,7 @@
[JobSet.count_sql]
select count(1)
from job as j
+{stats_join}
inner join scheduler as s on s.id = j.scheduler_id
inner join submitter as b on b.id = j.submitter_id
{sql_where}
15 years, 9 months
rhmessaging commits: r3430 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 10:47:22 -0400 (Mon, 08 Jun 2009)
New Revision: 3430
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Process the heartbeat widget to avoid "unprocessed widget" warning.
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-06-08 14:45:25 UTC (rev 3429)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-06-08 14:47:22 UTC (rev 3430)
@@ -46,6 +46,7 @@
return list()
class CuminHeartBeat(Widget):
+ """ the intent is to add stuff here """
pass
class CuminMainView(TabbedModeSet):
@@ -57,11 +58,12 @@
self.actions = ActionInvocationSet(app, "actions")
self.add_child(self.actions)
- heartbeat = CuminHeartBeat(app, "heartbeat")
- self.add_child(heartbeat)
+ self.heartbeat = CuminHeartBeat(app, "heartbeat")
+ self.add_child(self.heartbeat)
def do_process(self, session, *args):
self.actions.process(session)
+ self.heartbeat.process(session)
super(CuminMainView, self).do_process(session, *args)
@@ -90,6 +92,9 @@
return lsess.marshal()
+ def render_account_href(self, session):
+ return Session(self.app.account_page).marshal()
+
class CuminFrame(Frame, ModeSet):
def __init__(self, app, name):
super(CuminFrame, self).__init__(app, name)
15 years, 9 months
rhmessaging commits: r3429 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 10:45:25 -0400 (Mon, 08 Jun 2009)
New Revision: 3429
Modified:
mgmt/trunk/cumin/python/cumin/charts.py
Log:
Pass legend position to page as an array since tuples don't eval() properly in javascript.
Modified: mgmt/trunk/cumin/python/cumin/charts.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/charts.py 2009-06-08 14:35:02 UTC (rev 3428)
+++ mgmt/trunk/cumin/python/cumin/charts.py 2009-06-08 14:45:25 UTC (rev 3429)
@@ -239,7 +239,7 @@
cr.stroke()
width, height = cr.text_extents(title)[2:4]
- title_xy[color] = (width, y)
+ title_xy[color] = [width, y]
return title_xy
def plot_frame(self, color=(0.8, 0.8, 0.8)):
15 years, 9 months
rhmessaging commits: r3428 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 10:35:02 -0400 (Mon, 08 Jun 2009)
New Revision: 3428
Modified:
mgmt/trunk/cumin/python/cumin/charts.py
mgmt/trunk/cumin/python/cumin/stat.py
Log:
Better association of chart points and colors.
Round chart points before sending to browser to cut down on traffic.
Modified: mgmt/trunk/cumin/python/cumin/charts.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/charts.py 2009-06-08 13:57:10 UTC (rev 3427)
+++ mgmt/trunk/cumin/python/cumin/charts.py 2009-06-08 14:35:02 UTC (rev 3428)
@@ -170,7 +170,7 @@
cr.line_to(x, y)
if x < 0:
break
- points.append([int(x), int(y), value])
+ points.append([int(x), int(y), "%.2f" % value])
cr.stroke()
return points
@@ -217,7 +217,7 @@
def plot_legend(self, titles, colors):
cr = Context(self.surface)
cr.set_line_width(1.5)
- title_xy = list()
+ title_xy = dict()
for i, item in enumerate(zip(titles, colors)):
title, color = item
@@ -239,7 +239,7 @@
cr.stroke()
width, height = cr.text_extents(title)[2:4]
- title_xy.append([width, y])
+ title_xy[color] = (width, y)
return title_xy
def plot_frame(self, color=(0.8, 0.8, 0.8)):
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-06-08 13:57:10 UTC (rev 3427)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-06-08 14:35:02 UTC (rev 3428)
@@ -418,16 +418,16 @@
max_samples = int(width * 1.5)
return max(int(duration / max_samples), 1)
- def render_samples(self, session, recent, colors):
+ def render_samples(self, session, recent):
c = {(1,0,0): "red", (0,0,1): "blue", (0,1,0): "green"}
cached_samples, title_xy = self.get_cached_samples(session, recent)
if cached_samples:
rets = dict()
- for stat, color, xy in zip(cached_samples, colors, title_xy):
+ for stat in cached_samples:
ret = dict()
- ret["color"] = c[color]
- ret["points"] = cached_samples[stat]
- ret["xy"] = xy
+ ret["color"] = c[cached_samples[stat][1]]
+ ret["points"] = cached_samples[stat][0]
+ ret["xy"] = title_xy[cached_samples[stat][1]]
rets[stat.name] = ret
return str(rets)
@@ -443,7 +443,7 @@
recent = stat.recent(object)
if self.samples.get(session):
- return self.render_samples(session, recent, colors)
+ return self.render_samples(session, recent)
if recent:
cached_png = self.get_cached(session, recent)
@@ -517,7 +517,7 @@
points = dict()
for stat, color in zip(stats, colors):
- points[stat] = chart.plot_values(samples[stat], color=color)
+ points[stat] = (chart.plot_values(samples[stat], color=color), color)
for stat, color in zip(stats, colors):
chart.plot_ticks(samples[stat], color=color)
15 years, 9 months
rhmessaging commits: r3427 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-06-08 09:57:10 -0400 (Mon, 08 Jun 2009)
New Revision: 3427
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
Log:
Removed some debugging prints.
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-06-05 19:50:53 UTC (rev 3426)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-06-08 13:57:10 UTC (rev 3427)
@@ -204,10 +204,8 @@
if name in self.__files:
file = self.__files[name]["file"]
file.seek(0)
- print "found current %s" % name
return (file.read(), self.__files[name]["cookie"])
else:
- print "MISSED %s" % name
return (None, None)
@@ -215,12 +213,10 @@
if name not in self.__files:
#file = tempfile.TemporaryFile()
file = cStringIO.StringIO()
- print "added %s" % name
else:
file = self.__files[name]["file"]
file.seek(0)
file.truncate()
- print "re-used %s" % name
self.__files[name] = {"time": datetime.now(), "file": file, "cookie": args}
return file
@@ -297,11 +293,9 @@
# determine if cached copy is recent enough
cached_png, args = self.get_cached(session, zl)
if cached_png:
- #print "returning cached copy of png at zoom %i, x %i, y %i" % (zl, zx, zy)
self.set_cookie(session, args)
return cached_png
- #print "starting rendering png at zoom %i, x %i, y %i" % (zl, zx, zy)
map = HeatMapChart(self.max_width, self.max_width)
slot_info = object.get_info(session, self.id.get(session))
@@ -318,7 +312,6 @@
writer = Writer()
map.write(writer)
- #print "done rendering png at zoom %i, x %i, y %i" % (zl, zx, zy)
return writer.to_string()
def get_cached(self, session, zl):
15 years, 9 months
rhmessaging commits: r3426 - store/trunk/cpp/tests/python_tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-06-05 15:50:53 -0400 (Fri, 05 Jun 2009)
New Revision: 3426
Removed:
store/trunk/cpp/tests/python_tests/cluster_basic.py
Modified:
store/trunk/cpp/tests/python_tests/__init__.py
Log:
Removed cluster python test in favor of using the qpid test as an installable test which can use persistence if the correct environment exists.
Modified: store/trunk/cpp/tests/python_tests/__init__.py
===================================================================
--- store/trunk/cpp/tests/python_tests/__init__.py 2009-06-05 19:35:41 UTC (rev 3425)
+++ store/trunk/cpp/tests/python_tests/__init__.py 2009-06-05 19:50:53 UTC (rev 3426)
@@ -21,5 +21,4 @@
#
# The GNU Lesser General Public License is available in the file COPYING.
-from cluster_basic import *
from flow_to_disk import *
Deleted: store/trunk/cpp/tests/python_tests/cluster_basic.py
===================================================================
--- store/trunk/cpp/tests/python_tests/cluster_basic.py 2009-06-05 19:35:41 UTC (rev 3425)
+++ store/trunk/cpp/tests/python_tests/cluster_basic.py 2009-06-05 19:50:53 UTC (rev 3426)
@@ -1,110 +0,0 @@
-# Copyright (c) 2009 Red Hat, Inc.
-#
-# This file is part of the Qpid async store library msgstore.so.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-# USA
-#
-# The GNU Lesser General Public License is available in the file COPYING.
-
-import os
-import signal
-from qpid.testlib import TestBaseCluster
-
-class BasicClusterTests(TestBaseCluster):
- """Basic cluster with async store tests"""
-
- _runClusterTests = os.getenv("RUN_CLUSTER_TESTS")
-
- def test_Cluster_01_SingleClusterInitialization(self):
- if self._runClusterTests == None:
- print "skipped"
- return
- try:
- clusterName = "test_Cluster_01_SingleClusterInitialization"
- self.createCheckCluster(clusterName, 5)
- self.checkNumBrokers(5)
- self.stopCheckCluster(clusterName)
- except:
- self.killAllClusters()
- raise
-
- def test_Cluster_02_MultipleClusterInitialization(self):
- if self._runClusterTests == None:
- print "skipped"
- return
- try:
- for i in range(0, 5):
- clusterName = "test_Cluster_02_MultipleClusterInitialization.%d" % i
- self.createCluster(clusterName, 5)
- self.checkNumBrokers(25)
- self.killCluster("test_Cluster_02_MultipleClusterInitialization.2")
- self.checkNumBrokers(20)
- self.stopCheckAll()
- except:
- self.killAllClusters()
- raise
-
- def test_Cluster_03_SingleClusterAddRemoveNodes(self):
- if self._runClusterTests == None:
- print "skipped"
- return
- try:
- clusterName = "test_Cluster_03_SingleClusterAddRemoveNodes"
- self.createCheckCluster(clusterName, 3)
- for i in range(4,9):
- self.createClusterNode(i, clusterName)
- self.checkNumClusterBrokers(clusterName, 8)
- self.killNode(2, clusterName)
- self.killNode(5, clusterName)
- self.killNode(6, clusterName)
- self.checkNumClusterBrokers(clusterName, 5)
- self.createClusterNode(9, clusterName)
- self.createClusterNode(10, clusterName)
- self.checkNumClusterBrokers(clusterName, 7)
- self.stopCheckAll()
- except:
- self.killAllClusters()
- raise
-
- def test_Cluster_04_SingleClusterRemoveRestoreNodes(self):
- if self._runClusterTests == None:
- print "skipped"
- return
- try:
- clusterName = "test_Cluster_04_SingleClusterRemoveRestoreNodes"
- self.createCheckCluster(clusterName, 6)
- self.checkNumBrokers(6)
- self.killNode(1, clusterName)
- self.killNode(3, clusterName)
- self.killNode(4, clusterName)
- self.checkNumBrokers(3)
- self.createClusterNode(1, clusterName)
- self.createClusterNode(3, clusterName)
- self.createClusterNode(4, clusterName)
- self.checkNumClusterBrokers(clusterName, 6)
- self.killNode(2, clusterName)
- self.killNode(3, clusterName)
- self.killNode(4, clusterName)
- self.checkNumBrokers(3)
- self.createClusterNode(2, clusterName)
- self.createClusterNode(3, clusterName)
- self.createClusterNode(4, clusterName)
- self.checkNumClusterBrokers(clusterName, 6)
- self.stopCheckAll()
- except:
- self.killAllClusters()
- raise
-
15 years, 9 months