用法:
acquire(blocking=True, timeout=None, num_locks=None)
獲取鎖
- blocking:布爾型,可選
如果為 false,則根本不要等待調度程序中的鎖。
- timeout:字符串或數字或時間增量,可選
等待調度程序中的鎖的秒數。這不包括本地協程時間、網絡傳輸時間等。阻塞為false時禁止指定超時。除了秒數,還可以指定字符串格式的時間增量,例如“200ms”。
- num_locks:整數,可選
需要的鎖數。如果沒有,則需要所有鎖
- True 或 False 是否成功獲取鎖
參數:
返回:
例子:
>>> lock = MultiLock(['x', 'y']) >>> lock.acquire(timeout="1s")
相關用法
- Python distributed.MultiLock用法及代碼示例
- 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.MultiLock.acquire。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。