用法:
class distributed.Event(name=None, client=None)
分布式集中事件等价于 asyncio.Event
一个事件存储一个标志,该标志在开始时设置为 false。该标志可以设置为真(使用set() 调用)或返回为假(使用clear() 调用)。每次调用 wait() 都会阻塞,直到事件标志设置为 true。
- name: string (optional):
事件的名称。选择相同的名称允许两个断开连接的进程来协调一个事件。如果没有给出,将生成一个随机名称。
- client: Client (optional):
用于与调度程序通信的客户端。如果没有给出,将使用默认的全局客户端。
参数:
例子:
>>> event_1 = Event('a') >>> event_1.wait(timeout=1) >>> # in another process >>> event_2 = Event('a') >>> event_2.set() >>> # now event_1 will stop waiting
相关用法
- Python distributed.Event.wait用法及代码示例
- 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用法及代码示例
注:本文由纯净天空筛选整理自dask.org大神的英文原创作品 distributed.Event。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。