executer.thread()中迭代的限制是什么?



此循环最多可运行2000次....使用多线程有限制吗?

with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
for index, unique_product in enumerate(scenario_unique_products):
kpis_data = [sku for sku in all_products_data if sku.scenario_product_id == unique_product.id]
products_length = len(kpis_data)
results = []
future = executor.map(self.filterProductBasicInformation, [all_sku_basic_information, all_sku_g2n_percent_delta_data], [count, count], [count+products_length, count+products_length])
for r in future:
results.append(r)

这是没有限制的,您仍然只使用池中的四个线程,但是您生成了其他和其他任务来处理。

只有内存大小是你的限制。

最新更新