Skip to content

Commit

Permalink
Compute speed and elapsed time for Multipart uploads
Browse files Browse the repository at this point in the history
By the way fixes a crash with:
s3cmd put /xyz/big-file s3://bucket/ > /dev/null
Reported by HanJingYu
  • Loading branch information
mludvig committed Jan 17, 2012
1 parent 7d047bd commit 9c57a3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S3/S3.py
Expand Up @@ -752,11 +752,14 @@ def send_file(self, request, file, labels, throttle = 0, retries = _max_retries,

def send_file_multipart(self, file, headers, uri, size):
chunk_size = self.config.multipart_chunk_size_mb * 1024 * 1024
timestamp_start = time.time()
upload = MultiPartUpload(self, file, uri, headers)
upload.upload_all_parts()
response = upload.complete_multipart_upload()
response["speed"] = 0 # XXX
timestamp_end = time.time()
response["elapsed"] = timestamp_end - timestamp_start
response["size"] = size
response["speed"] = response["elapsed"] and float(response["size"]) / response["elapsed"] or float(-1)
return response

def recv_file(self, request, stream, labels, start_position = 0, retries = _max_retries):
Expand Down

0 comments on commit 9c57a3b

Please sign in to comment.