用法:
run() → Generator[tuple[str, TaskState, set[WorkerState] | None], WorkerState | None, None]
此方法由 ActiveMemoryManager 每隔幾秒調用一次,或者每當用戶調用
client.amm.run_once
時調用。它是一個迭代器,必須發出以下任何內容:- “replicate”,<任務狀態>,無
- “replicate”, <TaskState>, {要複製到的潛在工作人員的子集}
- “drop”,<任務狀態>,無
- “drop”, <TaskState>, {要刪除的潛在工人的子集}
產生的每個元素都表示希望創建或銷毀 key 的單個副本。如果未提供工作人員的子集,則默認為集群上的所有工作人員。 ActiveMemoryManager 或 Worker 稍後可能會決定忽略該請求,例如因為它會刪除 key 的最後一個副本,或者因為該工作人員當前需要該 key 。
您可以選擇檢索決定將 key 複製到或刪除的工作人員,如下所示:
choice = (yield "replicate", ts, None)
choice
是 WorkerState 或 None;如果 ActiveMemoryManager 選擇忽略請求,則返回後者。可以在
self.manager.pending
上檢查當前待處理(已接受)的命令;這包括以前由相同方法產生的命令。每個工作人員的當前內存使用情況,所有待處理命令的下遊, 可以檢查
self.manager.workers_memory
.
相關用法
- Python distributed.as_completed.batches用法及代碼示例
- Python distributed.as_completed用法及代碼示例
- Python distributed.as_completed.next_batch用法及代碼示例
- 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.active_memory_manager.ActiveMemoryManagerPolicy.run。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。