本文介绍了boto3.Bucket.upload_file是阻止还是非阻止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是 boto3.Bucket.upload_file 阻止还是不阻止?
即如果我要运行以下
bucket = session.Bucket(bucket_name)
bucket.upload_file(Key=s3_key, Filename=source_path)
os.remove(source_path)
根据文件的大小,我是否有竞争条件?还是可以保证在删除文件之前完成上传?
Do I have a race condition, depending on the size of the file? Or is upload guaranteed to complete before file deletion?
推荐答案
当前的boto3 upload_file
正在阻止.正如mootmoot所说,如果删除该文件,则绝对应该执行一些错误处理以确保安全.
The current boto3 upload_file
is blocking. As mootmoot said, you should definitely implement some error handling to be safe if you delete the file.
这篇关于boto3.Bucket.upload_file是阻止还是非阻止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!