def upload_part(self, upload_id, index_list, part_number_list): """ 多线程上传分片 :param upload_id: 分片上传的upload id :param index_list: 所有分片的 :param part_number_list: :return: """ part_number = 1 total = len(index_list) with futures.ThreadPoolExecutor(max_workers=MAX_THREADS) as pool: for part_start_index in index_list: if part_number not in part_number_list: pool.submit(self.upload_thread, upload_id, part_number, part_start_index, total) part_number += 1 print ("所有分片文件已上传, 文件名: {}, 文件大小:{}".format(MULTIPART_UPLOAD_FILE_NAME, MULTIPART_UPLOAD_FILE_SIZE)) return part_number - 1