12345678910111213141516171819202122 |
- def clean_unfinished_upload(self, upload_id_list):
- """
- 清理(abort)未完成的分片上传
- :param upload_id_list: 未完成分片上传的 upload id
- :return:
- """
- if upload_id_list:
- keyboard_input = raw_input("是否清理未完成分片,输入 yes 完成清理,其他代表不清理\n")
- if keyboard_input == "yes":
- for upload_info in upload_id_list:
- self.s3_client.abort_multipart_upload(
- Bucket=DESTINATION_BUCKET,
- Key=upload_info["Key"],
- UploadId=upload_info["UploadId"]
- )
- print ("清理分片对象 :{}, UploadId : {}".format(upload_info["Key"], upload_info["UploadId"]))
- return True
- else:
- print ("不清理未完成分片上传信息")
- return False
|