用法:
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。