From 9611cf37c5a80e480e937089c45a4ba338d797d3 Mon Sep 17 00:00:00 2001 From: Omkar Salpekar Date: Thu, 17 Dec 2020 14:46:43 -0800 Subject: [PATCH] [FileStore] Updating Docs to Reflect FileStore changes (#49557) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/49557 Updating the PyTorch docs to reflect that FileStore now supported the num_keys API. Also included a note to describe the behavior of the API. Test Plan: build and rendered docs. Reviewed By: jiayisuse Differential Revision: D25619000 fbshipit-source-id: 6c660d7ceb32d1d61024df8394aff3fcd0b752c1 --- torch/csrc/distributed/c10d/init.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torch/csrc/distributed/c10d/init.cpp b/torch/csrc/distributed/c10d/init.cpp index 689c2e835529..4db2f2600837 100644 --- a/torch/csrc/distributed/c10d/init.cpp +++ b/torch/csrc/distributed/c10d/init.cpp @@ -480,15 +480,14 @@ and :meth:`~torch.distributed.store.add` since one key is used to coordinate all the workers using the store. .. warning:: - The ``num_keys`` API is only supported by the :class:`~torch.distributed.TCPStore` and :class:`~torch.distributed.HashStore`. Using this API - with the :class:`~torch.distributed.FileStore` will result in an exception. + When used with the :class:`~torch.distributed.TCPStore`, ``num_keys`` returns the number of keys written to the underlying file. If the store is destructed and another store is created with the same file, the original keys will be retained. Returns: The number of keys present in the store. Example:: >>> import torch.distributed as dist - >>> # Using TCPStore as an example, HashStore can also be used + >>> # Using TCPStore as an example, other store types can also be used >>> store = dist.TCPStore("127.0.0.1", 0, True, timedelta(seconds=30)) >>> store.set("first_key", "first_value") >>> # This should return 2