Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Compute speed and elapsed time for Multipart uploads

By the way fixes a crash with:
s3cmd put /xyz/big-file s3://bucket/ > /dev/null
Reported by HanJingYu
  • Loading branch information...
commit 9c57a3ba2163915deb2cc63cefa885a66ac377ab 1 parent 7d047bd
Michal Ludvig mludvig authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. +4 1 S3/S3.py
5 S3/S3.py
@@ -752,11 +752,14 @@ def send_file(self, request, file, labels, throttle = 0, retries = _max_retries,
752 752
753 753 def send_file_multipart(self, file, headers, uri, size):
754 754 chunk_size = self.config.multipart_chunk_size_mb * 1024 * 1024
  755 + timestamp_start = time.time()
755 756 upload = MultiPartUpload(self, file, uri, headers)
756 757 upload.upload_all_parts()
757 758 response = upload.complete_multipart_upload()
758   - response["speed"] = 0 # XXX
  759 + timestamp_end = time.time()
  760 + response["elapsed"] = timestamp_end - timestamp_start
759 761 response["size"] = size
  762 + response["speed"] = response["elapsed"] and float(response["size"]) / response["elapsed"] or float(-1)
760 763 return response
761 764
762 765 def recv_file(self, request, stream, labels, start_position = 0, retries = _max_retries):

0 comments on commit 9c57a3b

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