r5467 - branches/tmckay/sage/python/sage/aviary
tmckay at fedoraproject.org
tmckay at fedoraproject.org
Wed Sep 12 13:14:28 UTC 2012
Author: tmckay
Date: 2012-09-12 13:14:27 +0000 (Wed, 12 Sep 2012)
New Revision: 5467
Modified:
branches/tmckay/sage/python/sage/aviary/aviaryoperations.py
Log:
Update some docstring comments
Modified: branches/tmckay/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/tmckay/sage/python/sage/aviary/aviaryoperations.py 2012-09-12 13:11:56 UTC (rev 5466)
+++ branches/tmckay/sage/python/sage/aviary/aviaryoperations.py 2012-09-12 13:14:27 UTC (rev 5467)
@@ -19,6 +19,12 @@
log = logging.getLogger("sage.aviary")
class SudsLogging(object):
+ '''
+ Class to enable logging of SOAP transactions.
+
+ This class allows detailed logging of SOAP transactions through
+ the Suds module. It is meant as a debugging aid during development.
+ '''
_on = False
sudslogs = {"suds.client": None, "suds.transport": None, "suds.xsd.schema": None, "suds.wsdl": None}
@@ -65,7 +71,11 @@
def _get_host(name, servers):
'''
Lookup a host in a dictionary produced by sage.util.host_list.
- Return the scheme and URL for the host.
+
+ The host may be just a hostname or hostname:port.
+ Return the scheme and URL for the host. The scheme is separated
+ out for convenience (although it could easily be parsed from the
+ URL)
'''
scheme = ""
host = ""
@@ -106,7 +116,7 @@
class ServerList(object):
'''
Query an Aviary locator object for endpoints by reource and subtype.
- Lookup an endpoint of the specified type by machine name.
+ Lookup an endpoint of the specified type by hostname or hostname:port.
Allow the cached list to be refreshed on demand.
'''
def __init__(self, locator, resource, subtype):
@@ -172,10 +182,11 @@
def find_server(self, machine, refresh=False):
'''
- Lookup a URL in the cached server list by machine.
+ Lookup a URL in the cached server list by hostname or hostname:port.
Generate a new server list if refresh is True, or if the
initial host lookup fails and refresh == "on_no_host".
- Return the scheme and URL for the specified machine.
+ Return the scheme and URL for the specified host if found or raise
+ an exception if the host could not be found.
'''
# Update the list if necessary and return host info for machine.
# If refresh is True, the server list will be updated. This is
@@ -199,9 +210,20 @@
class FixedServerList(object):
'''
- Allows lookup for endpoints by machine when the server list is fixed.
+ Query a fixed server list for Aviary endpoints.
+ Lookup an endpoint in the fixed list by hostname or hostname:port.
+ The fixed server list is an alternative to using an Aviary locator.
'''
def __init__(self, servers, port, path, subtype):
+ '''
+ Initialize a fixed server list of Aviary endpoints.
+ servers -- a comma separated list of (partial) URLs
+ port -- default port value if a URL does not specify a port
+ path -- default path value if a URL does not specify a path
+ subtype -- this is used to identify the service type in error
+ messages. Predefind values are "JOB" and "QUERY_SERVER".
+ The scheme for a URL will be "http" if not specified.
+ '''
# Fixed server list, there is no point to a retry on failed ops.
self.should_retry = False
@@ -221,6 +243,11 @@
self.nice = subtype
def find_server(self, machine, *args):
+ '''
+ Lookup a URL in the fixed server list by hostname or hostname:port.
+ Return the scheme and URL for the specified host if found or raise
+ an exception if the host could not be found.
+ '''
scheme, host = _get_host(machine, self.servers)
if host == "":
log.info("AviaryOperations: failed to locate %s on %s" \
More information about the cumin-developers
mailing list