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


Python distributed.secede用法及代碼示例

用法:

distributed.secede()

讓這個任務脫離工作線程池

這為新任務打開了一個新的調度槽和一個新線程。這使客戶端能夠在此節點上安排任務,這在等待其他作業完成時特別有用(例如,使用 client.gather )。

例子

>>> def mytask(x):
...     # do some work
...     client = get_client()
...     futures = client.map(...)  # do some remote work
...     secede()  # while that work happens, remove ourself from the pool
...     return client.gather(futures)  # return gathered results

相關用法


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