Skip to content

Commit 393b908

Browse files
Remove hardcoded timeout from AIStore client (#1549)
- Rely on AIS_CONNECT_TIMEOUT and AIS_READ_TIMEOUT env vars for timeout config - Add link to AIStore SDK environment variables docs Signed-off-by: Abhishek Gaikwad <gaikwadabhishek1997@gmail.com>
1 parent 0ee2ce1 commit 393b908

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Lhotse uses several environment variables to customize it's behavior. They are a
115115
- `LHOTSE_PREPARING_RELEASE` - used internally by developers when releasing a new version of Lhotse.
116116
- `TORCHAUDIO_USE_BACKEND_DISPATCHER` - when set to `1` and torchaudio version is below 2.1, we'll enable the experimental ffmpeg backend of torchaudio.
117117
- `AIS_ENDPOINT` is read by AIStore client to determine AIStore endpoint URL. Required for AIStore dataloading.
118+
- `AIS_CONNECT_TIMEOUT` - used by AIStore SDK to set the connection timeout (in seconds) for AIStore client requests. Set to `0` to disable (no timeout). If not set, the SDK default is used (3s).
119+
- `AIS_READ_TIMEOUT` - used by AIStore SDK to set the read timeout (in seconds) for AIStore client requests. Set to `0` to disable (no timeout). If not set, the SDK default is used (20s).
118120
- `RANK`, `WORLD_SIZE`, `WORKER`, and `NUM_WORKERS` are internally used to inform Lhotse Shar dataloading subprocesses.
119121
- `READTHEDOCS` is internally used for documentation builds.
120122
- `LHOTSE_MSC_OVERRIDE_PROTOCOLS` - when set, it will override your input protocols before feeding to MSCIOBackend. Useful when you don't want to change your existing url format but want to use MSCIOBackend. For example, if you have `s3://s3-bucket/path/to/my/object` and `gs://gs-bucket/path/to/my/object`, you can set `LHOTSE_MSC_OVERRIDE_PROTOCOLS=s3,gs` to override the urls to `msc://s3-bucket/path/to/my/object` and `msc://gs-bucket/path/to/my/object`.

docs/getting-started.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ Lhotse uses several environment variables to customize it's behavior. They are a
143143

144144
* ``AIS_ENDPOINT`` is read by AIStore client to determine AIStore endpoint URL. Required for AIStore dataloading.
145145

146+
* ``AIS_CONNECT_TIMEOUT`` - used by AIStore SDK to set the connection timeout (in seconds) for AIStore client requests. Set to ``0`` to disable (no timeout). If not set, the SDK default is used (3s).
147+
148+
* ``AIS_READ_TIMEOUT`` - used by AIStore SDK to set the read timeout (in seconds) for AIStore client requests. Set to ``0`` to disable (no timeout). If not set, the SDK default is used (20s).
149+
146150
* ``RANK``, ``WORLD_SIZE``, ``WORKER``, and ``NUM_WORKERS`` are internally used to inform Lhotse Shar dataloading subprocesses.
147151

148152
* ``READTHEDOCS`` is internally used for documentation builds.

lhotse/serialization.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ def get_aistore_client():
8181

8282
endpoint_url = os.environ["AIS_ENDPOINT"]
8383
version = parse_version(aistore.__version__)
84-
return aistore.Client(endpoint_url, timeout=(5, 30), max_pool_size=50), version
84+
# NOTE: No explicit timeout is passed here so that the AIStore SDK picks up
85+
# the 'AIS_CONNECT_TIMEOUT' and 'AIS_READ_TIMEOUT' environment variables
86+
# when they are set. Users should configure these env vars to control
87+
# request timeouts.
88+
# See https://github.com/NVIDIA/aistore/tree/main/python/aistore/sdk#environment-variables
89+
return aistore.Client(endpoint_url, max_pool_size=50), version
8590

8691

8792
def save_to_yaml(data: Any, path: Pathlike) -> None:

0 commit comments

Comments
 (0)