from minio import Minio from multiprocessing import Process import time def upload_file(): # 创建minio客户端 client = Minio(endpoint="xxx.xxx.xxx.xxx:xxx", access_key='xxx', secret_key='xxx', secure=False # 使用http ) file_name = '19d5c50e833d4fa8af3b7412d40000a2.jpg' file_path = r'E:\集成资料\视频素材' barrel = "testdata" for i in range(6000): client.fput_object(bucket_name=barrel, object_name="data1/" + str(i) + file_name, file_path=file_path + "/" + file_name) stop_time = time.strftime("%y-%m-%d: %H:%M:%S", time.localtime()) print(stop_time) def download_file(): # 创建minio客户端 client = Minio(endpoint="xxx.xxx.xxx.xxx:xxx", access_key='xxx', secret_key='xxx', secure=False # 使用http ) file_path = r'E:/集成资料/测试项目/minio/' barrel = "testdata" files = client.list_objects(barrel, prefix="data1/") for file in files: client.fget_object(bucket_name=barrel, object_name=file.object_name, file_path=file_path + str(file.object_name)) stop_time = time.strftime("%y-%m-%d: %H:%M:%S", time.localtime()) print(stop_time) if __name__ == '__main__': thread_pool = list() for a in range(20): name = Process(target=download_file()) thread_pool.append(name) for t in thread_pool: t.start() print("线程{}执行中".format(t)) print(time.strftime("%y-%m-%d: %H:%M:%S", time.localtime())) for t in thread_pool: t.join()
标签:object,minio,python,xxx,file,time,操作,name From: https://www.cnblogs.com/mian-1122/p/17463918.html