用法:
class distributed.Variable(name=None, client=None, maxsize=0)
分布式全局變量
這允許多個客戶端使用單個可變變量在彼此之間共享期貨和數據。所有元數據都通過調度程序進行排序。可能會出現競爭條件。
值必須是 Futures 或 msgpack-encodable 數據(整數、列表、字符串等)。所有數據都將保留並通過調度程序發送,因此最好不要發送太多。如果你想共享大量數據,那麽
scatter
它並共享未來。警告
此對象是實驗性的,在 Python 2 中存在已知問題
- name: string (optional):
其他客戶端和調度程序用來標識變量的名稱。如果沒有給出,將生成一個隨機名稱。
- client: Client (optional):
用於與調度程序通信的客戶端。如果沒有給出,將使用默認的全局客戶端。
參數:
例子:
>>> from dask.distributed import Client, Variable >>> client = Client() >>> x = Variable('x') >>> x.set(123) # docttest: +SKIP >>> x.get() # docttest: +SKIP 123 >>> future = client.submit(f, x) >>> x.set(future)
相關用法
- 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用法及代碼示例
- Python distributed.Client.unpublish_dataset用法及代碼示例
- Python distributed.get_task_stream用法及代碼示例
- Python distributed.Client.start_ipython_scheduler用法及代碼示例
注:本文由純淨天空篩選整理自dask.org大神的英文原創作品 distributed.Variable。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。