用法:
class distributed.scheduler.Scheduler(loop=None, delete_interval='500ms', synchronize_worker_interval='60s', services=None, service_kwargs=None, allowed_failures=None, extensions=None, validate=None, scheduler_file=None, security=None, worker_ttl=None, idle_timeout=None, interface=None, host=None, port=0, protocol=None, dashboard_address=None, dashboard=None, http_prefix='/', preload=None, preload_argv=(), plugins=(), **kwargs)
動態分布式任務調度器
調度程序跟蹤工作人員、數據和計算的當前狀態。調度程序監聽事件並通過適當地控製工作人員來響應。它不斷嘗試使用工作人員來執行不斷增長的 dask 圖。
所有事件都被快速處理,在相對於它們的輸入(通常是恒定大小)的線性時間內,通常在一毫秒內。為了實現這一點,調度程序會跟蹤很多狀態。每個操作都保持這個狀態的一致性。
調度器通過 Comm 對象與外界通信。即使同時聆聽多個客戶,它也能保持一致且有效的世界觀。
調度程序通常使用
dask-scheduler
可執行文件啟動:$ dask-scheduler Scheduler started at 127.0.0.1:8786
或者在 LocalCluster 中,客戶端在沒有連接信息的情況下啟動:
>>> c = Client() >>> c.cluster.scheduler Scheduler(...)
用戶通常不直接與調度程序交互,而是與客戶端對象
Client
交互。狀態
調度程序包含以下狀態變量。列出了每個變量及其存儲的內容和簡要說明。
- 任務:
{task key: TaskState}
調度程序當前已知的任務
- 任務:
- 無法運行:
{TaskState}
“no-worker” 狀態下的任務
- 無法運行:
- 工作人員:
{worker key: WorkerState}
當前連接到調度程序的工作人員
- 工作人員:
- 閑置的:
{WorkerState}
: 未充分利用的一組工人
- 閑置的:
- 飽和:
{WorkerState}
: 一組不是over-utilized的工人
- 飽和:
- host_info:
{hostname: dict}
: 有關每個工作程序主機的信息
- host_info:
- 客戶:
{client key: ClientState}
當前連接到調度程序的客戶端
- 客戶:
- 服務:
{str: port}
: 在此調度程序上運行的其他服務,例如 Bokeh
- 服務:
- 環形:
IOLoop
: 正在運行的 Tornado IOLoop
- 環形:
- client_comms:
{client key: Comm}
對於每個客戶端,一個用於接收任務請求和報告任務狀態更新的 Comm 對象。
- client_comms:
- stream_comms:
{worker key: Comm}
對於每個工人,我們都接受刺激並報告結果的 Comm 對象
- stream_comms:
- task_duration:
{key-prefix: time}
我們期望某些函數花費的時間,例如
{'sum': 0.25}
- task_duration:
相關用法
- Python distributed.scheduler.Scheduler.workers_to_close用法及代碼示例
- Python distributed.scheduler.Scheduler.transition用法及代碼示例
- 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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。