[英]Pause/Resume the file upload in azure blob storage
下面是我的代码:
async def uploadin_files(file_path):
for files_to_upload in file_path:
time.sleep(2)
blob_client = blob_service_client.get_blob_client(container=azure_container, blob=files_to_upload)
with open(files_to_upload, 'rb') as datax:
chunk_data_original = datax.read()
test = blob_client.upload_blob(chunk_data_original, overwrite=True)
print(files_to_upload,"Done uploading",test)
await uploadin_files(file_path_main)
我想在上传时暂停和恢复文件,有什么办法吗?
我可以使用以下代码终止 function:
def overall_function(b):
asyncio.run(upload_data("a"))
def terminate_function():
event = multiprocessing.Event()
#blob_function = asyncio.run(upload_data("a"))
process = multiprocessing.Process(target=overall_function,args=(event,))
process.start()
time.sleep(10)
process.terminate()
print("Process terminated",process)
return Response("terminated")
但是如何按预期暂停/恢复 function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.