Skip to content
Browse files

Renamed multipart_chunk_size to multipart_chunk_size_mb

Simplifies handling, avoids confusion.
  • Loading branch information...
1 parent 9dda31d commit 80310166f8671ba2c9dc89b182109847279018c3 @mludvig mludvig committed Jan 3, 2012
Showing with 8 additions and 8 deletions.
  1. +1 −1 S3/Config.py
  2. +2 −2 S3/S3.py
  3. +5 −5 s3cmd
View
2 S3/Config.py
@@ -65,7 +65,7 @@ class Config(object):
mime_type = ""
enable_multipart = True
multipart_num_threads = 4
- multipart_chunk_size = 5242880
+ multipart_chunk_size_mb = 15 # MB
# List of checks to be performed for 'sync'
sync_checks = ['size', 'md5'] # 'weak-timestamp'
# List of compiled REGEXPs
View
4 S3/S3.py
@@ -355,7 +355,7 @@ def object_put(self, filename, uri, extra_headers = None, extra_label = ""):
multipart = False
if self.config.enable_multipart:
- if size > self.config.multipart_chunk_size:
+ if size > self.config.multipart_chunk_size_mb * 1024 * 1024:
multipart = True
if multipart:
@@ -746,7 +746,7 @@ def send_file_multipart(self, file, headers, uri, size):
bucket, key, upload_id = upload.initiate_multipart_upload()
num_threads = self.config.multipart_num_threads
- chunk_size = self.config.multipart_chunk_size
+ chunk_size = self.config.multipart_chunk_size_mb * 1024 * 1024
file.seek(0)
upload.upload_all_parts(num_threads, chunk_size)
View
10 s3cmd
@@ -1527,7 +1527,7 @@ def main():
optparser.add_option( "--verbatim", dest="urlencoding_mode", action="store_const", const="verbatim", help="Use the S3 name as given on the command line. No pre-processing, encoding, etc. Use with caution!")
optparser.add_option( "--disable-multipart", dest="enable_multipart", action="store_false", help="Disable multipart upload on files bigger than --multipart-chunk-size")
- optparser.add_option( "--multipart-chunk-size", dest="multipart_chunk_size", type="int", action="store", metavar="SIZE", help="Size of each chunk of a multipart upload. Files bigger than SIZE are automatically uploaded as multithreaded-multipart, smaller files are uploaded using the traditional method. SIZE is in Mega-Bytes, default chunk size is %defaultMB, minimum allowed chunk size is 5MB, maximum is 5GB.")
+ optparser.add_option( "--multipart-chunk-size-mb", dest="multipart_chunk_size_mb", type="int", action="store", metavar="SIZE", help="Size of each chunk of a multipart upload. Files bigger than SIZE are automatically uploaded as multithreaded-multipart, smaller files are uploaded using the traditional method. SIZE is in Mega-Bytes, default chunk size is %defaultMB, minimum allowed chunk size is 5MB, maximum is 5GB.")
optparser.add_option( "--list-md5", dest="list_md5", action="store_true", help="Include MD5 sums in bucket listings (only for 'ls' command).")
optparser.add_option("-H", "--human-readable-sizes", dest="human_readable_sizes", action="store_true", help="Print sizes in human readable form (eg 1kB instead of 1234).")
@@ -1653,10 +1653,10 @@ def main():
cfg.update_option("acl_public", options.acl_public)
## Check multipart chunk constraints
- if cfg.multipart_chunk_size < MultiPartUpload.MIN_CHUNK_SIZE_MB:
- raise ParameterError("Chunk size %d MB is too small, must be >= %d MB. Please adjust --multipart-chunk-size" % (cfg.multipart_chunk_size, MultiPartUpload.MIN_CHUNK_SIZE_MB))
- if cfg.multipart_chunk_size > MultiPartUpload.MAX_CHUNK_SIZE_MB:
- raise ParameterError("Chunk size %d MB is too large, must be <= %d MB. Please adjust --multipart-chunk-size" % (cfg.multipart_chunk_size, MultiPartUpload.MAX_CHUNK_SIZE_MB))
+ if cfg.multipart_chunk_size_mb < MultiPartUpload.MIN_CHUNK_SIZE_MB:
+ raise ParameterError("Chunk size %d MB is too small, must be >= %d MB. Please adjust --multipart-chunk-size-mb" % (cfg.multipart_chunk_size_mb, MultiPartUpload.MIN_CHUNK_SIZE_MB))
+ if cfg.multipart_chunk_size_mb > MultiPartUpload.MAX_CHUNK_SIZE_MB:
+ raise ParameterError("Chunk size %d MB is too large, must be <= %d MB. Please adjust --multipart-chunk-size-mb" % (cfg.multipart_chunk_size_mb, MultiPartUpload.MAX_CHUNK_SIZE_MB))
## CloudFront's cf_enable and Config's enable share the same --enable switch
options.cf_enable = options.enable

0 comments on commit 8031016

Please sign in to comment.
Something went wrong with that request. Please try again.