r4861 - trunk/wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-30 14:23:14 +0000 (Thu, 30 Jun 2011)
New Revision: 4861
Modified:
trunk/wooly/resources/wooly.js
Log:
Addressing BZ https://bugzilla.redhat.com/show_bug.cgi?id=717953 by removing the else clause that was adding text to the browser console.
Modified: trunk/wooly/resources/wooly.js
===================================================================
--- trunk/wooly/resources/wooly.js 2011-06-28 12:48:08 UTC (rev 4860)
+++ trunk/wooly/resources/wooly.js 2011-06-30 14:23:14 UTC (rev 4861)
@@ -361,9 +361,7 @@
} else {
oldElem.parentNode.removeChild(oldElem);
}
- } else {
- wooly.log("Element '" + id + "' not found");
- }
+ } // end if (oldElem)
// find and execute any javascript
executeJS(child);
}
12 years, 9 months
r4860 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-28 12:48:08 +0000 (Tue, 28 Jun 2011)
New Revision: 4860
Modified:
trunk/cumin/python/cumin/widgets.strings
Log:
Adding a helpful comment to the page update code.
Modified: trunk/cumin/python/cumin/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/widgets.strings 2011-06-27 20:01:48 UTC (rev 4859)
+++ trunk/cumin/python/cumin/widgets.strings 2011-06-28 12:48:08 UTC (rev 4860)
@@ -150,7 +150,7 @@
cumin.expireIntervalUpdate();
cumin.set_updated(true);
}
- }, 30*60*1000);
+ }, 30*60*1000); // The page updates will last for 30 minutes before the "resume updates" button appears
};
};
cumin.expireIntervalUpdate();
12 years, 9 months
r4859 - in trunk: cumin/python/cumin/account wooly/python/wooly wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-27 20:01:48 +0000 (Mon, 27 Jun 2011)
New Revision: 4859
Modified:
trunk/cumin/python/cumin/account/widgets.strings
trunk/wooly/python/wooly/pages.py
trunk/wooly/resources/wooly.js
Log:
Addressing BZ 707576 by changing UpdatePage do_process to handle the possibility of a redirect. Also, changing the wooly javascript that handles the page updates to look for an indication of needing to be redirected to the login page and redirecting as necessary.
Modified: trunk/cumin/python/cumin/account/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/account/widgets.strings 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/cumin/python/cumin/account/widgets.strings 2011-06-27 20:01:48 UTC (rev 4859)
@@ -67,6 +67,7 @@
<div>{hidden_inputs}</div>
</form>
+<div style="display:none;visibility:hidden" id="loginpage_token"/>
<script type="text/javascript">
$("{id}").elements[0].focus();
Modified: trunk/wooly/python/wooly/pages.py
===================================================================
--- trunk/wooly/python/wooly/pages.py 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/wooly/python/wooly/pages.py 2011-06-27 20:01:48 UTC (rev 4859)
@@ -211,7 +211,14 @@
return "no-cache"
def do_process(self, session):
- self.html_page.process(self.session.get(session))
+ # get the session for the main page
+ sess = self.session.get(session)
+ self.html_page.process(sess)
+ # if the main page set it's redirect attribute in it's session
+ redirect = self.html_page.redirect.get(sess)
+ # pass that redirect on to the the update page
+ if redirect:
+ self.redirect.set(session, redirect)
def render_widgets(self, session):
writer = Writer()
Modified: trunk/wooly/resources/wooly.js
===================================================================
--- trunk/wooly/resources/wooly.js 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/wooly/resources/wooly.js 2011-06-27 20:01:48 UTC (rev 4859)
@@ -329,13 +329,14 @@
this.updatePage = function(xml) {
var success = true;
+ var had_updates = false;
if(xml == null) {
success = false;
} else {
var child = xml.documentElement.firstChild;
-
while (child) {
if (child.nodeType == 1 && child.nodeName == "widget") {
+ had_updates = true;
var id = child.getAttribute("id");
var oldElem = document.getElementById(id);
@@ -369,6 +370,30 @@
child = child.nextSibling;
}
+
+ if(!had_updates) {
+ // if there were no updates in the returned XML,
+ // maybe it was because our session timed-out and
+ // we need to be sent to the login page
+ child = xml.documentElement.firstChild;
+ while(child) {
+ if(child.nodeType == 1) {
+ if(child.nodeName == "body") {
+ body = child.firstChild;
+ while(body) {
+ if(body.nodeType == 1) {
+ if(body.getAttribute("id") == "loginpage_token") {
+ document.location.href = '/login.html';
+ }
+ }
+ body = body.nextSibling;
+ }
+ }
+ }
+ child = child.nextSibling;
+ }
+ }
+
}
var len = wooly.pageUpdateListeners.length;
12 years, 10 months
r4858 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-27 16:09:19 +0000 (Mon, 27 Jun 2011)
New Revision: 4858
Modified:
trunk/cumin/python/cumin/task.py
Log:
For BZ 707576, handling an exception that pops-up when there is no valid session.
Modified: trunk/cumin/python/cumin/task.py
===================================================================
--- trunk/cumin/python/cumin/task.py 2011-06-24 19:04:30 UTC (rev 4857)
+++ trunk/cumin/python/cumin/task.py 2011-06-27 16:09:19 UTC (rev 4858)
@@ -197,8 +197,11 @@
self.add_child(self.item_widget)
def get_items(self, session):
- login = session.client_session.attributes["login_session"]
- return [x for x in login.task_invocations if not x.dismissed]
+ items = []
+ if("login_session" in session.client_session.attributes.keys() ):
+ login = session.client_session.attributes["login_session"]
+ items = [x for x in login.task_invocations if not x.dismissed]
+ return items
def do_process(self, session):
super(TaskInvocationSet, self).do_process(session)
12 years, 10 months
r4857 - in branches/sage_addition: . cumin sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-24 19:04:30 +0000 (Fri, 24 Jun 2011)
New Revision: 4857
Added:
branches/sage_addition/sage/COPYING
branches/sage_addition/sage/LICENSE
branches/sage_addition/sage/Makefile
Modified:
branches/sage_addition/Makefile
branches/sage_addition/cumin/Makefile
Log:
Add install rules for sage, Makefile for sage
Modified: branches/sage_addition/Makefile
===================================================================
--- branches/sage_addition/Makefile 2011-06-24 18:30:35 UTC (rev 4856)
+++ branches/sage_addition/Makefile 2011-06-24 19:04:30 UTC (rev 4857)
@@ -19,3 +19,4 @@
$(MAKE) clean -C rosemary
$(MAKE) clean -C mint
$(MAKE) clean -C cumin
+ $(MAKE) clean -C sage
Modified: branches/sage_addition/cumin/Makefile
===================================================================
--- branches/sage_addition/cumin/Makefile 2011-06-24 18:30:35 UTC (rev 4856)
+++ branches/sage_addition/cumin/Makefile 2011-06-24 19:04:30 UTC (rev 4857)
@@ -38,7 +38,8 @@
bin/install-python-code ../wooly/python ${CUMIN_HOME}/python
bin/install-python-code ../rosemary/python ${CUMIN_HOME}/python
bin/install-python-code ../mint/python ${CUMIN_HOME}/python
- bin/install-python-code ../parsley/python ${CUMIN_HOME}/python
+ bin/install-python-code ../parsley/python ${CUMIN_HOME}/python
+ bin/install-python-code ../sage/python ${CUMIN_HOME}/python
find ${CUMIN_HOME} -type d
clean-version:
Added: branches/sage_addition/sage/COPYING
===================================================================
--- branches/sage_addition/sage/COPYING (rev 0)
+++ branches/sage_addition/sage/COPYING 2011-06-24 19:04:30 UTC (rev 4857)
@@ -0,0 +1,15 @@
+Copyright (C) 2007 Red Hat Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Added: branches/sage_addition/sage/LICENSE
===================================================================
--- branches/sage_addition/sage/LICENSE (rev 0)
+++ branches/sage_addition/sage/LICENSE 2011-06-24 19:04:30 UTC (rev 4857)
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
Added: branches/sage_addition/sage/Makefile
===================================================================
--- branches/sage_addition/sage/Makefile (rev 0)
+++ branches/sage_addition/sage/Makefile 2011-06-24 19:04:30 UTC (rev 4857)
@@ -0,0 +1,21 @@
+.PHONY: build install clean
+
+include ../etc/Makefile.common
+
+name := sage
+
+lib := ${PYTHON_LIB_DIR}/${name}
+etc := ${ETC_DIR}/${name}
+doc := ${DOC_DIR}/${name}
+share := ${SHARE_DIR}/${name}
+
+build:
+ python -m compileall -x '/\.svn' -f python
+
+install: build
+ install -d ${lib}
+ install python/sage/*.py python/sage/*.pyc ${lib}
+ install -d ${doc}
+ install LICENSE COPYING ${doc}
+
+clean: clean-python-files
12 years, 10 months
r4856 - branches/sage_addition/sage/python/sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-24 18:30:35 +0000 (Fri, 24 Jun 2011)
New Revision: 4856
Added:
branches/sage_addition/sage/python/sage/util.py
Log:
Forgot to add util.py on initial commit
Added: branches/sage_addition/sage/python/sage/util.py
===================================================================
--- branches/sage_addition/sage/python/sage/util.py (rev 0)
+++ branches/sage_addition/sage/python/sage/util.py 2011-06-24 18:30:35 UTC (rev 4856)
@@ -0,0 +1,84 @@
+from time import time, sleep
+
+class CallSync(object):
+ '''
+ General callback object for asynchronous operations.
+ The 'get_completion' method will return a function that can be
+ used as a callback when an asynchronous operation completes.
+ To change the signature of the callback function, derive from
+ this class and override 'get_completion', changing the definition
+ of the 'completion' function.
+ The 'done' method can be polled to determine if the operation has completed.
+ '''
+ def __init__(self, log=None, default=None):
+ self.data = default
+ self.got_data = False
+ self.error = False
+ self.status = None
+ self.log = log
+
+ def get_completion(self):
+ # Note that because of the way binding is done in Python,
+ # 'self' inside 'completion' is bound to 'obj' when
+ # obj.get_completion is called and 'completion' is returned.
+ # This allows the code invoking the callback to call a simple
+ # function without an object reference (the reference is hidden
+ # inside the bound function).
+ def completion(status, data):
+ self.status = status
+ if (status == 0) or (status == "OK"):
+ self.data = data
+ self.got_data = True
+ else:
+ self.error = Exception(status)
+ msg = "CallSync: call returned with status of %s" % str(status)
+ if self.log is not None:
+ self.log.error(msg)
+ return completion
+
+ def done(self):
+ return self.got_data or self.error
+
+class SyncSet(object):
+ '''
+ Allows a caller to wait for completion of a set of asynchronous operations.
+ A collection of CallSync objects can be built up with calls to 'add_sync'.
+ 'do_wait' will return when all CallSync objects in the set have been completed
+ or 'timeout' seconds have elapsed.
+ '''
+ def __init__(self, log=None, timeout=5):
+ self.syncs = dict()
+ self.timeout = timeout
+ self.log = log
+
+ def add_sync(self, key, default=None):
+ sync = CallSync(self.log, default)
+ self.syncs[key] = sync
+ return sync
+
+ def do_wait(self):
+ def predicate(syncs):
+ done = 0
+ for k, sync in syncs.items():
+ if sync.done():
+ done += 1
+ return done == len(syncs)
+
+ # Wait for all syncs in the set to complete.
+ # syncs will contain results for each call passed back
+ # through the completion callback
+ wait(predicate, timeout=self.timeout, args=self.syncs)
+ return self.syncs
+
+def wait(predicate, timeout=30, args=None):
+ start = time()
+ while True:
+ if args is not None:
+ if predicate(args):
+ return True
+ else:
+ if predicate():
+ return True
+ if time() - start > timeout:
+ return False
+ sleep(1)
12 years, 10 months
r4855 - branches/sage_addition/cumin/python/cumin/messaging
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-24 18:05:27 +0000 (Fri, 24 Jun 2011)
New Revision: 4855
Modified:
branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py
branches/sage_addition/cumin/python/cumin/messaging/connection.py
branches/sage_addition/cumin/python/cumin/messaging/queue.py
Log:
Tie messaging operations specifically to the qmf operations object in
RemoteOperations, even though it would find the right method anyway
(unlikely that Aviary will provide messaging operations). This is more
clear, removes a possibility of name collision, and its more efficient.
Modified: branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py 2011-06-24 17:40:40 UTC (rev 4854)
+++ branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py 2011-06-24 18:05:27 UTC (rev 4855)
@@ -52,7 +52,7 @@
self.app.main_page.main.messaging.broker.view.show(session)
def do_invoke(self, invoc, link):
- self.app.remote.close(link, invoc.make_callback())
+ self.app.remote.qmf.close(link, invoc.make_callback())
class BrokerLinkSelector(ObjectSelector):
def __init__(self, app, name, vhost):
@@ -83,7 +83,7 @@
return "Remove broker link"
def do_invoke(self, invoc, link):
- self.app.remote.close(link, invoc.make_callback())
+ self.app.remote.qmf.close(link, invoc.make_callback())
class RouteSelector(ObjectSelector):
def __init__(self, app, name, link):
@@ -110,7 +110,7 @@
return "Remove"
def do_invoke(self, invoc, route):
- self.app.remote.close(route, invoc.make_callback())
+ self.app.remote.qmf.close(route, invoc.make_callback())
# XXX RouteFrame
@@ -122,7 +122,7 @@
self.app.main_page.main.messaging.broker.view.show(session)
def do_invoke(self, invoc, route):
- self.app.remote.close(route, invoc.make_callback())
+ self.app.remote.qmf.close(route, invoc.make_callback())
class LinkGeneralStatSet(StatSet):
def __init__(self, app, name, object):
@@ -225,7 +225,7 @@
def do_invoke(self, invoc, link, exchange, key, tag, dynamic, sync,
excludes):
- self.app.remote.bridge(link, link.durable, exchange.name, exchange.name,
+ self.app.remote.qmf.bridge(link, link.durable, exchange.name, exchange.name,
key, tag, excludes, False, False, dynamic, sync,
invoc.make_callback())
@@ -353,7 +353,7 @@
else:
mech = "PLAIN"
- self.app.remote.connect(obj, host, port, durable, mech, username,
+ self.app.remote.qmf.connect(obj, host, port, durable, mech, username,
password, transport, invoc.make_callback())
class BrokerLinkAddForm(ObjectFrameTaskForm):
Modified: branches/sage_addition/cumin/python/cumin/messaging/connection.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/connection.py 2011-06-24 17:40:40 UTC (rev 4854)
+++ branches/sage_addition/cumin/python/cumin/messaging/connection.py 2011-06-24 18:05:27 UTC (rev 4855)
@@ -50,7 +50,7 @@
raise Exception \
("Cannot close management connection %s" % conn.address)
- self.app.remote.close(conn, invoc.make_callback())
+ self.app.remote.qmf.close(conn, invoc.make_callback())
class ConnectionSelector(ObjectSelector):
def __init__(self, app, name, vhost):
@@ -96,7 +96,7 @@
raise Exception \
("Cannot close management connection %s" % conn.address)
- self.app.remote.close(conn, invoc.make_callback())
+ self.app.remote.qmf.close(conn, invoc.make_callback())
def get_item_content(self, session, item):
args = (item.remoteProcessName, item.remotePid)
@@ -168,14 +168,14 @@
return "Close"
def do_invoke(self, invoc, sess):
- self.app.remote.close(sess, invoc.make_callback())
+ self.app.remote.qmf.close(sess, invoc.make_callback())
class SessionDetach(ObjectFrameTask):
def get_title(self, session):
return "Detach"
def do_invoke(self, invoc, sess):
- self.app.remote.detach(sess, invoc.make_callback())
+ self.app.remote.qmf.detach(sess, invoc.make_callback())
class SessionSelector(ObjectSelector):
def __init__(self, app, name, conn):
@@ -205,11 +205,11 @@
return "Close"
def do_invoke(self, invoc, sess):
- self.app.remote.close(sess, invoc.make_callback())
+ self.app.remote.qmf.close(sess, invoc.make_callback())
class SessionSelectionDetach(ObjectSelectorTask):
def get_title(self, session):
return "Detach"
def do_invoke(self, invoc, sess):
- self.app.remote.detach(sess, invoc.make_callback())
+ self.app.remote.qmf.detach(sess, invoc.make_callback())
Modified: branches/sage_addition/cumin/python/cumin/messaging/queue.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/queue.py 2011-06-24 17:40:40 UTC (rev 4854)
+++ branches/sage_addition/cumin/python/cumin/messaging/queue.py 2011-06-24 18:05:27 UTC (rev 4855)
@@ -102,7 +102,7 @@
return "Purge"
def do_invoke(self, invoc, queue, count=0):
- self.app.remote.purge_queue(queue, count, invoc.make_callback())
+ self.app.remote.qmf.purge_queue(queue, count, invoc.make_callback())
class QueueBindingSelector(BindingSelector):
def __init__(self, app, name, queue):
@@ -361,7 +361,7 @@
return "Purge"
def do_invoke(self, invoc, queue, count=0):
- self.app.remote.purge_queue(queue, count, invoc.make_callback())
+ self.app.remote.qmf.purge_queue(queue, count, invoc.make_callback())
class QueuePurgeForm(ObjectFrameTaskForm):
def __init__(self, app, name, task):
@@ -607,7 +607,7 @@
cls = self.app.model.org_apache_qpid_broker.Broker
broker = cls.get_object_by_id(cursor, vhost._brokerRef_id)
- self.app.remote.queue_move_messages(broker, src, dst, count, invoc.make_callback())
+ self.app.remote.qmf.queue_move_messages(broker, src, dst, count, invoc.make_callback())
class MoveQueueMessages(MoveMessagesBase):
def __init__(self, app, frame):
12 years, 10 months
r4854 - in branches/sage_addition: . cumin/bin cumin/python/cumin cumin/python/cumin/grid cumin/python/cumin/messaging etc rosemary/python/rosemary sage sage/python sage/python/sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-06-24 17:40:40 +0000 (Fri, 24 Jun 2011)
New Revision: 4854
Added:
branches/sage_addition/sage/
branches/sage_addition/sage/python/
branches/sage_addition/sage/python/sage/
branches/sage_addition/sage/python/sage/__init__.py
branches/sage_addition/sage/python/sage/aviaryoperations.py
branches/sage_addition/sage/python/sage/qmfoperations.py
branches/sage_addition/sage/python/sage/remoteoperations.py
Modified:
branches/sage_addition/cumin/bin/cumin-web
branches/sage_addition/cumin/python/cumin/config.py
branches/sage_addition/cumin/python/cumin/grid/daemon.py
branches/sage_addition/cumin/python/cumin/grid/job.py
branches/sage_addition/cumin/python/cumin/grid/limit.py
branches/sage_addition/cumin/python/cumin/grid/negotiator.py
branches/sage_addition/cumin/python/cumin/grid/slot.py
branches/sage_addition/cumin/python/cumin/grid/submission.py
branches/sage_addition/cumin/python/cumin/main.py
branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py
branches/sage_addition/cumin/python/cumin/messaging/connection.py
branches/sage_addition/cumin/python/cumin/messaging/queue.py
branches/sage_addition/cumin/python/cumin/model.py
branches/sage_addition/cumin/python/cumin/objecttask.py
branches/sage_addition/cumin/python/cumin/qmfadapter.py
branches/sage_addition/cumin/python/cumin/task.py
branches/sage_addition/cumin/python/cumin/widgets.py
branches/sage_addition/etc/Profile.bash
branches/sage_addition/rosemary/python/rosemary/model.py
Log:
Create sage module to wrap RPC operations of various flavors.
Modify all existing QMF calls to use sage.RemoteOperations.
Removed unused classes found along the way.
Create stub for AviaryOperations, to be filled in later.
Modified: branches/sage_addition/cumin/bin/cumin-web
===================================================================
--- branches/sage_addition/cumin/bin/cumin-web 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/bin/cumin-web 2011-06-24 17:40:40 UTC (rev 4854)
@@ -88,6 +88,8 @@
if type(values.sasl_mech_list) == str:
cumin.sasl_mech_list = values.sasl_mech_list.upper()
+ cumin.use_aviary = values.use_aviary
+
cumin.debug = opts.debug
cumin.user = values.user
cumin.update_interval = values.update_interval
Modified: branches/sage_addition/cumin/python/cumin/config.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/config.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/config.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -163,6 +163,9 @@
param = ConfigParameter(self, "debug", bool)
param.default = False
+ param = ConfigParameter(self, "use-aviary", bool)
+ param.default = True
+
class CuminOptionParser(OptionParser,object):
def __init__(self):
OptionParser.__init__(self)
@@ -199,7 +202,7 @@
#
# # start your business
-_logging_modules = "cumin", "mint", "parsley", "rosemary", "wooly"
+_logging_modules = "cumin", "mint", "parsley", "rosemary", "wooly, sage"
def setup_initial_logging():
for name in _logging_modules:
Modified: branches/sage_addition/cumin/python/cumin/grid/daemon.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/daemon.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/daemon.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -31,7 +31,7 @@
master = self.get_master(system_name, invoc)
if master:
- self.qmf_call(invoc, master, "Start", self.target)
+ self.app.remote.start(master, self.target, invoc.make_callback())
class DaemonStop(DaemonFrameTask):
def __init__(self, app, frame, target):
@@ -49,7 +49,7 @@
master = self.get_master(system_name, invoc)
if master:
- self.qmf_call(invoc, master, "Stop", self.target)
+ self.app.remote.stop(master, self.target, invoc.make_callback())
class DaemonSelectorTask(ObjectSelectorTask):
def get_master(self, system_name, invoc):
@@ -81,7 +81,7 @@
master = self.get_master(system_name, invoc)
if master:
- self.qmf_call(invoc, master, "Start", self.target)
+ self.app.remote.start(master, self.target, invoc.make_callback())
class DaemonSelectionStop(DaemonSelectorTask):
def __init__(self, app, selector, target):
@@ -101,4 +101,4 @@
master = self.get_master(system_name, invoc)
if master:
- self.qmf_call(invoc, master, "Stop", self.target)
+ self.app.remote.stop(master, self.target, invoc.make_callback())
Modified: branches/sage_addition/cumin/python/cumin/grid/job.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/job.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/job.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -10,7 +10,6 @@
from cumin.widgets import StaticColumnHeader, Wait, CuminForm,\
EditablePropertyRenderer, StateSwitch
from cumin.util import JobStatusInfo, strip_string_quotes, parse
-from cumin.model import QmfCall
from cumin.formats import fmt_datetime, fmt_link
from wooly import Widget, Parameter, Attribute
@@ -291,9 +290,7 @@
def do_invoke(self, invoc, job_id, scheduler, reason):
assert self.method
- action = QmfCall(self.app)
- results = action.execute(scheduler, self.method, job_id, reason)
-
+ results = self.method(scheduler, job_id, reason)
if results.error:
raise results.error
@@ -312,7 +309,7 @@
def __init__(self, app, selector, verb):
super(JobSelectionHold, self).__init__(app, selector, verb)
- self.method = "HoldJob"
+ self.method = self.app.remote.hold_job
def get_title(self, session):
return "Hold"
@@ -321,7 +318,7 @@
def __init__(self, app, selector, verb):
super(JobSelectionRelease, self).__init__(app, selector, verb)
- self.method = "ReleaseJob"
+ self.method = self.app.remote.release_job
def get_title(self, session):
return "Release"
@@ -330,7 +327,7 @@
def __init__(self, app, selector, verb):
super(JobSelectionRemove, self).__init__(app, selector, verb)
- self.method = "RemoveJob"
+ self.method = self.app.remote.remove_job
def get_title(self, session):
return "Remove"
@@ -416,6 +413,7 @@
1: "integer",
2: "float",
3: "string"}
+
def __init__(self, app, name):
super(JobAdsSet, self).__init__(app, name)
@@ -434,9 +432,7 @@
id = self.frame.id.get(session)
job_server = self.frame.get_job_server(session, id)
job_id = self.frame.job_id.get(session)
-
- action = QmfCall(self.app, {'JobAd': {}})
- results = action.execute(job_server, "GetJobAd", job_id)
+ results = self.app.remote.get_job_ad(job_server, job_id, {'JobAd': {}})
error = results.error
self.qmf_error.set(session, error)
ads = results.data['JobAd']
@@ -507,9 +503,7 @@
id = self.frame.id.get(session)
job_server = self.frame.get_job_server(session, id)
job_id = self.frame.job_id.get(session)
-
- action = QmfCall(self.app, {'JobAd': {}})
- results = action.execute(job_server, "GetJobAd", job_id)
+ results = self.app.remote.get_job_ad(job_server, job_id, {'JobAd': {}})
error = results.error
self.qmf_error.set(session, error)
ads = results.data['JobAd']
@@ -799,8 +793,9 @@
job_id = self.frame.job_id.get(session)
file, start, end = self.get_file_args(session)
if file:
- action = QmfCall(self.app, {'Data': ""})
- result = action.execute(job_server, "FetchJobData", job_id, file, start, end)
+ result = self.app.remote.fetch_job_data(job_server,
+ job_id,
+ file, start, end, {'Data': ""})
if result.error:
return result.status
return escape_entity(result.data['Data'])
@@ -962,23 +957,6 @@
self.add_state("t", "Tail", "Display end of file")
self.add_state("h", "Head", "Display beginning of file")
-class JobAction(ObjectFrameTask):
- def __init__(self, app, frame, verb):
- super(JobAction, self).__init__(app, frame)
-
- self.form = JobActionForm(app, self.name, self, verb)
-
- self.method = None
-
- def do_enter(self, session, osession):
- job_id = self.frame.job_id.get(osession)
- self.form.job_id.set(session, job_id)
-
- def do_invoke(self, invoc, scheduler, job_id, reason):
- assert self.method
-
- self.qmf_call(invoc, scheduler, self.method, job_id, reason)
-
class JobActionForm(ObjectFrameTaskForm):
def __init__(self, app, name, task, verb):
super(JobActionForm, self).__init__(app, name, task)
@@ -1019,21 +997,35 @@
def render_title(self, session):
return "Reason"
+class JobAction(ObjectFrameTask):
+ def __init__(self, app, frame, verb):
+ super(JobAction, self).__init__(app, frame)
+
+ self.form = JobActionForm(app, self.name, self, verb)
+
+ def do_enter(self, session, osession):
+ job_id = self.frame.job_id.get(osession)
+ self.form.job_id.set(session, job_id)
+
+ def do_invoke(self, invoc, scheduler, job_id, reason):
+ raise Exception("oops, not implemented!")
+
class JobHold(JobAction):
def __init__(self, app, frame):
super(JobHold, self).__init__(app, frame, "held")
- self.method = "HoldJob"
+ def do_invoke(self, invoc, scheduler, job_id, reason):
+ self.app.remote.hold_job(scheduler, job_id, reason, invoc.make_callback())
def get_title(self, session):
return "Hold Job"
-
class JobRelease(JobAction):
def __init__(self, app, frame):
- super(JobRelease, self).__init__(app, frame, "held")
+ super(JobRelease, self).__init__(app, frame, "released")
- self.method = "ReleaseJob"
+ def do_invoke(self, invoc, scheduler, job_id, reason):
+ self.app.remote.release_job(scheduler, job_id, reason, invoc.make_callback())
def get_title(self, session):
return "Release Job"
@@ -1042,7 +1034,8 @@
def __init__(self, app, frame):
super(JobRemove, self).__init__(app, frame, "removed")
- self.method = "RemoveJob"
+ def do_invoke(self, invoc, scheduler, job_id, reason):
+ self.app.remote.remove_job(scheduler, job_id, reason, invoc.make_callback())
def get_title(self, session):
return "Remove Job"
@@ -1073,5 +1066,6 @@
return "Edit Ad"
def do_invoke(self, invoc, scheduler, job_id, name, value):
- self.qmf_call(invoc, scheduler, "SetJobAttribute", job_id, name, value)
+ self.app.remote.set_job_attribute(scheduler, job_id, name, value,
+ invoc.make_callback())
Modified: branches/sage_addition/cumin/python/cumin/grid/limit.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/limit.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/limit.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -1,11 +1,9 @@
from cumin.formats import fmt_link
-from cumin.model import QmfCall
from cumin.objectframe import ObjectFrame, ObjectFrameTask, \
ObjectFrameTaskFeedbackForm
from cumin.objectselector import ObjectTableColumn, ObjectQmfSelector, \
ObjectQmfTable
from cumin.qmfadapter import ObjectQmfAdapter
-from cumin.widgets import CuminView
from wooly.forms import StringField, StringInput, IntegerField, RealField, \
FormButton, FormField, FormError, CheckboxInput
from wooly.util import StringCatalog
@@ -138,18 +136,13 @@
self.form.limit_max.set(session, self.form.limit_max.get(osession))
def do_invoke(self, invoc, negotiator, limit_name, limit_max):
- action = QmfCall(self.app)
limit_max = float(limit_max)
- results = action.execute(negotiator, "SetLimit", limit_name, limit_max)
-
+ results = self.app.remote.set_limit(negotiator, limit_name, limit_max)
if results.error:
raise results.error
invoc.status_code = results.status
-
- action = QmfCall(self.app)
- action.execute(negotiator, "Reconfig")
-
+ self.app.remote.reconfig(negotiator)
invoc.end()
class NegotiatorLimitForm(ObjectFrameTaskFeedbackForm):
@@ -273,12 +266,3 @@
if message:
self.form.errors.add(session, FormError(message))
-
-
-
-class LimitView(CuminView):
- def __init__(self, app, name, limit):
- super(LimitView, self).__init__(app, name, None)
-
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
Modified: branches/sage_addition/cumin/python/cumin/grid/negotiator.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/negotiator.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/negotiator.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -10,7 +10,6 @@
from wooly.parameters import ListParameter
from wooly.template import WidgetTemplate
from cumin.stat import StatFlashChart
-from cumin.model import QmfCall
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.grid.negotiator")
@@ -401,10 +400,7 @@
self.app.main_page.main.grid.view.show(session)
def do_invoke(self, invoc, negotiator, group, value):
- # don't call self.qmf_call here since we need to
- # wait for the response before making the next QMF call
- action = QmfCall(self.app)
- result = action.execute(negotiator, "SetRawConfig", group, value)
+ result = self.app.remote.set_raw_config(negotiator, group, value)
if result.error:
raise result.error
@@ -418,8 +414,7 @@
invoc.end()
def reconfig(self, negotiator):
- action = QmfCall(self.app)
- action.execute(negotiator, "Reconfig")
+ self.app.remote.reconfig(negotiator)
class NegotiatorEditDynamicQuota(NegotiatorGroupTask):
def __init__(self, app, frame):
Modified: branches/sage_addition/cumin/python/cumin/grid/slot.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/slot.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/slot.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -36,19 +36,6 @@
return records
return recs
-class SlotView(CuminView):
- def __init__(self, app, name, slot):
- super(SlotView, self).__init__(app, name, slot)
-
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
-
- stats = SlotStats(app, "stats", slot)
- self.tabs.add_tab(stats)
-
- details = CuminDetails(app, "details", slot)
- self.tabs.add_tab(details)
-
class SlotLoadStatSet(StatSet):
def __init__(self, app, name, object):
super(SlotLoadStatSet, self).__init__(app, name, object)
Modified: branches/sage_addition/cumin/python/cumin/grid/submission.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/grid/submission.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/grid/submission.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -363,7 +363,7 @@
log_job_ad(ad)
- self.qmf_call(invoc, scheduler, "SubmitJob", ad)
+ self.app.remote.submit_job(scheduler, ad, invoc.make_callback())
class JobSubmitForm(ObjectTaskForm):
def __init__(self, app, name, task):
@@ -663,9 +663,9 @@
invoc.description = "Submit VM job '%s'" % description
log_job_ad(ad)
-
- self.qmf_call(invoc, scheduler, "SubmitJob", ad)
+ self.app.remote.submit_job(scheduler, ad, invoc.make_callback())
+
class VmJobSubmitForm(ObjectTaskForm):
def __init__(self, app, name, task):
cls = app.model.com_redhat_grid.Scheduler
@@ -799,7 +799,7 @@
log_job_ad(ad)
- self.qmf_call(invoc, scheduler, "SubmitJob", ad)
+ self.app.remote.submit_job(scheduler, ad, invoc.make_callback())
class DagJobSubmitForm(ObjectTaskForm):
def __init__(self, app, name, task):
Modified: branches/sage_addition/cumin/python/cumin/main.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/main.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/main.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -21,7 +21,9 @@
from user import *
from util import *
from widgets import *
-
+from sage.remoteoperations import RemoteOperations
+from sage.qmfoperations import QmfOperations
+from sage.aviaryoperations import AviaryOperations
from wooly import Session
from cumin.stat import PieChartPage
from cumin.widgets import AboutPage
@@ -40,6 +42,7 @@
self.model = CuminModel(self, model_dir)
self.session = CuminSession(self, broker_uris)
+
self.database = CuminDatabase(self, database_dsn)
self.server = CuminServer(self, host, port)
self.admin = CuminAdmin(self)
@@ -76,6 +79,10 @@
# Space separated list of sasl authentication
# mechanisms, according to the sasl documentation
self.sasl_mech_list = None
+
+ # Whether or not to use Aviary interface for
+ # queries and job submissions. May be set via cumin.conf
+ self.use_aviary = True
def server_alive(self):
return self.server.server_alive()
@@ -143,6 +150,14 @@
def init(self):
log.info("Initializing %s", self)
+ # Create RPC interfaces for QMF and aviary.
+ # Aviary takes precedence if added
+ self.remote = RemoteOperations()
+ ops = [QmfOperations("qmf", self.session)]
+ if self.use_aviary:
+ ops.insert(0, AviaryOperations("aviary"))
+ self.remote.add_mechanisms(ops)
+
self.model.init()
self.session.init()
self.database.init()
Modified: branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/messaging/brokerlink.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -52,7 +52,7 @@
self.app.main_page.main.messaging.broker.view.show(session)
def do_invoke(self, invoc, link):
- self.qmf_call(invoc, link, "close")
+ self.app.remote.close(link, invoc.make_callback())
class BrokerLinkSelector(ObjectSelector):
def __init__(self, app, name, vhost):
@@ -83,7 +83,7 @@
return "Remove broker link"
def do_invoke(self, invoc, link):
- self.qmf_call(invoc, link, "close")
+ self.app.remote.close(link, invoc.make_callback())
class RouteSelector(ObjectSelector):
def __init__(self, app, name, link):
@@ -110,7 +110,7 @@
return "Remove"
def do_invoke(self, invoc, route):
- self.qmf_call(invoc, route, "close")
+ self.app.remote.close(route, invoc.make_callback())
# XXX RouteFrame
@@ -122,20 +122,8 @@
self.app.main_page.main.messaging.broker.view.show(session)
def do_invoke(self, invoc, route):
- self.qmf_call(invoc, route, "close")
+ self.app.remote.close(route, invoc.make_callback())
-class LinkView(CuminView):
- def __init__(self, app, name, link):
- super(LinkView, self).__init__(app, name, link)
-
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
-
- #self.tabs.add_tab(LinkStats(app, "stats"))
-
- self.tabs.add_tab(RouteSet(app, "routes", link))
- self.tabs.add_tab(CuminDetails(app, "details", link))
-
class LinkGeneralStatSet(StatSet):
def __init__(self, app, name, object):
super(LinkGeneralStatSet, self).__init__(app, name, object)
@@ -185,18 +173,18 @@
exchanges = list()
link = self.form.link.get(session)
- vhost = link.vhost
- sortedExchanges = sorted_by(vhost.exchanges)
+ if link is not None:
+ vhost = link.vhost
+ sortedExchanges = sorted_by(vhost.exchanges)
- for exchange in sortedExchanges:
- if ExchangeInfo.is_builtin(exchange) or \
- (not exchange._get_qmfDeleteTime() and \
- not (self.state.is_active(session) and not is_active(exchange))):
- if not exchange.name in ["qpid.management", ""]:
- if not self.param.get(session):
- self.param.set(session, exchange.id)
- exchanges.append(exchange)
-
+ for exchange in sortedExchanges:
+ if ExchangeInfo.is_builtin(exchange) or \
+ (not exchange._get_qmfDeleteTime() and \
+ not (self.state.is_active(session) and not is_active(exchange))):
+ if not exchange.name in ["qpid.management", ""]:
+ if not self.param.get(session):
+ self.param.set(session, exchange.id)
+ exchanges.append(exchange)
return exchanges
def render_item_value(self, session, exchange):
@@ -236,10 +224,11 @@
def do_invoke(self, invoc, link, exchange, key, tag, dynamic, sync,
excludes):
- self.qmf_call(invoc, link, "bridge",
- link.durable, exchange.name, exchange.name,
- key, tag, excludes, False, False, dynamic, sync)
+ self.app.remote.bridge(link, link.durable, exchange.name, exchange.name,
+ key, tag, excludes, False, False, dynamic, sync,
+ invoc.make_callback())
+
class RouteAddForm(ObjectFrameTaskForm):
def __init__(self, app, name, task):
super(RouteAddForm, self).__init__(app, name, task)
@@ -334,10 +323,6 @@
dynamic, sync, excludes)
self.task.exit_with_redirect(session)
- def render_title(self, session):
- link = self.link.get(session)
- return self.task.get_title(session, link)
-
class RouteSetRemoveForm(CuminTaskForm):
def __init__(self, app, name, task):
super(RouteSetRemoveForm, self).__init__(app, name, task)
@@ -368,8 +353,8 @@
else:
mech = "PLAIN"
- self.qmf_call(invoc, obj, "connect",
- host, port, durable, mech, username, password, transport)
+ self.app.remote.connect(obj, host, port, durable, mech, username,
+ password, transport, invoc.make_callback())
class BrokerLinkAddForm(ObjectFrameTaskForm):
def __init__(self, app, name, task):
Modified: branches/sage_addition/cumin/python/cumin/messaging/connection.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/connection.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/messaging/connection.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -50,7 +50,7 @@
raise Exception \
("Cannot close management connection %s" % conn.address)
- self.qmf_call(invoc, conn, "close")
+ self.app.remote.close(conn, invoc.make_callback())
class ConnectionSelector(ObjectSelector):
def __init__(self, app, name, vhost):
@@ -96,7 +96,7 @@
raise Exception \
("Cannot close management connection %s" % conn.address)
- self.qmf_call(invoc, conn, "close")
+ self.app.remote.close(conn, invoc.make_callback())
def get_item_content(self, session, item):
args = (item.remoteProcessName, item.remotePid)
@@ -168,14 +168,14 @@
return "Close"
def do_invoke(self, invoc, sess):
- self.qmf_call(invoc, sess, "close")
+ self.app.remote.close(sess, invoc.make_callback())
class SessionDetach(ObjectFrameTask):
def get_title(self, session):
return "Detach"
def do_invoke(self, invoc, sess):
- self.qmf_call(invoc, sess, "detach")
+ self.app.remote.detach(sess, invoc.make_callback())
class SessionSelector(ObjectSelector):
def __init__(self, app, name, conn):
@@ -205,11 +205,11 @@
return "Close"
def do_invoke(self, invoc, sess):
- self.qmf_call(invoc, sess, "close")
+ self.app.remote.close(sess, invoc.make_callback())
class SessionSelectionDetach(ObjectSelectorTask):
def get_title(self, session):
return "Detach"
def do_invoke(self, invoc, sess):
- self.qmf_call(invoc, sess, "detach")
+ self.app.remote.detach(sess, invoc.make_callback())
Modified: branches/sage_addition/cumin/python/cumin/messaging/queue.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/messaging/queue.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/messaging/queue.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -101,8 +101,8 @@
def get_title(self, session):
return "Purge"
- def do_invoke(self, invoc, queue, count=0):
- self.qmf_call(invoc, queue, "purge", count)
+ def do_invoke(self, invoc, queue, count=0):
+ self.app.remote.purge_queue(queue, count, invoc.make_callback())
class QueueBindingSelector(BindingSelector):
def __init__(self, app, name, queue):
@@ -361,7 +361,7 @@
return "Purge"
def do_invoke(self, invoc, queue, count=0):
- self.qmf_call(invoc, queue, "purge", count)
+ self.app.remote.purge_queue(queue, count, invoc.make_callback())
class QueuePurgeForm(ObjectFrameTaskForm):
def __init__(self, app, name, task):
@@ -607,9 +607,8 @@
cls = self.app.model.org_apache_qpid_broker.Broker
broker = cls.get_object_by_id(cursor, vhost._brokerRef_id)
+ self.app.remote.queue_move_messages(broker, src, dst, count, invoc.make_callback())
- self.qmf_call(invoc, broker, "queueMoveMessages", src, dst, count)
-
class MoveQueueMessages(MoveMessagesBase):
def __init__(self, app, frame):
super(MoveQueueMessages, self).__init__(app, frame)
Modified: branches/sage_addition/cumin/python/cumin/model.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/model.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/model.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -8,11 +8,12 @@
from cumin.formats import fmt_datetime, fmt_dict, fmt_none_brief, fmt_none,\
fmt_duration
-from cumin.util import calc_rate, JobStatusInfo, secs, wait
+from cumin.util import calc_rate, JobStatusInfo, secs
from cumin.sqladapter import SqlAdapter
from rosemary.sqlfilter import SqlComparisonFilter
from rosemary.sqlquery import SqlQueryOptions
from rosemary.model import RosemaryModel
+from sage.util import SyncSet
log = logging.getLogger("cumin.model")
@@ -305,136 +306,6 @@
return retval
-class CuminAction(object):
- def __init__(self, cls, name):
- self.model = cls.model
- self.mint = self.model.mint
- self.cumin_class = cls
-
- self.name = name
- self.title = None
- self.summary = False
- self.navigable = True
- self.aggregate = False
-
- self.cumin_class.add_action(self)
-
- def init(self):
- pass
-
- def show(self, session, object):
- raise Exception("Not implemented")
-
- # XXX we could even cache this if it gets called a lot
- def get_href(self, session, object):
- branch = session.branch()
- self.show(branch, object)
- return branch.marshal()
-
- def get_title(self, session):
- if self.title:
- return self.title
- else:
- return self.name
-
- def get_summary(self, session, object):
- pred0 = self.get_title(session)
- pred1 = self.cumin_class.get_object_title(session, object)
-
- return "%s %s" % (pred0, pred1)
-
- def get_enabled(self, session, object):
- return True
-
- def get_verb(self, session):
- return None
-
- def get_description(self, session, object):
- verb = self.get_verb(session)
-
- if not verb:
- verb = self.get_title(session)
-
- cls = self.cumin_class
-
- if cls and object:
- obj = None
-
- if type(object) is list:
- if len(object) == 1:
- obj = object[0]
- else:
- obj = object
-
- if obj is None:
- sobject = "%i %s" % \
- (len(object), cls.get_plural_title(session))
- else:
- sobject = cls.get_object_title(session, obj)
- elif cls:
- sobject = cls.get_title(session)
- else:
- # XXX lame
- sobject = str(object)
-
- return "%s %s" % (verb, sobject)
-
- def invoke(self, object, args={}):
- invoc = self.begin(object)
-
- def completion(status, args=None):
- invoc.status = status
- invoc.args = args
- #invoc.prt()
-
- try:
- return self.do_invoke(object, args, completion)
- except Exception, e:
- invoc.status = "failed"
- invoc.exception = e
-
- log.exception(e)
-
- #invoc.prt()
-
- return invoc
-
- def do_invoke(self, object, args, completion):
- raise Exception("Not implemented")
-
- def begin(self, object):
- invoc = CuminActionInvocation(self, object)
- self.model.invocations.add(invoc)
- return invoc
-
-class CuminActionInvocation(object):
- def __init__(self, action, object):
- self.action = action
- self.object = object
- self.when = datetime.now()
- self.status = "pending"
- self.args = None
- self.exception = None
-
- def get_description(self, session):
- return self.action.get_description(session, self.object)
-
- def prt(self):
- print "action", self.action.name, self.object, self.when, \
- self.status, self.args, self.exception
-
-class CuminSetAction(CuminAction):
- def __init__(self, cls, name):
- super(CuminSetAction, self).__init__(cls, name)
-
- self.aggregate = True
-
- def get_summary(self, session, object):
- pred0 = self.get_title(session)
- pred1 = self.cumin_class.get_plural_title(session)
-
- return "%s %s" % (pred0, pred1)
-
class SamplesSqlAdapter(SqlAdapter):
qmf_update_col = '_qmf_update_time'
@@ -775,116 +646,21 @@
except KeyError:
return "Unknown (%s)" % str(value)
-class GetStartedAction(CuminAction):
- def get_xml_response(self, session, object, *args):
- updateTime = object.statsCurr and object.statsCurr.qmfUpdateTime \
- or object.qmfUpdateTime
- delta = secs(updateTime) - secs(datetime.now())
- conf = "<age>%i</age>" % -delta
- rect = "<updatetime>%s</updatetime>" % fmt_duration(delta)
+class FetchRawConfigSet(object):
+ def __init__(self, timeout=5):
+ self.syncs = SyncSet(log, timeout)
- return "%s%s" % (conf, rect)
-
-class QmfCall(object):
- def __init__(self, app, default=None, timeout=5):
- self.app = app
- self.data = default
- self.got_data = False
- self.error = False
- self.status = None
- self.timeout = timeout
-
- def get_completion(self):
- def completion(status, data):
- self.status = status
- if (status == 0) or (status == "OK"):
- self.data = data
- self.got_data = True
- else:
- self.error = Exception(status)
- msg = "QMF call returned with status of %s" % str(status)
- log.error(msg)
- return completion
-
- def do_wait(self):
- wait(self.done, timeout=self.timeout)
- return self
-
- def done(self):
- return self.got_data or self.error
-
- def execute(self, obj, method_name, *args):
- session = self.app.session
- try:
- session.call_method(self.get_completion(), obj, method_name, args)
- except Exception, e:
- self.error = e
- log.exception(e)
-
- results = self.do_wait()
- if not results.got_data and not results.error:
- results.error = Exception("Request timed out")
- msg = "QMF call %s timed out" % method_name
- log.error(msg)
-
- return results
-
-class QmfCallSet(object):
- def __init__(self, app):
- self.app = app
- self.calls = dict()
- self.timeout = 5
-
- def add_call(self, key, default=None):
- call = QmfCall(self.app, default)
- self.calls[key] = call
- return call
-
- def do_wait(self):
- def predicate(calls):
- done = 0
- for call in calls:
- if calls[call].done():
- done += 1
- return done == len(calls)
-
- wait(predicate, timeout=self.timeout, args=self.calls)
- return self.calls
-
-class FetchRawConfigSet(QmfCallSet):
- def execute(self, negotiator, groups, prepend=""):
+ def execute(self, remote, negotiator, groups, prepend=""):
default = {'Value': 0}
- session = self.app.session
for group in groups:
- call = self.add_call(group, default)
-
+ sync = self.syncs.add_sync(group, default)
try:
- session.call_method(call.get_completion(), negotiator, "GetRawConfig", (prepend+group,))
+ remote.get_raw_config(negotiator, prepend+group, sync.get_completion())
except Exception, e:
- call.error = e
+ sync.error = e
log.exception(e)
+ return self.syncs.do_wait()
- return self.do_wait()
-
-class FetchJobAd(QmfCall):
- def __init__(self, app):
- super(FetchJobAd, self).__init__(app)
- self.data = {'JobAd': {"":{"VALUE":"", "TYPE":0}}}
-
-class FetchJobOutput(QmfCall):
- def __init__(self, app):
- super(FetchJobOutput, self).__init__(app)
- self.data = {'Data': ""}
-
- def execute(self, job_server, jobId, file, start, end):
- session = self.app.session
- try:
- session.call_method(self.get_completion(), job_server, "Fetch", (jobId, file, start, end))
- except Exception, e:
- self.error = e
- log.exception(e)
- return self.do_wait()
-
class Pool(object):
def __init__(self, id):
self.id = id
@@ -971,8 +747,7 @@
except KeyError:
pass
- self.model.app.session.call_method \
- (completion, self.negotiator, "GetLimits", ())
+ self.model.app.remote.get_limits(self.negotiator, completion)
def delete(self):
del self.model.limits_by_negotiator[self.negotiator._qmf_agent_id]
@@ -993,8 +768,7 @@
except KeyError:
pass
- self.model.app.session.call_method \
- (completion, self.submission, "GetJobSummaries", ())
+ self.model.app.remote.get_job_summaries(self.submission, completion)
def delete(self):
del self.model.job_summaries_by_submission[self.submission._id]
@@ -1016,9 +790,9 @@
except KeyError:
pass
- self.model.app.session.call_method \
- (completion, self.negotiator, "GetRawConfig", ("GROUP_NAMES",))
-
+ self.model.app.remote.get_raw_config(self.negotiator, "GROUP_NAMES",
+ completion)
+
def delete(self):
del self.model.group_names_by_negotiator[self.negotiator._qmf_agent_id]
@@ -1050,8 +824,10 @@
def update(self, cursor):
for config in self.configs:
- action = FetchRawConfigSet(self.model.app)
- raw_configs = action.execute(self.negotiator, self.configs[config], config+"_")
+ action = FetchRawConfigSet()
+ raw_configs = action.execute(self.model.app.remote,
+ self.negotiator,
+ self.configs[config], config+"_")
#for group in raw_configs:
# qmfc = raw_configs[group]
# qmfc.data = {'Value': 0.1}
@@ -1062,7 +838,7 @@
def update_new(self, cursor):
for config in self.configs:
- action = FetchRawConfigSet(self.model.app)
+ action = FetchRawConfigSet()
new_configs = list()
for group in self.configs.keys():
if group not in self.data.keys() or \
@@ -1070,7 +846,8 @@
not self.data[config][group].data:
new_configs.append(group)
- raw_configs = action.execute(self.negotiator, new_configs, config+"_")
+ raw_configs = action.execute(self.model.app.remote,
+ self.negotiator, new_configs, config+"_")
for group in raw_configs:
self.data[config][group] = raw_configs[group]
@@ -1089,4 +866,4 @@
class NegotiatorStaticGroupConfigValuesStore(NegotiatorGroupConfigValuesStore):
def __init__(self, model, negotiator, groups, config):
- super(NegotiatorStaticGroupConfigValuesStore, self).__init__(model, negotiator, groups, config)
\ No newline at end of file
+ super(NegotiatorStaticGroupConfigValuesStore, self).__init__(model, negotiator, groups, config)
Modified: branches/sage_addition/cumin/python/cumin/objecttask.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/objecttask.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/objecttask.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -93,16 +93,6 @@
def do_invoke(self, invoc, obj, *args, **kwargs):
pass
- def qmf_call(self, invoc, obj, meth, *args):
- def completion(status_code, output_args):
- invoc.status_code = status_code
- invoc.output_args = output_args
-
- invoc.end()
-
- session = self.app.session
- session.call_method(completion, obj, meth, args)
-
def exception(self, invoc, e):
now = datetime.now()
Modified: branches/sage_addition/cumin/python/cumin/qmfadapter.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/qmfadapter.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/qmfadapter.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -1,28 +1,25 @@
from operator import itemgetter
-from cumin.model import QmfCall
from wooly.datatable import DataAdapter, DataAdapterField
import logging
log = logging.getLogger("cumin.qmfadapter")
class QmfAdapter(DataAdapter):
- def __init__(self, app, method):
+ def __init__(self, app):
super(QmfAdapter, self).__init__()
self.app = app
- self.method = method
self.default = list()
self.columns = list()
self.max_sortable_records = app.max_qmf_table_sort
def get_count(self, values):
- obj = values['obj']
- args = values['args']
+ # This used to make a Qmf call, but all descendent
+ # classes overloaded this method and the argument passed in to
+ # the constructor that named the method was not a Qmf method
+ # name in any case. Broken somewhere in history, but unused,
+ # hence removed.
+ raise Exception("Not implemented")
- action = QmfCall(self.app)
- results = action.execute(obj, self.method, args)
-
- return results and len(results) or 0
-
def get_data(self, values, options):
data = self.do_get_data(values)
@@ -40,17 +37,13 @@
return rows
def do_get_data(self, values):
- obj = values['obj']
- args = values['args']
+ # This used to make a Qmf call, but all descendent
+ # classes overloaded this method and the argument passed in to
+ # the constructor that named the method was not a Qmf method
+ # name in any case. Broken somewhere in history, but unused,
+ # hence removed.
+ raise Exception("Not implemented")
- action = QmfCall(self.app)
- results = action.execute(obj, self.method, args)
-
- if results.error:
- results.data = self.default
-
- return results.data
-
def process_results(self, results):
""" take the dict response from the qmf call and return a list of lists """
@@ -122,7 +115,7 @@
class ObjectQmfAdapter(QmfAdapter):
def __init__(self, app, cls):
- super(ObjectQmfAdapter, self).__init__(app, cls._name)
+ super(ObjectQmfAdapter, self).__init__(app)
self.cls = cls
self.default_field_cls = ObjectQmfField
Modified: branches/sage_addition/cumin/python/cumin/task.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/task.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/task.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -102,16 +102,6 @@
def do_invoke(self, session, obj, invoc, **kwargs):
pass
- def qmf_call(self, invoc, obj, meth, *args):
- def completion(status_code, output_args):
- invoc.status_code = status_code
- invoc.output_args = output_args
-
- invoc.end()
-
- session = self.app.session
- session.call_method(completion, obj, meth, args)
-
def exception(self, invoc, e):
now = datetime.now()
@@ -181,6 +171,13 @@
log.info("Ended %s", self.task)
+ def make_callback(self):
+ def completion(status_code, output_args):
+ self.status_code = status_code
+ self.output_args = output_args
+ self.end()
+ return completion
+
class TaskInvocationSet(Widget):
def __init__(self, app, name):
super(TaskInvocationSet, self).__init__(app, name)
Modified: branches/sage_addition/cumin/python/cumin/widgets.py
===================================================================
--- branches/sage_addition/cumin/python/cumin/widgets.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/cumin/python/cumin/widgets.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -175,57 +175,6 @@
def get_title(self, session):
return self.render_title(session)
-class CuminView(Widget):
- def __init__(self, app, name, object):
- super(CuminView, self).__init__(app, name)
-
- self.object = object
-
- summary = CuminSummary(app, "summary", self.object)
- self.add_child(summary)
-
- self.__frame_tmpl = WidgetTemplate(self, "frame_html")
- self.sticky_frame = None
-
- def render_script(self, session):
- return None
-
- def render_icon_resource(self, session):
- return "action-36.png"
-
- def render_frames(self, session):
- writer = Writer()
-
- for frame in reversed(self.frame.ancestors):
- if isinstance(frame, CuminFrame):
- self.__frame_tmpl.render(writer, session, frame)
-
- self.__frame_tmpl.render(writer, session, self.frame)
-
- return writer.to_string()
-
- def render_frame(self, session, frame):
- if frame == self.frame:
- html = frame.render_title(session)
- else:
- obj = None
-
- if frame.object:
- obj = frame.object.get(session)
-
- href = frame.get_href(session, obj)
- content = frame.render_title(session)
-
- html = fmt_link(href, content)
-
- return html
-
- def do_process(self, session):
- if self.sticky_frame:
- session.client_session.attributes["sticky_%s" % \
- self.sticky_frame.name] = self.frame.object.get(session)
- super(CuminView, self).do_process(session)
-
class BackgroundInclude(Widget):
def __init__(self, app, name):
super(BackgroundInclude, self).__init__(app, name)
@@ -466,57 +415,6 @@
def render_icon_href(self, session, *args):
return "resource?name=action-36.png"
-class CuminSummary(Widget):
- def __init__(self, app, name, object):
- super(CuminSummary, self).__init__(app, name)
-
- self.object = object
-
- props = self.SummaryProperties(app, "properties", self.object)
- self.add_child(props)
-
- tasks = self.SummaryTasks(app, "tasks", self.object)
- self.add_child(tasks)
-
- def render_title(self, session):
- obj = self.object.get(session)
- cls = self.app.model.get_class_by_object(obj)
-
- if cls:
- return xml_escape(cls.get_object_name(obj))
- elif obj:
- return obj.get_title()
-
- def render_icon_href(self, session):
- obj = self.object.get(session)
- cls = self.app.model.get_class_by_object(obj)
-
- if cls:
- return cls.get_icon_href(session)
-
- class SummaryProperties(CuminProperties):
- def do_get_items(self, session):
- obj = self.object.get(session)
- cls = self.app.model.get_class_by_object(obj)
-
- if cls:
- return [(x.get_title(session),
- x.value(session, obj),
- x.escape)
- for x in cls.properties if x.summary]
-
- class SummaryTasks(CuminTasks):
- def do_get_items(self, session):
- obj = self.object.get(session)
- cls = self.app.model.get_class_by_object(obj)
-
- if cls:
- return [(x.get_href(session, obj),
- x.get_title(session),
- x.is_enabled(session, obj))
- for x in cls.tasks
- if not x.aggregate and x.form and x.navigable]
-
class StateSwitch(ItemSet):
def __init__(self, app, name):
super(StateSwitch, self).__init__(app, name)
Modified: branches/sage_addition/etc/Profile.bash
===================================================================
--- branches/sage_addition/etc/Profile.bash 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/etc/Profile.bash 2011-06-24 17:40:40 UTC (rev 4854)
@@ -1,5 +1,5 @@
export DEVEL_HOME="$PWD"
-export DEVEL_MODULES="mint cumin basil parsley wooly rosemary"
+export DEVEL_MODULES="mint cumin basil parsley wooly rosemary sage"
if [[ -z "$DEVEL_ORIGINAL_PATH" ]]; then
export DEVEL_ORIGINAL_PATH="$PATH"
Modified: branches/sage_addition/rosemary/python/rosemary/model.py
===================================================================
--- branches/sage_addition/rosemary/python/rosemary/model.py 2011-06-24 15:31:24 UTC (rev 4853)
+++ branches/sage_addition/rosemary/python/rosemary/model.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -271,9 +271,9 @@
stat = RosemaryStatistic(self, child.get("name"))
stat.load(child)
- for child in elem.findall("method"):
- meth = RosemaryMethod(self, child.get("name"))
- meth.load(child)
+# for child in elem.findall("method"):
+# meth = RosemaryMethod(self, child.get("name"))
+# meth.load(child)
def extend(self, elem):
log.debug("Extending %s", self)
@@ -294,9 +294,9 @@
stat = self._statistics_by_name[child.get("name")]
stat.extend(child)
- for child in elem.findall("method"):
- meth = self._methods_by_name[child.get("name")]
- meth.extend(child)
+# for child in elem.findall("method"):
+# meth = self._methods_by_name[child.get("name")]
+# meth.extend(child)
for child in elem.findall("index"):
idx = RosemaryIndex(self, child.get("name"))
Added: branches/sage_addition/sage/python/sage/__init__.py
===================================================================
Added: branches/sage_addition/sage/python/sage/aviaryoperations.py
===================================================================
--- branches/sage_addition/sage/python/sage/aviaryoperations.py (rev 0)
+++ branches/sage_addition/sage/python/sage/aviaryoperations.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -0,0 +1,4 @@
+class AviaryOperations(object):
+ def __init__(self, name):
+
+ self.name = name
Added: branches/sage_addition/sage/python/sage/qmfoperations.py
===================================================================
--- branches/sage_addition/sage/python/sage/qmfoperations.py (rev 0)
+++ branches/sage_addition/sage/python/sage/qmfoperations.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -0,0 +1,181 @@
+import logging
+from sage.util import CallSync, wait
+
+log = logging.getLogger("sage.remoteoperations")
+
+class QmfOperations(object):
+ '''
+ Provides an interface to QMF remote procedure calls.
+ Public methods may implement synchronous or asynchronous
+ calling semantics, or may support either one depending on the parameters
+ passed.
+ If a method takes a 'callback' parameter and that parameter is not
+ None, the method will have asynchronous calling semantics. Otherwise,
+ the method will have synchronous calling semantics and the 'default' and
+ 'timeout' parameters will be used.
+ The 'callback' parameter if set is expected to be a reference to a
+ function that can be invoked by self.session.call_method() when an
+ operation is complete.
+ '''
+
+ def __init__(self, name, session):
+ '''
+ If this object is added to a RemoteOperations object as a mechanism,
+ the 'name' parameter will be used to create an attribute which points
+ to this object.
+ The 'session' parameter is expected to be an object that defines the
+ following method:
+
+ def call_method(callback, obj, meth, args)
+
+ session.call_method should be capable of invoking the 'meth' method
+ on the 'obj' object with the tuple 'args' as arguments. It should
+ be capable of passing results to the 'callback' function. Any
+ 'callback' parameter passed to a public method of a QmfOperations object
+ should have a signature that is compatible with that expected by
+ session.call_method().
+ '''
+
+ self.name = name
+ self.session = session
+
+ # Note, methods below were written to be synchronous, asynchronous, or
+ # selectable to reflect existing usage of QMF methods in cumin at
+ # the time 'sage' was created. Any of these methods may be changed to
+ # have synchronous or asynchronous calling semantics by using the callback,
+ # default, and timeout paramters and the self._call method.
+
+# broker operations
+
+ def queue_move_messages(self, broker, src, dst, count, callback):
+ assert callback
+ self._call(broker, "queueMoveMessages", callback, 0, 0, src, dst, count)
+
+# methods on various broker objects. close is implemented on multiple objects
+
+ def close(self, obj, callback):
+ assert callback
+ self._call(obj, "close", callback, 0, 0)
+
+ def detach(self, obj, callback):
+ assert callback
+ self._call(obj, "detach", callback, 0, 0)
+
+ def bridge(self, link, durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync, callback):
+ assert callback
+ self._call(link, "bridge", callback, 0, 0,
+ durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync)
+
+ def connect(self, obj, host, port, durable, mech, username, password, transport, callback):
+ assert callback
+ self._call(obj, "connect", callback, 0, 0,
+ host, port, durable, mech, username, password, transport)
+
+# queue operations
+
+ def purge_queue(self, queue, count, callback):
+ assert callback
+ self._call(queue, "purge", callback, 0, 0, count)
+
+# scheduler operations
+
+ def set_job_attribute(self, scheduler, job_id, name, value, callback):
+ assert callback
+ self._call(scheduler, "SetJobAttribute", callback, 0, 0,
+ job_id, name, value)
+
+ def submit_job(self, scheduler, ad, callback):
+ assert callback
+ self._call(scheduler, "SubmitJob", callback, 0, 0, ad)
+
+ def hold_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "HoldJob", callback, default,
+ timeout, job_id, reason)
+
+ def release_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "ReleaseJob", callback, default,
+ timeout, job_id, reason)
+
+ def remove_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "RemoveJob", callback, default,
+ timeout, job_id, reason)
+
+# jobserver operations
+
+ def get_job_ad(self, job_server, job_id, default=None, timeout=5):
+ return self._call(job_server, "GetJobAd", 0, default, timeout, job_id)
+
+ def fetch_job_data(self, job_server, job_id, file, start, end,
+ default=None, timeout=5):
+ return self._call(job_server, "FetchJobData", 0, default, timeout,
+ job_id, file, start, end)
+
+# negotiator operations
+
+ def set_limit(self, negotiator, lim_name, lim_max, default=None, timeout=5):
+ return self._call(negotiator, "SetLimit", 0, default, timeout,
+ lim_name, lim_max)
+
+ def get_limits(self, negotiator, callback):
+ assert callback
+ return self._call(negotiator, "GetLimits", callback, 0, 0)
+
+ def reconfig(self, negotiator, default=None, timeout=5):
+ return self._call(negotiator, "Reconfig", 0, default, timeout)
+
+ def set_raw_config(self, negotiator, name, value, default=None, timeout=5):
+ return self._call(negotiator, "SetRawConfig", 0, default, timeout,
+ name, value)
+
+ def get_raw_config(self, negotiator, name, callback):
+ assert callback
+ return self._call(negotiator, "GetRawConfig", callback, 0, 0, name)
+
+# master operations
+
+ def start(self, master, daemon, callback):
+ assert callback
+ return self._call(master, "Start", callback, 0, 0, daemon)
+
+ def stop(self, master, daemon, callback):
+ assert callback
+ return self._call(master, "Stop", callback, 0, 0, daemon)
+
+# submission operations
+
+ def get_job_summaries(self, submission, callback):
+ assert callback
+ return self._call(submission, "GetJobSummaries", callback, 0, 0)
+
+# Secret private implementation stuff, don't look!
+ def _call(self, obj, meth, cb, dflt, tout, *args):
+ if cb:
+ self.session.call_method(cb, obj, meth, args)
+ else:
+ try:
+ sync = CallSync(log, dflt)
+ self.session.call_method(sync.get_completion(),
+ obj, meth, args)
+ except Exception, e:
+ sync.error = e
+ log.exception(e)
+
+ wait(sync.done, timeout=tout)
+ if not sync.got_data and not sync.error:
+ sync.error = Exception("Request timed out")
+ msg = "QMF call %s timed out" % meth
+ log.error(msg)
+ return sync
+
Added: branches/sage_addition/sage/python/sage/remoteoperations.py
===================================================================
--- branches/sage_addition/sage/python/sage/remoteoperations.py (rev 0)
+++ branches/sage_addition/sage/python/sage/remoteoperations.py 2011-06-24 17:40:40 UTC (rev 4854)
@@ -0,0 +1,51 @@
+class RemoteOperations(object):
+
+ def __init__(self):
+ self.mechanisms = []
+
+ def add_mechanisms(self, mechs):
+ '''
+ Add an item or items to the list of supported mechanisms.
+ A mechanism is expected to be an instance of a class containing
+ methods that implement remote procedure calls.
+ When attribute access is done on an instance of RemoteOperations,
+ the mechanism list is searched in order for a class which contains
+ a method of the given name (assuming the attribute is not contained
+ directly in the RemoteOperations instance itself). This allows methods
+ on mechanism objects to be called as if they are attributes of
+ RemoteOperations, without the caller having knowledge of which mechanism
+ ultimately provides the method.
+ If a mechanism object has an attribute called 'name', a reference to the
+ object is added as an attribute of RemoteOperations named 'name'. This
+ allows a specific mechamism to be used if desired (for example,
+ the hold_job method might be invoked as remote.qmf.hold_job(), ensuring
+ that the QMF version is used, rather than remote.hold_job() which will
+ use the first hold_job method located in the mechanism list).
+ '''
+
+ # Allow mechanism to be specifially chosen by name
+ # rather than determined by precedence order
+ # remote.qmf.Op() vs remote.Op(), for example
+ def make_mech_attr(m):
+ if hasattr(m, "name"):
+ setattr(self, m.name, m)
+
+ if type(mechs) in (tuple, list):
+ for m in mechs:
+ self.mechanisms.append(m)
+ make_mech_attr(m)
+ else:
+ self.mechanisms.append(mechs)
+ make_mech_attr(mechs)
+
+ def __getattr__(self, name):
+ # Reminder, __getattr__ is called when an attribute
+ # cannot be found in the object.
+ for m in self.mechanisms:
+ if hasattr(m, name):
+ a = getattr(m, name)
+ if callable(a):
+ return a
+ raise AttributeError("No mechanism has callable %s" % name)
+
+
12 years, 10 months
r4853 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-24 15:31:24 +0000 (Fri, 24 Jun 2011)
New Revision: 4853
Modified:
trunk/cumin/python/cumin/main.py
Log:
Addressing BZ https://bugzilla.redhat.com/show_bug.cgi?id=699732 for the messaging overview section. The submission name is now truncated at 50 characters.
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-06-24 13:58:48 UTC (rev 4852)
+++ trunk/cumin/python/cumin/main.py 2011-06-24 15:31:24 UTC (rev 4853)
@@ -589,6 +589,12 @@
self.page.main.grid.submission.id.set(session, submission_id)
self.page.main.grid.submission.view.show(session)
return branch.marshal()
+
+ def render_cell_content(self, session, record):
+ retval = len(record) > 0 and record[self.field.index] or ""
+ if(len(record[self.field.index]) > 50):
+ retval = record[self.field.index][:50] + "..." #indicate that we truncated the name
+ return retval
class DurationColumn(TopTableColumn):
def render_header_content(self, session):
12 years, 10 months
r4852 - in trunk/cumin: python/cumin resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-06-24 13:58:48 +0000 (Fri, 24 Jun 2011)
New Revision: 4852
Modified:
trunk/cumin/python/cumin/main.strings
trunk/cumin/resources/app.css
trunk/cumin/resources/app.js
Log:
One more fix for BZ https://bugzilla.redhat.com/show_bug.cgi?id=703630 For the messaging overview page, the fullpage icons needed to go back to their original places.
Modified: trunk/cumin/python/cumin/main.strings
===================================================================
--- trunk/cumin/python/cumin/main.strings 2011-06-24 12:42:17 UTC (rev 4851)
+++ trunk/cumin/python/cumin/main.strings 2011-06-24 13:58:48 UTC (rev 4852)
@@ -4,14 +4,14 @@
<tbody>
<tr>
<td>
-<div class="fullpageable">
+<div class="fullpageable oldfpiconlocation">
<h2><img src="{resource_prefix}/queue-20.png" alt="" /> Deepest Message Queues</h2>
<div class="iblock">{queues}</div>
</div>
</td>
<td>
-<div class="fullpageable">
+<div class="fullpageable oldfpiconlocation">
<h2><img src="{resource_prefix}/job-20.png" alt="" /> Longest Running Grid Submissions</h2>
<div class="iblock">{submissions}</div>
</div>
@@ -19,7 +19,7 @@
</tr>
<tr>
<td>
-<div class="fullpageable">
+<div class="fullpageable oldfpiconlocation">
<h2><img src="{resource_prefix}/system-20.png" alt=""/> Busiest Systems</h2>
<div class="iblock">{systems}</div>
Modified: trunk/cumin/resources/app.css
===================================================================
--- trunk/cumin/resources/app.css 2011-06-24 12:42:17 UTC (rev 4851)
+++ trunk/cumin/resources/app.css 2011-06-24 13:58:48 UTC (rev 4852)
@@ -496,8 +496,8 @@
top: 0px;
z-index: 201;
}
-
-p.fullpageIcon {
+p.fullpageIcon,
+p.fullpageIconOldLocation {
background-color: white;
border-top: 2px solid #685B8A;
border-left: 1px solid #685B8A;
@@ -515,14 +515,22 @@
right: 60px;
display: none;
}
+p.fullpageIconOldLocation {
+ top: -2px;
+ right: 14px;
+}
div.fullpageable:hover div.fullpageTitle,
div.fullpageable:hover p.fullpageIcon,
div.fullpaged div.fullpageTitle,
-div.fullpaged p.fullpageIcon {
+div.fullpaged p.fullpageIcon,
+div.fullpaged p.fullpageIconOldLocation,
+div.fullpageable:hover p.fullpageIconOldLocation
+ {
display: block;
}
-div.fullpaged p.fullpageIcon {
+div.fullpaged p.fullpageIcon,
+div.fullpaged p.fullpageIconOldLocation {
border-top: 1px solid #cbb4ff;
border-left: 1px solid #cbb4ff;
border-bottom: 2px solid #685B8A;
Modified: trunk/cumin/resources/app.js
===================================================================
--- trunk/cumin/resources/app.js 2011-06-24 12:42:17 UTC (rev 4851)
+++ trunk/cumin/resources/app.js 2011-06-24 13:58:48 UTC (rev 4852)
@@ -236,7 +236,12 @@
if (element.getParent().getElement(".fullpageIcon"))
return; // already fullpaged
- var icon = new Element('p', {'class': 'fullpageIcon',
+ var fpIconClass = 'fullpageIcon';
+ if (element.get('class').indexOf("oldfpiconlocation") != -1) {
+ fpIconClass = 'fullpageIconOldLocation';
+ }
+
+ var icon = new Element('p', {'class': fpIconClass,
'title': 'Full Page',
'events': {'click': function () {fullpage(this)}}});
12 years, 10 months