You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:34:13 UTC
svn commit: r1132067 [7/9] - in /incubator/mesos/trunk: ec2/
third_party/boto-1.8d/ third_party/boto-1.8d/bin/
third_party/boto-1.8d/boto.egg-info/ third_party/boto-1.8d/boto/
third_party/boto-1.8d/boto/cloudfront/ third_party/boto-1.8d/boto/contrib/
t...
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/connection.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/connection.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/connection.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/connection.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/connection.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/connection.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/connection.py Sun Jun 5 08:34:02 2011
@@ -27,6 +27,7 @@ from boto import handler
from boto.connection import AWSQueryConnection
from boto.sdb.domain import Domain, DomainMetaData
from boto.sdb.item import Item
+from boto.sdb.regioninfo import SDBRegionInfo
from boto.exception import SDBResponseError
from boto.resultset import ResultSet
import warnings
@@ -48,18 +49,28 @@ class ItemThread(threading.Thread):
class SDBConnection(AWSQueryConnection):
+ DefaultRegionName = 'us-east-1'
+ DefaultRegionEndpoint = 'sdb.amazonaws.com'
APIVersion = '2007-11-07'
SignatureVersion = '2'
ResponseError = SDBResponseError
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
is_secure=True, port=None, proxy=None, proxy_port=None,
- proxy_user=None, proxy_pass=None, host='sdb.amazonaws.com', debug=0,
- https_connection_factory=None, path='/'):
+ proxy_user=None, proxy_pass=None, debug=0,
+ https_connection_factory=None, region=None, path='/', converter=None):
+ if not region:
+ region = SDBRegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint)
+ self.region = region
AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key,
is_secure, port, proxy, proxy_port, proxy_user, proxy_pass,
- host, debug, https_connection_factory, path)
+ self.region.endpoint, debug, https_connection_factory, path)
self.box_usage = 0.0
+ self.converter = converter
+ self.item_cls = Item
+
+ def set_item_cls(self, cls):
+ self.item_cls = cls
def build_name_value_list(self, params, attributes, replace=False):
keys = attributes.keys()
@@ -70,12 +81,16 @@ class SDBConnection(AWSQueryConnection):
if isinstance(value, list):
for v in value:
params['Attribute.%d.Name'%i] = key
+ if self.converter:
+ v = self.converter.encode(v)
params['Attribute.%d.Value'%i] = v
if replace:
params['Attribute.%d.Replace'%i] = 'true'
i += 1
else:
params['Attribute.%d.Name'%i] = key
+ if self.converter:
+ value = self.converter.encode(value)
params['Attribute.%d.Value'%i] = value
if replace:
params['Attribute.%d.Replace'%i] = 'true'
@@ -93,6 +108,8 @@ class SDBConnection(AWSQueryConnection):
value = item[attr_name]
if isinstance(value, list):
for v in value:
+ if self.converter:
+ v = self.converter.encode(v)
params['Item.%d.Attribute.%d.Name' % (i,j)] = attr_name
params['Item.%d.Attribute.%d.Value' % (i,j)] = v
if replace:
@@ -100,6 +117,8 @@ class SDBConnection(AWSQueryConnection):
j += 1
else:
params['Item.%d.Attribute.%d.Name' % (i,j)] = attr_name
+ if self.converter:
+ value = self.converter.encode(value)
params['Item.%d.Attribute.%d.Value' % (i,j)] = value
if replace:
params['Item.%d.Attribute.%d.Replace' % (i,j)] = 'true'
@@ -117,8 +136,8 @@ class SDBConnection(AWSQueryConnection):
"""
Returns the BoxUsage accumulated on this SDBConnection object.
- @rtype: float
- @return: The accumulated BoxUsage of all requests made on the connection.
+ :rtype: float
+ :return: The accumulated BoxUsage of all requests made on the connection.
"""
return self.box_usage
@@ -140,11 +159,11 @@ class SDBConnection(AWSQueryConnection):
"""
Lookup an existing SimpleDB domain
- @type domain_name: string
- @param domain_name: The name of the new domain
+ :type domain_name: string
+ :param domain_name: The name of the new domain
- @rtype: L{Domain<boto.sdb.domain.Domain>} object or None
- @return: The Domain object or None if the domain does not exist.
+ :rtype: :class:`boto.sdb.domain.Domain` object or None
+ :return: The Domain object or None if the domain does not exist.
"""
try:
domain = self.get_domain(domain_name, validate)
@@ -164,11 +183,11 @@ class SDBConnection(AWSQueryConnection):
"""
Create a SimpleDB domain.
- @type domain_name: string
- @param domain_name: The name of the new domain
+ :type domain_name: string
+ :param domain_name: The name of the new domain
- @rtype: L{Domain<boto.sdb.domain.Domain>} object
- @return: The newly created domain
+ :rtype: :class:`boto.sdb.domain.Domain` object
+ :return: The newly created domain
"""
params = {'DomainName':domain_name}
d = self.get_object('CreateDomain', params, Domain)
@@ -185,11 +204,11 @@ class SDBConnection(AWSQueryConnection):
"""
Delete a SimpleDB domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
B{Note:} This will delete the domain and all items within the domain.
"""
@@ -201,11 +220,11 @@ class SDBConnection(AWSQueryConnection):
"""
Get the Metadata for a SimpleDB domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @rtype: L{DomainMetaData<boto.sdb.domain.DomainMetaData>} object
- @return: The newly created domain metadata object
+ :rtype: :class:`boto.sdb.domain.DomainMetaData` object
+ :return: The newly created domain metadata object
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'DomainName':domain_name}
@@ -217,22 +236,22 @@ class SDBConnection(AWSQueryConnection):
"""
Store attributes for a given item in a domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type item_name: string
- @param item_name: The name of the item whose attributes are being stored.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being stored.
- @type attribute_names: dict or dict-like object
- @param attribute_names: The name/value pairs to store as attributes
+ :type attribute_names: dict or dict-like object
+ :param attribute_names: The name/value pairs to store as attributes
- @type replace: bool
- @param replace: Whether the attribute values passed in will replace
+ :type replace: bool
+ :param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'DomainName' : domain_name,
@@ -244,23 +263,23 @@ class SDBConnection(AWSQueryConnection):
"""
Store attributes for multiple items in a domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type items: dict or dict-like object
- @param items: A dictionary-like object. The keys of the dictionary are
+ :type items: dict or dict-like object
+ :param items: A dictionary-like object. The keys of the dictionary are
the item names and the values are themselves dictionaries
of attribute names/values, exactly the same as the
attribute_names parameter of the scalar put_attributes
call.
- @type replace: bool
- @param replace: Whether the attribute values passed in will replace
+ :type replace: bool
+ :param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'DomainName' : domain_name}
@@ -271,19 +290,19 @@ class SDBConnection(AWSQueryConnection):
"""
Retrieve attributes for a given item in a domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type item_name: string
- @param item_name: The name of the item whose attributes are being retrieved.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being retrieved.
- @type attribute_names: string or list of strings
- @param attribute_names: An attribute name or list of attribute names. This
+ :type attribute_names: string or list of strings
+ :param attribute_names: An attribute name or list of attribute names. This
parameter is optional. If not supplied, all attributes
will be retrieved for the item.
- @rtype: L{Item<boto.sdb.item.Item>}
- @return: An Item mapping type containing the requested attribute name/values
+ :rtype: :class:`boto.sdb.item.Item`
+ :return: An Item mapping type containing the requested attribute name/values
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'DomainName' : domain_name,
@@ -296,7 +315,7 @@ class SDBConnection(AWSQueryConnection):
body = response.read()
if response.status == 200:
if item == None:
- item = Item(domain, item_name)
+ item = self.item_cls(domain, item_name)
h = handler.XmlHandler(item, self)
xml.sax.parseString(body, h)
return item
@@ -307,21 +326,21 @@ class SDBConnection(AWSQueryConnection):
"""
Delete attributes from a given item in a domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type item_name: string
- @param item_name: The name of the item whose attributes are being deleted.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being deleted.
- @type attributes: dict, list or L{Item<boto.sdb.item.Item>}
- @param attributes: Either a list containing attribute names which will cause
+ :type attributes: dict, list or :class:`boto.sdb.item.Item`
+ :param attributes: Either a list containing attribute names which will cause
all values associated with that attribute name to be deleted or
a dict or Item containing the attribute names and keys and list
of values to delete as the value. If no value is supplied,
all attribute name/values for the item will be deleted.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'DomainName':domain_name,
@@ -329,7 +348,7 @@ class SDBConnection(AWSQueryConnection):
if attr_names:
if isinstance(attr_names, list):
self.build_name_list(params, attr_names)
- elif isinstance(attr_names, dict) or isinstance(attr_names, Item):
+ elif isinstance(attr_names, dict) or isinstance(attr_names, self.item_cls):
self.build_name_value_list(params, attr_names)
return self.get_status('DeleteAttributes', params)
@@ -337,19 +356,19 @@ class SDBConnection(AWSQueryConnection):
"""
Returns a list of item names within domain_name that match the query.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type query: string
- @param query: The SimpleDB query to be performed.
+ :type query: string
+ :param query: The SimpleDB query to be performed.
- @type max_items: int
- @param max_items: The maximum number of items to return. If not
+ :type max_items: int
+ :param max_items: The maximum number of items to return. If not
supplied, the default is None which returns all
items matching the query.
- @rtype: ResultSet
- @return: An iterator containing the results.
+ :rtype: ResultSet
+ :return: An iterator containing the results.
"""
warnings.warn('Query interface is deprecated', DeprecationWarning)
domain, domain_name = self.get_domain_and_name(domain_or_name)
@@ -366,24 +385,24 @@ class SDBConnection(AWSQueryConnection):
"""
Returns a set of Attributes for item names within domain_name that match the query.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type query: string
- @param query: The SimpleDB query to be performed.
+ :type query: string
+ :param query: The SimpleDB query to be performed.
- @type attr_names: list
- @param attr_names: The name of the attributes to be returned.
+ :type attr_names: list
+ :param attr_names: The name of the attributes to be returned.
If no attributes are specified, all attributes
will be returned.
- @type max_items: int
- @param max_items: The maximum number of items to return. If not
+ :type max_items: int
+ :param max_items: The maximum number of items to return. If not
supplied, the default is None which returns all
items matching the query.
- @rtype: ResultSet
- @return: An iterator containing the results.
+ :rtype: ResultSet
+ :return: An iterator containing the results.
"""
warnings.warn('Query interface is deprecated', DeprecationWarning)
domain, domain_name = self.get_domain_and_name(domain_or_name)
@@ -395,7 +414,7 @@ class SDBConnection(AWSQueryConnection):
params['NextToken'] = next_token
if attr_names:
self.build_list_params(params, attr_names, 'AttributeName')
- return self.get_list('QueryWithAttributes', params, [('Item', Item)], parent=domain)
+ return self.get_list('QueryWithAttributes', params, [('Item', self.item_cls)], parent=domain)
def select(self, domain_or_name, query='', next_token=None):
"""
@@ -406,20 +425,20 @@ class SDBConnection(AWSQueryConnection):
object must be passed into this method so the Item objects returned can
point to the appropriate domain.
- @type domain_or_name: string or L{Domain<boto.sdb.domain.Domain>} object.
- @param domain_or_name: Either the name of a domain or a Domain object
+ :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object.
+ :param domain_or_name: Either the name of a domain or a Domain object
- @type query: string
- @param query: The SimpleDB query to be performed.
+ :type query: string
+ :param query: The SimpleDB query to be performed.
- @rtype: ResultSet
- @return: An iterator containing the results.
+ :rtype: ResultSet
+ :return: An iterator containing the results.
"""
domain, domain_name = self.get_domain_and_name(domain_or_name)
params = {'SelectExpression' : query}
if next_token:
params['NextToken'] = next_token
- return self.get_list('Select', params, [('Item', Item)], parent=domain)
+ return self.get_list('Select', params, [('Item', self.item_cls)], parent=domain)
def threaded_query(self, domain_or_name, query='', max_items=None, next_token=None, num_threads=6):
"""
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/blob.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/blob.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/blob.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/blob.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/blob.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/blob.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/blob.py Sun Jun 5 08:34:02 2011
@@ -19,19 +19,46 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+
class Blob(object):
- """
- Blob object
- """
+ """Blob object"""
def __init__(self, value=None, file=None, id=None):
- self.file = file
+ self._file = file
self.id = id
self.value = value
+ @property
+ def file(self):
+ from StringIO import StringIO
+ if self._file:
+ f = self._file
+ else:
+ f = StringIO(self.value)
+ return f
+
def __str__(self):
- return str(self.read())
+ if hasattr(self.file, "get_contents_as_string"):
+ return str(self.file.get_contents_as_string())
+ else:
+ return str(self.file.getvalue())
def read(self):
- if not self.value:
- self.value = self.file.read()
- return self.value
+ return self.file.read()
+
+ def readline(self):
+ return self.file.readline()
+
+ def next(self):
+ return sefl.file.next()
+
+ def __iter__(self):
+ return iter(self.file)
+
+ @property
+ def size(self):
+ if self._file:
+ return self._file.size
+ elif self.value:
+ return len(self.value)
+ else:
+ return 0
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/key.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/key.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/key.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/key.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/key.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/__init__.py Sun Jun 5 08:34:02 2011
@@ -23,7 +23,8 @@ import boto
def get_manager(cls):
"""
Returns the appropriate Manager class for a given Model class. It does this by
- looking in the boto config for a section like this:
+ looking in the boto config for a section like this::
+
[DB]
db_type = SimpleDB
db_user = <aws access key id>
@@ -35,6 +36,7 @@ def get_manager(cls):
db_passwd = <another aws secret access key>
db_name = basic_domain
db_port = 1111
+
The values in the DB section are "generic values" that will be used if nothing more
specific is found. You can also create a section for a specific Model class that
gives the db info for that class. In the example above, TestBasic is a Model subclass.
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/pgmanager.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/pgmanager.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/pgmanager.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/pgmanager.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/pgmanager.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/sdbmanager.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/sdbmanager.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/sdbmanager.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/sdbmanager.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/sdbmanager.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/sdbmanager.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/sdbmanager.py Sun Jun 5 08:34:02 2011
@@ -49,6 +49,7 @@ class SDBConverter:
self.type_map = { bool : (self.encode_bool, self.decode_bool),
int : (self.encode_int, self.decode_int),
long : (self.encode_long, self.decode_long),
+ float : (self.encode_float, self.decode_float),
Model : (self.encode_reference, self.decode_reference),
Key : (self.encode_reference, self.decode_reference),
datetime : (self.encode_datetime, self.decode_datetime),
@@ -163,7 +164,58 @@ class SDBConverter:
else:
return False
+ def encode_float(self, value):
+ """
+ See http://tools.ietf.org/html/draft-wood-ldapext-float-00.
+ """
+ s = '%e' % value
+ l = s.split('e')
+ mantissa = l[0].ljust(18, '0')
+ exponent = l[1]
+ if value == 0.0:
+ case = '3'
+ exponent = '000'
+ elif mantissa[0] != '-' and exponent[0] == '+':
+ case = '5'
+ exponent = exponent[1:].rjust(3, '0')
+ elif mantissa[0] != '-' and exponent[0] == '-':
+ case = '4'
+ exponent = 999 + int(exponent)
+ exponent = '%03d' % exponent
+ elif mantissa[0] == '-' and exponent[0] == '-':
+ case = '2'
+ mantissa = '%f' % (10 + float(mantissa))
+ mantissa = mantissa.ljust(18, '0')
+ exponent = exponent[1:].rjust(3, '0')
+ else:
+ case = '1'
+ mantissa = '%f' % (10 + float(mantissa))
+ mantissa = mantissa.ljust(18, '0')
+ exponent = 999 - int(exponent)
+ exponent = '%03d' % exponent
+ return '%s %s %s' % (case, exponent, mantissa)
+
+ def decode_float(self, value):
+ case = value[0]
+ exponent = value[2:5]
+ mantissa = value[6:]
+ if case == '3':
+ return 0.0
+ elif case == '5':
+ pass
+ elif case == '4':
+ exponent = '%03d' % (int(exponent) - 999)
+ elif case == '2':
+ mantissa = '%f' % (float(mantissa) - 10)
+ exponent = '-' + exponent
+ else:
+ mantissa = '%f' % (float(mantissa) - 10)
+ exponent = '%03d' % abs((int(exponent) - 999))
+ return float(mantissa + 'e' + exponent)
+
def encode_datetime(self, value):
+ if isinstance(value, str) or isinstance(value, unicode):
+ return value
return value.strftime(ISO8601)
def decode_datetime(self, value):
@@ -183,10 +235,7 @@ class SDBConverter:
def decode_reference(self, value):
if not value:
return None
- try:
- return self.manager.get_object_from_id(value)
- except:
- return None
+ return value
def encode_blob(self, value):
if not value:
@@ -205,7 +254,8 @@ class SDBConverter:
else:
raise SDBPersistenceError("Invalid Blob ID: %s" % value.id)
- key.set_contents_from_string(value.value)
+ if value.value != None:
+ key.set_contents_from_string(value.value)
return value.id
@@ -245,10 +295,7 @@ class SDBManager(object):
def _connect(self):
self.sdb = boto.connect_sdb(aws_access_key_id=self.db_user,
aws_secret_access_key=self.db_passwd,
- port=self.db_port,
- host=self.db_host,
- is_secure=self.enable_ssl
- )
+ is_secure=self.enable_ssl)
# This assumes that the domain has already been created
# It's much more efficient to do it this way rather than
# having this make a roundtrip each time to validate.
@@ -264,6 +311,10 @@ class SDBManager(object):
yield obj
def encode_value(self, prop, value):
+ if value == None:
+ return None
+ if not prop:
+ return str(value)
return self.converter.encode_prop(prop, value)
def decode_value(self, prop, value):
@@ -319,10 +370,13 @@ class SDBManager(object):
def get_object_from_id(self, id):
return self.get_object(None, id)
- def query(self, cls, filters, limit=None, order_by=None):
- query = "select * from `%s` %s" % (self.domain.name, self._build_filter_part(cls, filters, order_by))
- rs = self.domain.select(query)
- return self._object_lister(cls, rs)
+ def query(self, query):
+ query_str = "select * from `%s` %s" % (self.domain.name, self._build_filter_part(query.model_class, query.filters, query.sort_by))
+ if query.limit:
+ query_str += " limit %s" % query.limit
+ rs = self.domain.select(query_str, max_items=query.limit, next_token = query.next_token)
+ query.rs = rs
+ return self._object_lister(query.model_class, rs)
def count(self, cls, filters):
"""
@@ -348,11 +402,9 @@ class SDBManager(object):
order_by_method = "asc";
for filter in filters:
- (name, op) = filter[0].strip().split(" ")
+ (name, op) = filter[0].strip().split(" ", 1)
value = filter[1]
property = cls.find_property(name)
- if not property:
- raise AttributeError("Unknown Property: %s" % name)
if name == order_by:
order_by_filtered = True
if types.TypeType(value) == types.ListType:
@@ -368,6 +420,8 @@ class SDBManager(object):
else:
if op == 'is' and value == None:
query_parts.append("`%s` is null" % name)
+ elif op == 'is not' and value == None:
+ query_parts.append("`%s` is not null" % name)
else:
val = self.encode_value(property, value)
if isinstance(val, list):
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/xmlmanager.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/xmlmanager.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/xmlmanager.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/xmlmanager.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/xmlmanager.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/manager/xmlmanager.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/manager/xmlmanager.py Sun Jun 5 08:34:02 2011
@@ -309,7 +309,7 @@ class XMLManager(object):
"""
Pull out the properties from this document
Returns the class, the properties in a hash, and the id if provided as a tuple
- @return: (cls, props, id)
+ :return: (cls, props, id)
"""
obj_node = doc.getElementsByTagName('object')[0]
if not cls:
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/model.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/model.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/model.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/model.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/model.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/model.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/model.py Sun Jun 5 08:34:02 2011
@@ -87,8 +87,8 @@ class Model(object):
raise NotImplementedError, "Key Names are not currently supported"
@classmethod
- def find(cls, **params):
- q = Query(cls)
+ def find(cls, limit=None, next_token=None, **params):
+ q = Query(cls, limit=limit, next_token=next_token)
for key, value in params.items():
q.filter('%s =' % key, value)
return q
@@ -98,8 +98,8 @@ class Model(object):
return cls._manager.lookup(cls, name, value)
@classmethod
- def all(cls, max_items=None):
- return cls.find()
+ def all(cls, limit=None, next_token=None):
+ return cls.find(limit=limit, next_token=next_token)
@classmethod
def get_or_insert(key_name, **kw):
@@ -158,7 +158,12 @@ class Model(object):
self.id = id
for key in kw:
if key != 'manager':
- setattr(self, key, kw[key])
+ # We don't want any errors populating up when loading an object,
+ # so if it fails we just revert to it's default value
+ try:
+ setattr(self, key, kw[key])
+ except Exception, e:
+ boto.log.exception(e)
def __repr__(self):
return '%s<%s>' % (self.__class__.__name__, self.id)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/property.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/property.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/property.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/property.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/property.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/property.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/property.py Sun Jun 5 08:34:02 2011
@@ -35,6 +35,7 @@ class Property(object):
data_type = str
type_name = ''
name = ''
+ verbose_name = ''
def __init__(self, verbose_name=None, name=None, default=None, required=False,
validator=None, choices=None, unique=False):
@@ -56,6 +57,15 @@ class Property(object):
def __set__(self, obj, value):
self.validate(value)
+
+ # Fire off any on_set functions
+ try:
+ if obj._loaded and hasattr(obj, "on_set_%s" % self.name):
+ fnc = getattr(obj, "on_set_%s" % self.name)
+ value = fnc(value)
+ except Exception, e:
+ boto.log.exception("Exception running on_set_%s" % self.name)
+
setattr(obj, self.slot_name, value)
def __property_config__(self, model_class, property_name):
@@ -75,8 +85,8 @@ class Property(object):
def validate(self, value):
if self.required and value==None:
raise ValueError, '%s is a required property' % self.name
- if self.choices and not value in self.choices:
- raise ValueError, '%s not a valid choice for %s' % (value, self.name)
+ if self.choices and value and not value in self.choices:
+ raise ValueError, '%s not a valid choice for %s.%s' % (value, self.model_class.__name__, self.name)
if self.validator:
self.validator(value)
else:
@@ -112,17 +122,20 @@ class StringProperty(Property):
validator=validate_string, choices=None, unique=False):
Property.__init__(self, verbose_name, name, default, required, validator, choices, unique)
-def validate_text(value):
- if not isinstance(value, str) and not isinstance(value, unicode):
- raise TypeError, 'Expecting Text, got %s' % type(value)
-
class TextProperty(Property):
type_name = 'Text'
def __init__(self, verbose_name=None, name=None, default='', required=False,
- validator=validate_text, choices=None, unique=False):
+ validator=None, choices=None, unique=False, max_length=None):
Property.__init__(self, verbose_name, name, default, required, validator, choices, unique)
+ self.max_length = max_length
+
+ def validate(self, value):
+ if not isinstance(value, str) and not isinstance(value, unicode):
+ raise TypeError, 'Expecting Text, got %s' % type(value)
+ if self.max_length and len(value) > self.max_length:
+ raise ValueError, 'Length of value greater than maxlength %s' % self.max_length
class PasswordProperty(StringProperty):
"""
@@ -172,7 +185,11 @@ class BlobProperty(Property):
def __set__(self, obj, value):
if value != self.default_value():
if not isinstance(value, Blob):
- b = Blob(value=value)
+ oldb = self.__get__(obj, type(obj))
+ id = None
+ if oldb:
+ id = oldb.id
+ b = Blob(value=value, id=id)
value = b
Property.__set__(self, obj, value)
@@ -206,7 +223,11 @@ class S3KeyProperty(Property):
if match:
s3 = obj._manager.get_s3_connection()
bucket = s3.get_bucket(match.group(1), validate=False)
- return bucket.get_key(match.group(2))
+ k = bucket.get_key(match.group(2))
+ if not k:
+ k = bucket.new_key(match.group(2))
+ k.set_contents_from_string("")
+ return k
else:
return value
@@ -223,18 +244,18 @@ class IntegerProperty(Property):
type_name = 'Integer'
def __init__(self, verbose_name=None, name=None, default=0, required=False,
- validator=None, choices=None, unique=False):
+ validator=None, choices=None, unique=False, max=2147483647, min=-2147483648):
Property.__init__(self, verbose_name, name, default, required, validator, choices, unique)
+ self.max = max
+ self.min = min
def validate(self, value):
value = int(value)
value = Property.validate(self, value)
- min = -2147483648
- max = 2147483647
- if value > max:
- raise ValueError, 'Maximum value is %d' % max
- if value < min:
- raise ValueError, 'Minimum value is %d' % min
+ if value > self.max:
+ raise ValueError, 'Maximum value is %d' % self.max
+ if value < self.min:
+ raise ValueError, 'Minimum value is %d' % self.min
return value
def empty(self, value):
@@ -275,6 +296,23 @@ class BooleanProperty(Property):
def empty(self, value):
return value is None
+class FloatProperty(Property):
+
+ data_type = float
+ type_name = 'Float'
+
+ def __init__(self, verbose_name=None, name=None, default=0.0, required=False,
+ validator=None, choices=None, unique=False):
+ Property.__init__(self, verbose_name, name, default, required, validator, choices, unique)
+
+ def validate(self, value):
+ value = float(value)
+ value = Property.validate(self, value)
+ return value
+
+ def empty(self, value):
+ return value is None
+
class DateTimeProperty(Property):
data_type = datetime.datetime
@@ -291,13 +329,19 @@ class DateTimeProperty(Property):
return self.now()
return Property.default_value(self)
+ def validate(self, value):
+ if value == None:
+ return
+ if not isinstance(value, self.data_type):
+ raise TypeError, 'Validation Error, expecting %s, got %s' % (self.data_type, type(value))
+
def get_value_for_datastore(self, model_instance):
if self.auto_now:
setattr(model_instance, self.name, self.now())
return Property.get_value_for_datastore(self, model_instance)
def now(self):
- return datetime.datetime.now()
+ return datetime.datetime.utcnow()
class ReferenceProperty(Property):
@@ -319,18 +363,25 @@ class ReferenceProperty(Property):
# the object now that is the attribute has actually been accessed. This lazy
# instantiation saves unnecessary roundtrips to SimpleDB
if isinstance(value, str) or isinstance(value, unicode):
- value = self.reference_class._manager.get_object(self.reference_class, value)
+ # This is some minor handling to allow us to use the base "Model" class
+ # as our reference class. If we do so, we're going to assume we're using
+ # our own class's manager to fetch objects
+ if hasattr(self.reference_class, "_manager"):
+ manager = self.reference_class._manager
+ else:
+ manager = obj._manager
+ value = manager.get_object(self.reference_class, value)
setattr(obj, self.name, value)
return value
def __property_config__(self, model_class, property_name):
Property.__property_config__(self, model_class, property_name)
if self.collection_name is None:
- self.collection_name = '%s_set' % (model_class.__name__.lower())
+ self.collection_name = '%s_%s_set' % (model_class.__name__.lower(), self.name)
if hasattr(self.reference_class, self.collection_name):
raise ValueError, 'duplicate property: %s' % self.collection_name
setattr(self.reference_class, self.collection_name,
- _ReverseReferenceProperty(model_class, property_name))
+ _ReverseReferenceProperty(model_class, property_name, self.collection_name))
def check_uuid(self, value):
# This does a bit of hand waving to "type check" the string
@@ -357,10 +408,14 @@ class ReferenceProperty(Property):
self.check_instance(value)
class _ReverseReferenceProperty(Property):
+ data_type = Query
+ type_name = 'query'
- def __init__(self, model, prop):
+ def __init__(self, model, prop, name):
self.__model = model
self.__property = prop
+ self.name = name
+ self.item_type = model
def __get__(self, model_instance, model_class):
"""Fetches collection of model instances of this collection property."""
@@ -405,7 +460,11 @@ class CalculatedProperty(Property):
setattr(obj, self.slot_name, value)
def get_value_for_datastore(self, model_instance):
- return None
+ if self.calculated_type in [str, int, bool]:
+ value = self.__get__(model_instance, model_instance.__class__)
+ return value
+ else:
+ return None
class ListProperty(Property):
@@ -445,6 +504,19 @@ class ListProperty(Property):
def default_value(self):
return list(super(ListProperty, self).default_value())
+ def __set__(self, obj, value):
+ """Override the set method to allow them to set the property to an instance of the item_type instead of requiring a list to be passed in"""
+ if self.item_type in (int, long):
+ item_type = (int, long)
+ elif self.item_type in (str, unicode):
+ item_type = (str, unicode)
+ else:
+ item_type = self.item_type
+ if isinstance(value, item_type):
+ value = [value]
+ return super(ListProperty, self).__set__(obj,value)
+
+
class MapProperty(Property):
data_type = dict
@@ -482,4 +554,3 @@ class MapProperty(Property):
def default_value(self):
return {}
-
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/query.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/query.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/query.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/query.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/query.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/query.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/query.py Sun Jun 5 08:34:02 2011
@@ -20,22 +20,26 @@
# IN THE SOFTWARE.
class Query(object):
-
- def __init__(self, model_class, manager=None):
+ __local_iter__ = None
+ def __init__(self, model_class, limit=None, next_token=None, manager=None):
self.model_class = model_class
+ self.limit = limit
if manager:
self.manager = manager
else:
self.manager = self.model_class._manager
self.filters = []
- self.limit = None
self.sort_by = None
+ self.rs = None
+ self.next_token = next_token
def __iter__(self):
- return iter(self.manager.query(self.model_class, self.filters, self.limit, self.sort_by))
+ return iter(self.manager.query(self))
def next(self):
- return self.__iter__().next()
+ if self.__local_iter__ == None:
+ self.__local_iter__ = self.__iter__()
+ return self.__local_iter__.next()
def filter(self, property_operator, value):
self.filters.append((property_operator, value))
@@ -58,3 +62,15 @@ class Query(object):
for obj in self:
obj.to_xml(doc)
return doc
+
+ def get_next_token(self):
+ if self.rs:
+ return self.rs.next_token
+ if self._next_token:
+ return self._next_token
+ return None
+
+ def set_next_token(self, token):
+ self._next_token = token
+
+ next_token = property(get_next_token, set_next_token)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/test_db.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/test_db.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/test_db.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/test_db.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/test_db.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/db/test_db.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/db/test_db.py Sun Jun 5 08:34:02 2011
@@ -19,6 +19,11 @@ class TestBasic(Model):
foo = BooleanProperty()
date = DateTimeProperty()
+class TestFloat(Model):
+
+ name = StringProperty()
+ value = FloatProperty()
+
class TestRequired(Model):
req = StringProperty(required=True, default='foo')
@@ -80,6 +85,23 @@ def test_basic():
assert t.name == tt.name
#assert t.date == tt.date
return t
+
+def test_float():
+ global _objects
+ t = TestFloat()
+ t.name = 'float object'
+ t.value = 98.6
+ print 'saving object'
+ t.save()
+ _objects['test_float_t'] = t
+ time.sleep(5)
+ print 'now try retrieving it'
+ tt = TestFloat.get_by_id(t.id)
+ _objects['test_float_tt'] = tt
+ assert tt.id == t.id
+ assert tt.name == t.name
+ assert tt.value == t.value
+ return t
def test_required():
global _objects
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/domain.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/domain.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/domain.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/domain.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/domain.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/domain.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/domain.py Sun Jun 5 08:34:02 2011
@@ -23,7 +23,6 @@
Represents an SDB Domain
"""
from boto.sdb.queryresultset import QueryResultSet, SelectResultSet
-from boto.sdb.item import Item
class Domain:
@@ -36,7 +35,7 @@ class Domain:
return 'Domain:%s' % self.name
def __iter__(self):
- return self.select("SELECT * FROM %s" % self.name)
+ return iter(self.select("SELECT * FROM `%s`" % self.name))
def startElement(self, name, attrs, connection):
return None
@@ -56,19 +55,19 @@ class Domain:
"""
Store attributes for a given item.
- @type item_name: string
- @param item_name: The name of the item whose attributes are being stored.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being stored.
- @type attribute_names: dict or dict-like object
- @param attribute_names: The name/value pairs to store as attributes
+ :type attribute_names: dict or dict-like object
+ :param attribute_names: The name/value pairs to store as attributes
- @type replace: bool
- @param replace: Whether the attribute values passed in will replace
+ :type replace: bool
+ :param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
return self.connection.put_attributes(self, item_name, attributes, replace)
@@ -76,20 +75,20 @@ class Domain:
"""
Store attributes for multiple items.
- @type items: dict or dict-like object
- @param items: A dictionary-like object. The keys of the dictionary are
+ :type items: dict or dict-like object
+ :param items: A dictionary-like object. The keys of the dictionary are
the item names and the values are themselves dictionaries
of attribute names/values, exactly the same as the
attribute_names parameter of the scalar put_attributes
call.
- @type replace: bool
- @param replace: Whether the attribute values passed in will replace
+ :type replace: bool
+ :param replace: Whether the attribute values passed in will replace
existing values or will be added as addition values.
Defaults to True.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
return self.connection.batch_put_attributes(self, items, replace)
@@ -97,16 +96,16 @@ class Domain:
"""
Retrieve attributes for a given item.
- @type item_name: string
- @param item_name: The name of the item whose attributes are being retrieved.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being retrieved.
- @type attribute_names: string or list of strings
- @param attribute_names: An attribute name or list of attribute names. This
+ :type attribute_names: string or list of strings
+ :param attribute_names: An attribute name or list of attribute names. This
parameter is optional. If not supplied, all attributes
will be retrieved for the item.
- @rtype: L{Item<boto.sdb.item.Item>}
- @return: An Item mapping type containing the requested attribute name/values
+ :rtype: :class:`boto.sdb.item.Item`
+ :return: An Item mapping type containing the requested attribute name/values
"""
return self.connection.get_attributes(self, item_name, attribute_name, item)
@@ -114,18 +113,18 @@ class Domain:
"""
Delete attributes from a given item.
- @type item_name: string
- @param item_name: The name of the item whose attributes are being deleted.
+ :type item_name: string
+ :param item_name: The name of the item whose attributes are being deleted.
- @type attributes: dict, list or L{Item<boto.sdb.item.Item>}
- @param attributes: Either a list containing attribute names which will cause
+ :type attributes: dict, list or :class:`boto.sdb.item.Item`
+ :param attributes: Either a list containing attribute names which will cause
all values associated with that attribute name to be deleted or
a dict or Item containing the attribute names and keys and list
of values to delete as the value. If no value is supplied,
all attribute name/values for the item will be deleted.
- @rtype: bool
- @return: True if successful
+ :rtype: bool
+ :return: True if successful
"""
return self.connection.delete_attributes(self, item_name, attributes)
@@ -133,21 +132,21 @@ class Domain:
"""
Returns a list of items within domain that match the query.
- @type query: string
- @param query: The SimpleDB query to be performed.
+ :type query: string
+ :param query: The SimpleDB query to be performed.
- @type max_items: int
- @param max_items: The maximum number of items to return. If not
+ :type max_items: int
+ :param max_items: The maximum number of items to return. If not
supplied, the default is None which returns all
items matching the query.
- @type attr_names: list
- @param attr_names: Either None, meaning return all attributes
+ :type attr_names: list
+ :param attr_names: Either None, meaning return all attributes
or a list of attribute names which means to return
only those attributes.
- @rtype: iter
- @return: An iterator containing the results. This is actually a generator
+ :rtype: iter
+ :return: An iterator containing the results. This is actually a generator
function that will iterate across all search results, not just the
first page.
"""
@@ -159,18 +158,19 @@ class Domain:
The query must be expressed in using the SELECT style syntax rather than the
original SimpleDB query language.
- @type query: string
- @param query: The SimpleDB query to be performed.
+ :type query: string
+ :param query: The SimpleDB query to be performed.
- @type max_items: int
- @param max_items: The maximum number of items to return.
+ :type max_items: int
+ :param max_items: The maximum number of items to return.
- @rtype: iter
- @return: An iterator containing the results. This is actually a generator
+ :rtype: iter
+ :return: An iterator containing the results. This is actually a generator
function that will iterate across all search results, not just the
first page.
"""
- return iter(SelectResultSet(self, query, max_items))
+ return SelectResultSet(self, query, max_items=max_items,
+ next_token=next_token)
def get_item(self, item_name):
item = self.get_attributes(item_name)
@@ -181,42 +181,49 @@ class Domain:
return None
def new_item(self, item_name):
- return Item(self, item_name)
+ return self.connection.item_cls(self, item_name)
def delete_item(self, item):
self.delete_attributes(item.name)
- def to_xml(self):
- """
- Get this domain as an XML DOM Document
- """
- from xml.dom.minidom import getDOMImplementation
- impl = getDOMImplementation()
- doc = impl.createDocument(None, 'Domain', None)
- doc.documentElement.setAttribute("id", self.name)
+ def to_xml(self, f=None):
+ """Get this domain as an XML DOM Document
+ :param f: Optional File to dump directly to
+ :type f: File or Stream
+
+ :return: File object where the XML has been dumped to
+ :rtype: file
+ """
+ if not f:
+ from tempfile import TemporaryFile
+ f = TemporaryFile()
+ print >>f, '<?xml version="1.0" encoding="UTF-8"?>'
+ print >>f, '<Domain id="%s">' % self.name
for item in self:
- obj_node = doc.createElement('Item')
- obj_node.setAttribute("id", item.name)
+ print >>f, '\t<Item id="%s">' % item.name
for k in item:
- attr_node = doc.createElement("attribute")
- attr_node.setAttribute("id", k)
+ print >>f, '\t\t<attribute id="%s">' % k
values = item[k]
if not isinstance(values, list):
- values = [item[k]]
-
+ values = [values]
for value in values:
- value_node = doc.createElement("value")
- value_node.appendChild(doc.createTextNode(str(value.encode('utf-8'))))
- attr_node.appendChild(value_node)
-
- obj_node.appendChild(attr_node)
- doc.documentElement.appendChild(obj_node)
- return doc
+ print >>f, '\t\t\t<value><![CDATA[',
+ if isinstance(value, unicode):
+ value = value.encode('utf-8', 'replace')
+ else:
+ value = unicode(value, errors='replace').encode('utf-8', 'replace')
+ f.write(value)
+ print >>f, ']]></value>'
+ print >>f, '\t\t</attribute>'
+ print >>f, '\t</Item>'
+ print >>f, '</Domain>'
+ f.flush()
+ f.seek(0)
+ return f
+
def from_xml(self, doc):
- """
- Load this domain based on an XML document
- """
+ """Load this domain based on an XML document"""
import xml.sax
handler = DomainDumpParser(self)
xml.sax.parse(doc, handler)
@@ -255,6 +262,7 @@ class DomainMetaData:
else:
setattr(self, name, value)
+import sys
from xml.sax.handler import ContentHandler
class DomainDumpParser(ContentHandler):
"""
@@ -262,15 +270,17 @@ class DomainDumpParser(ContentHandler):
"""
def __init__(self, domain):
- self.items = []
- self.item = None
+ self.uploader = UploaderThread(domain.name)
+ self.item_id = None
+ self.attrs = {}
self.attribute = None
self.value = ""
self.domain = domain
def startElement(self, name, attrs):
if name == "Item":
- self.item = self.domain.new_item(attrs['id'])
+ self.item_id = attrs['id']
+ self.attrs = {}
elif name == "attribute":
self.attribute = attrs['id']
elif name == "value":
@@ -282,7 +292,39 @@ class DomainDumpParser(ContentHandler):
def endElement(self, name):
if name == "value":
if self.value and self.attribute:
- self.item.add_value(self.attribute, self.value.strip())
+ value = self.value.strip()
+ attr_name = self.attribute.strip()
+ if self.attrs.has_key(attr_name):
+ self.attrs[attr_name].append(value)
+ else:
+ self.attrs[attr_name] = [value]
elif name == "Item":
- self.item.save()
-
+ self.uploader.items[self.item_id] = self.attrs
+ # Every 40 items we spawn off the uploader
+ if len(self.uploader.items) >= 40:
+ self.uploader.start()
+ self.uploader = UploaderThread(self.domain.name)
+ elif name == "Domain":
+ # If we're done, spawn off our last Uploader Thread
+ self.uploader.start()
+
+from threading import Thread
+class UploaderThread(Thread):
+ """Uploader Thread"""
+
+ def __init__(self, domain_name):
+ import boto
+ self.sdb = boto.connect_sdb()
+ self.db = self.sdb.get_domain(domain_name)
+ self.items = {}
+ Thread.__init__(self)
+
+ def run(self):
+ try:
+ self.db.batch_put_attributes(self.items)
+ except:
+ print "Exception using batch put, trying regular put instead"
+ for item_name in self.items:
+ self.db.put_attributes(item_name, self.items[item_name])
+ print ".",
+ sys.stdout.flush()
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/item.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/item.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/item.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/item.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/item.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/item.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/item.py Sun Jun 5 08:34:02 2011
@@ -23,19 +23,19 @@
Represents an SDB Item
"""
-from UserDict import DictMixin
import base64
-class Item(DictMixin):
+class Item(dict):
def __init__(self, domain, name='', active=False):
+ dict.__init__(self)
self.domain = domain
self.name = name
- self._dict = None
self.active = active
self.request_id = None
self.encoding = None
self.in_attribute = False
+ self.converter = self.domain.connection.converter
def startElement(self, name, attrs, connection):
if name == 'Attribute':
@@ -59,14 +59,18 @@ class Item(DictMixin):
else:
self.name = self.decode_value(value)
elif name == 'Value':
- if self._dict == None:
- self._dict = {}
- if self._dict.has_key(self.last_key):
- if not isinstance(self._dict[self.last_key], list):
- self._dict[self.last_key] = [self._dict[self.last_key]]
- self._dict[self.last_key].append(self.decode_value(value))
+ if self.has_key(self.last_key):
+ if not isinstance(self[self.last_key], list):
+ self[self.last_key] = [self[self.last_key]]
+ value = self.decode_value(value)
+ if self.converter:
+ value = self.converter.decode(value)
+ self[self.last_key].append(value)
else:
- self._dict[self.last_key] = self.decode_value(value)
+ value = self.decode_value(value)
+ if self.converter:
+ value = self.converter.decode(value)
+ self[self.last_key] = value
elif name == 'BoxUsage':
try:
connection.box_usage += float(value)
@@ -80,53 +84,11 @@ class Item(DictMixin):
setattr(self, name, value)
def load(self):
- self._dict = {}
self.domain.get_attributes(self.name, item=self)
def save(self, replace=True):
self.domain.put_attributes(self.name, self, replace)
- def __getitem__(self, key):
- if self._dict == None:
- self.load()
- return self._dict[key]
-
- def __setitem__(self, key, value):
- if self._dict == None:
- self.load()
- if self.active:
- self.domain.put_attributes(self.name, {key : value})
- self._dict[key] = value
-
- def __delitem__(self, key):
- if self._dict == None:
- self.load()
- if self.active:
- self.domain.delete_attributes(self.name, [key])
- del self._dict[key]
-
- def update(self, other_dict):
- if self._dict == None:
- self.load()
- if self.active:
- self.domain.put_attributes(self.name, self, replace)
- self._dict.update(other_dict)
-
- def keys(self):
- if self._dict == None:
- self.load()
- return self._dict.keys()
-
- def add_value(self, key, value):
- if self.has_key(key):
- if self.active:
- self.domain.put_attributes(self.name, {key : value}, replace=False)
- if not isinstance(self._dict[key], list):
- self._dict[key] = [self._dict[key]]
- self._dict[key].append(value)
- else:
- self[key] = value
-
def delete(self):
self.domain.delete_item(self)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/checker.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/checker.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/checker.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/checker.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/checker.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/object.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/object.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/object.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/object.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/object.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/property.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/property.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/property.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/property.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/property.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/test_persist.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/test_persist.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/test_persist.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/persist/test_persist.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/persist/test_persist.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/queryresultset.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/queryresultset.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/queryresultset.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/queryresultset.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/queryresultset.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/queryresultset.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/queryresultset.py Sun Jun 5 08:34:02 2011
@@ -63,15 +63,30 @@ def select_lister(domain, query='', max_
next_token = rs.next_token
more_results = next_token != None
-class SelectResultSet:
+class SelectResultSet(object):
- def __init__(self, domain=None, query='', max_items=None):
+ def __init__(self, domain=None, query='', max_items=None,
+ next_token=None):
self.domain = domain
self.query = query
self.max_items = max_items
+ self.next_token = next_token
def __iter__(self):
- return select_lister(self.domain, self.query, self.max_items)
+ more_results = True
+ num_results = 0
+ while more_results:
+ rs = self.domain.connection.select(self.domain, self.query,
+ next_token=self.next_token)
+ for item in rs:
+ if self.max_items and num_results >= self.max_items:
+ raise StopIteration
+ yield item
+ num_results += 1
+ self.next_token = rs.next_token
+ if self.max_items and num_results >= self.max_items:
+ raise StopIteration
+ more_results = self.next_token != None
-
-
+ def next(self):
+ return self.__iter__().next()
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/regioninfo.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/regioninfo.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/regioninfo.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/regioninfo.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/regioninfo.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/regioninfo.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sdb/regioninfo.py Sun Jun 5 08:34:02 2011
@@ -1,4 +1,4 @@
-# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -22,19 +22,19 @@
from boto.ec2.regioninfo import RegionInfo
-class SQSRegionInfo(RegionInfo):
+class SDBRegionInfo(RegionInfo):
def connect(self, **kw_params):
"""
- Connect to this Region's endpoint. Returns an SQSConnection
+ Connect to this Region's endpoint. Returns an SDBConnection
object pointing to the endpoint associated with this region.
- You may pass any of the arguments accepted by the SQSConnection
+ You may pass any of the arguments accepted by the SDBConnection
object's constructor as keyword arguments and they will be
- passed along to the SQSConnection object.
+ passed along to the SDBConnection object.
- @rtype: L{SQSConnection<boto.sqs.connection.SQSConnection}
- @return: The connection to this regions endpoint
+ :rtype: :class:`boto.sdb.connection.SDBConnection`
+ :return: The connection to this regions endpoint
"""
- from boto.sqs.connection import SQSConnection
- return SQSConnection(region=self, **kw_params)
+ from boto.sdb.connection import SDBConnection
+ return SDBConnection(region=self, **kw_params)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sdb/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/bs.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/bs.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/bs.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/bs.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/bs.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/services/bs.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/services/bs.py Sun Jun 5 08:34:02 2011
@@ -103,6 +103,8 @@ class BS(object):
def do_start(self):
ami_id = self.sd.get('ami_id')
+ instance_type = self.sd.get('instance_type', 'm1.small')
+ security_group = self.sd.get('security_group', 'default')
if not ami_id:
self.parser.error('ami_id option is required when starting the service')
ec2 = boto.connect_ec2()
@@ -115,7 +117,9 @@ class BS(object):
rs = ec2.get_all_images([ami_id])
img = rs[0]
r = img.run(user_data=s.getvalue(), key_name=self.options.keypair,
- max_count=self.options.num_instances)
+ max_count=self.options.num_instances,
+ instance_type=instance_type,
+ security_groups=[security_group])
print 'Starting AMI: %s' % ami_id
print 'Reservation %s contains the following instances:' % r.id
for i in r.instances:
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/message.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/message.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/message.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/message.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/message.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/result.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/result.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/result.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/result.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/result.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/service.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/service.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/service.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/service.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/service.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/services/service.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/services/service.py Sun Jun 5 08:34:02 2011
@@ -158,7 +158,6 @@ class Service(ScriptBase):
except Exception, e:
boto.log.exception('Service Failed')
empty_reads += 1
- self.create_connections()
self.notify('Service: %s Shutting Down' % self.name)
self.shutdown()
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/servicedef.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/servicedef.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/servicedef.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/servicedef.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/servicedef.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.cfg (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/sonofmmm.cfg)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.cfg?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.cfg&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/sonofmmm.cfg&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/sonofmmm.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/sonofmmm.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/sonofmmm.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/services/submit.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/services/submit.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/services/submit.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/services/submit.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/services/submit.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/attributes.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/attributes.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/attributes.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/attributes.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/attributes.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/connection.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/connection.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/connection.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/connection.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/connection.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/message.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/message.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/message.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/message.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/message.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/queue.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/queue.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/queue.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/queue.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/queue.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/readme.txt (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/readme.txt)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/readme.txt?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/20070501/readme.txt&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/20070501/readme.txt&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/__init__.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/__init__.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/__init__.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/__init__.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/__init__.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/__init__.py (original)
+++ incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/__init__.py Sun Jun 5 08:34:02 2011
@@ -32,11 +32,12 @@ def regions():
"""
Get all available regions for the SQS service.
- @rtype: list
- @return: A list of L{RegionInfo<boto.ec2.regioninfo.RegionInfo>}
+ :rtype: list
+ :return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
"""
return [SQSRegionInfo(name='us-east-1', endpoint='queue.amazonaws.com'),
- SQSRegionInfo(name='eu-west-1', endpoint='eu-west-1.queue.amazonaws.com')]
+ SQSRegionInfo(name='eu-west-1', endpoint='eu-west-1.queue.amazonaws.com'),
+ SQSRegionInfo(name='us-west-1', endpoint='us-west-1.queue.amazonaws.com')]
def connect_to_region(region_name):
for region in regions():
Copied: incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/attributes.py (from r1132066, incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/attributes.py)
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/attributes.py?p2=incubator/mesos/trunk/third_party/boto-1.9b/boto/sqs/attributes.py&p1=incubator/mesos/trunk/third_party/boto-1.8d/boto/sqs/attributes.py&r1=1132066&r2=1132067&rev=1132067&view=diff
==============================================================================
(empty)