當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python distributed.as_completed.batches用法及代碼示例

用法:

batches()

一次產生所有已完成的期貨,而不是one-by-one

這將返回期貨列表或 (future, result) 元組列表的迭代器,而不是單個期貨或單個 (future, result) 元組。它將盡快產生這些,而無需等待。

例子

>>> for batch in as_completed(futures).batches():  
...     results = client.gather(batch)
...     print(results)
[4, 2]
[1, 3, 7]
[5]
[6]

相關用法


注:本文由純淨天空篩選整理自dask.org大神的英文原創作品 distributed.as_completed.batches。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。