示例#1
0
文件: S3.py 项目: pulseenergy/s3cmd
 def send_file_multipart(self, file, headers, uri, size):
     chunk_size = self.config.multipart_chunk_size_mb * 1024 * 1024
     upload = MultiPartUpload(self, file, uri, headers)
     upload.upload_all_parts()
     response = upload.complete_multipart_upload()
     response["speed"] = 0  # XXX
     return response
示例#2
0
文件: S3.py 项目: NetCrafters/s3cmd
 def send_file_multipart(self, file, headers, uri, size):
     chunk_size = self.config.multipart_chunk_size_mb * 1024 * 1024
     upload = MultiPartUpload(self, file, uri, headers)
     upload.upload_all_parts()
     response = upload.complete_multipart_upload()
     response["speed"] = 0  # XXX
     return response
示例#3
0
文件: S3.py 项目: chomp/s3cmd
    def send_file_multipart(self, file, headers, uri, size):
        upload = MultiPartUpload(self, file, uri)
        num_threads = self.config.multipart_num_threads or 4

        if size > MultiPartUpload.MAX_FILE_SIZE:
                raise RuntimeError("File is too large (%i bytes, max %i)" % (size, MultiPartUpload.MAX_FILE_SIZE))
        elif size > 107374182400: # 100GB
                chunk_size = size / 10000
        elif size > 10737418240: # 10GB
                chunk_size = size / 1000
        elif size > 1073741824: # 1GB
                chunk_size = size / 100
        else:
                chunk_size = self.config.multipart_chunk_size or MultiPartUpload.MIN_CHUNK_SIZE

        timestamp_start = time.time()
        file.seek(0)
        bucket, key, upload_id = upload.initiate_multipart_upload()
        upload.upload_all_parts(num_threads, chunk_size)
        response = upload.complete_multipart_upload()
        response["size"] = size
        timestamp_end = time.time()

        response["elapsed"] = timestamp_end - timestamp_start
        response["speed"] = response["elapsed"] and float(response["size"]) / response["elapsed"] or float(-1)
        return response
示例#4
0
文件: S3.py 项目: jmehnle/s3cmd
 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()
     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
示例#5
0
 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()
     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