用法:
workers_to_close(comm=None, memory_ratio: int | float | None = None, n: int | None = None, key: Callable[[WorkerState], Hashable] | None = None, minimum: int | None = None, target: int | None = None, attribute: str = 'address') → list[str]
找到我們可以低成本關閉的工人
這將返回一個適合退休的工人列表。這些工人沒有運行任何東西,並且相對於他們的同行存儲的數據相對較少。如果所有工作人員都處於空閑狀態,那麽我們仍然保持足夠的工作人員有足夠的 RAM 來存儲我們的數據,並有一個舒適的緩衝區。
這適用於像
distributed.deploy.adaptive
這樣的係統。- memory_ratio:數字
我們希望為存儲的數據提供的額外空間量。默認為 2,或者我們希望擁有兩倍於當前數據的內存。
- n:int
關閉的工人數量
- minimum:int
保留的最少工人數量
- key:可調用(工人狀態)
將 WorkerState 對象映射到組從屬關係的可選可調用對象。小組將一起關閉。當關閉工作人員必須集體完成時,這很有用,例如通過主機名。
- target:int
關閉後的目標員工人數
- attribute:str
要返回的 WorkerState 對象的屬性,如“address” or “name”。默認為“address”。
- to_close:可以關閉的worker地址列表
參數:
返回:
例子:
>>> scheduler.workers_to_close() ['tcp://192.168.0.1:1234', 'tcp://192.168.0.2:1234']
在關閉之前按主機名對工作人員進行分組
>>> scheduler.workers_to_close(key=lambda ws: ws.host) ['tcp://192.168.0.1:1234', 'tcp://192.168.0.1:4567']
移除兩名工人
>>> scheduler.workers_to_close(n=2)
保持足夠的工人擁有兩倍於我們需要的內存。
>>> scheduler.workers_to_close(memory_ratio=2)
相關用法
- Python distributed.scheduler.Scheduler.transition用法及代碼示例
- Python distributed.scheduler.Scheduler用法及代碼示例
- Python distributed.secede用法及代碼示例
- Python distributed.protocol.serialize.register_generic用法及代碼示例
- Python distributed.Client.gather用法及代碼示例
- Python distributed.recreate_tasks.ReplayTaskClient.recreate_task_locally用法及代碼示例
- Python distributed.diagnostics.plugin.SchedulerPlugin用法及代碼示例
- Python distributed.Client.ncores用法及代碼示例
- Python distributed.Client.retire_workers用法及代碼示例
- Python distributed.Client.unregister_worker_plugin用法及代碼示例
- Python distributed.fire_and_forget用法及代碼示例
- Python distributed.Client.set_metadata用法及代碼示例
- Python distributed.Client.scheduler_info用法及代碼示例
- Python distributed.Client.submit用法及代碼示例
- Python distributed.Client.compute用法及代碼示例
- Python distributed.SpecCluster.scale用法及代碼示例
- Python distributed.get_worker用法及代碼示例
- Python distributed.SpecCluster.scale_up用法及代碼示例
- Python distributed.Client.nthreads用法及代碼示例
- Python distributed.comm.resolve_address用法及代碼示例
注:本文由純淨天空篩選整理自dask.org大神的英文原創作品 distributed.scheduler.Scheduler.workers_to_close。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。