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.