Skip to content

Commit 46c9158

Browse files
committed
config: expose http timeout in config schema
For more information about individual timeouts meanings: https://docs.aiohttp.org/en/stable/client_reference.html?highlight=clienttimeout#clienttimeout
1 parent 089a90c commit 46c9158

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

dvc/config_schema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class RelPath(str):
9797
"ask_password": Bool,
9898
"ssl_verify": Any(Bool, str),
9999
"method": str,
100+
"connect_timeout": All(Coerce(float), Range(0, min_included=True)),
101+
"sock_connect_timeout": All(Coerce(float), Range(0, min_included=True)),
102+
"sock_read_timeout": All(Coerce(float), Range(0, min_included=True)),
100103
Optional("verify", default=False): Bool,
101104
}
102105
WEBDAV_COMMON = {

tests/unit/fs/test_http.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pytest
2+
from dvc_http import HTTPFileSystem
3+
4+
url = "https://remote.dvc.org/get-started"
5+
6+
7+
@pytest.mark.parametrize(
8+
"kwarg,value",
9+
(
10+
("connect_timeout", 42),
11+
("sock_connect_timeout", 42),
12+
("sock_read_timeout", 42),
13+
),
14+
)
15+
def test_timeout_options(dvc, kwarg, value):
16+
config = {"url": url, kwarg: value}
17+
fs = HTTPFileSystem(**config)
18+
19+
assert fs.fs_args["client_kwargs"][kwarg] == value

0 commit comments

Comments
 (0)