summaryrefslogtreecommitdiff
path: root/swiftclient/multithreading.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2015-03-03 12:35:03 -0800
committerTim Burke <tim.burke@gmail.com>2015-03-23 18:35:45 -0700
commita4fb70ece189aff85f234ab6b3f275b69e936c03 (patch)
tree5fe51c0846b7fbb45137bb5689bde08f61033dd8 /swiftclient/multithreading.py
parent925c01ebfbdfb6478a3786f24a9572deae40f8f8 (diff)
downloadpython-swiftclient-a4fb70ece189aff85f234ab6b3f275b69e936c03.tar.gz
Compare each chunk of large objects when uploading
Previously, we compared the ETag from Swift against the MD5 of the entire large object. However, the ETag for large objects is generally the MD5 of the concatenation of the ETags for each segment, unless the object is a DLO whose segments span more than one page of a container listing. Rather than worry about ETags, just compare each chunk of the segmented file. This allows the use of --skip-identical when uploading SLOs and DLOs. Additionally, there are several test-related improvements: * The default arguments for OutputManager are now evaluated on construction, rather than on definition, so that TestOutputManager.test_instantiation will succeed when using nosetest as a test runner. (See also: bug 1251507) * An account_username option is now available in the functional tests config file for auth systems that do not follow the account:username format. * CaptureOutput no longer writes to the captured stream, and MockHttpTest now captures output. These were polluting test output unnecessarily. (See also: bug 1201376) Change-Id: Ic484e9a0c186c9283c4012c6a2fa77b96b8edf8a Closes-Bug: #1201376 Closes-Bug: #1379252 Related-Bug: #1251507
Diffstat (limited to 'swiftclient/multithreading.py')
-rw-r--r--swiftclient/multithreading.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/swiftclient/multithreading.py b/swiftclient/multithreading.py
index 32d8ffa..c53d987 100644
--- a/swiftclient/multithreading.py
+++ b/swiftclient/multithreading.py
@@ -45,7 +45,7 @@ class OutputManager(object):
"""
DEFAULT_OFFSET = 14
- def __init__(self, print_stream=sys.stdout, error_stream=sys.stderr):
+ def __init__(self, print_stream=None, error_stream=None):
"""
:param print_stream: The stream to which :meth:`print_msg` sends
formatted messages.
@@ -54,9 +54,10 @@ class OutputManager(object):
On Python 2, Unicode messages are encoded to utf8.
"""
- self.print_stream = print_stream
+ self.print_stream = print_stream or sys.stdout
self.print_pool = ThreadPoolExecutor(max_workers=1)
- self.error_stream = error_stream
+
+ self.error_stream = error_stream or sys.stderr
self.error_print_pool = ThreadPoolExecutor(max_workers=1)
self.error_count = 0