def upload_virtual_file_thread(self, upload_id, part_number, upload_body, total): """ :param upload_id: multipart upload id :param part_number: 分片数 :param upload_body: 虚拟文件分片内容 :param total:总分片量 :return: """ print( "Uploading {} / {}".format(part_number, total)) retry_time = 0 while retry_time <= MAX_RETRY_TIME: try: self.s3_client.upload_part( Body=upload_body, Bucket=DESTINATION_BUCKET, Key=MULTIPART_UPLOAD_FILE_NAME, PartNumber=part_number, UploadId=upload_id ) break except Exception as e: retry_time += 1 if retry_time > MAX_RETRY_TIME: print ("已达最大重传次数 {},退出".format(retry_time)) sys.exit(-1) time.sleep(5) print (" Complete {} / {} ".format(part_number, total))