Repository: mlflow/mlflow

Issue:
Timeout value too small: when downloading large model files, timeout is reached
https://github.com/mlflow/mlflow/blob/d40780be361f4bd2741c2e8fcbd428c1d693edcf/mlflow/store/artifact/http_artifact_repo.py#L63


Discussion:

Resolving patch:
diff --git a/mlflow/store/artifact/http_artifact_repo.py b/mlflow/store/artifact/http_artifact_repo.py
--- a/mlflow/store/artifact/http_artifact_repo.py
+++ b/mlflow/store/artifact/http_artifact_repo.py
@@ -22,7 +22,7 @@ def log_artifact(self, local_file, artifact_path=None):
         paths = (artifact_path, file_name) if artifact_path else (file_name,)
         endpoint = posixpath.join("/", *paths)
         with open(local_file, "rb") as f:
-            resp = http_request(self._host_creds, endpoint, "PUT", data=f, timeout=600)
+            resp = http_request(self._host_creds, endpoint, "PUT", data=f)
             augmented_raise_for_status(resp)
 
     def log_artifacts(self, local_dir, artifact_path=None):
@@ -45,7 +45,7 @@ def list_artifacts(self, path=None):
         root = tail.lstrip("/")
         params = {"path": posixpath.join(root, path) if path else root}
         host_creds = _get_default_host_creds(url)
-        resp = http_request(host_creds, endpoint, "GET", params=params, timeout=10)
+        resp = http_request(host_creds, endpoint, "GET", params=params)
         augmented_raise_for_status(resp)
         file_infos = []
         for f in resp.json().get("files", []):
@@ -60,7 +60,7 @@ def list_artifacts(self, path=None):
 
     def _download_file(self, remote_file_path, local_path):
         endpoint = posixpath.join("/", remote_file_path)
-        resp = http_request(self._host_creds, endpoint, "GET", stream=True, timeout=10)
+        resp = http_request(self._host_creds, endpoint, "GET", stream=True)
         augmented_raise_for_status(resp)
         with open(local_path, "wb") as f:
             chunk_size = 1024 * 1024  # 1 MB
@@ -69,5 +69,5 @@ def _download_file(self, remote_file_path, local_path):
 
     def delete_artifacts(self, artifact_path=None):
         endpoint = posixpath.join("/", artifact_path) if artifact_path else "/"
-        resp = http_request(self._host_creds, endpoint, "DELETE", stream=True, timeout=10)
+        resp = http_request(self._host_creds, endpoint, "DELETE", stream=True)
         augmented_raise_for_status(resp)


Test patch:
diff --git a/tests/store/artifact/test_http_artifact_repo.py b/tests/store/artifact/test_http_artifact_repo.py
--- a/tests/store/artifact/test_http_artifact_repo.py
+++ b/tests/store/artifact/test_http_artifact_repo.py
@@ -78,7 +78,6 @@ def test_log_artifact(http_artifact_repo, tmpdir, artifact_path):
             posixpath.join("/", *paths),
             "PUT",
             data=FileObjectMatcher(tmp_path, "rb"),
-            timeout=mock.ANY,
         )
 
     with mock.patch(
@@ -129,7 +128,6 @@ def test_list_artifacts(http_artifact_repo):
             endpoint,
             "GET",
             params={"path": ""},
-            timeout=mock.ANY,
         )
 
     with mock.patch(
@@ -189,7 +187,6 @@ def test_download_file(http_artifact_repo, tmpdir, remote_file_path):
             posixpath.join("/", remote_file_path),
             "GET",
             stream=True,
-            timeout=mock.ANY,
         )
         with open(tmp_path) as f:
             assert f.read() == "data"
@@ -299,5 +296,4 @@ def test_delete_artifacts(http_artifact_repo, remote_file_path):
             posixpath.join("/", remote_file_path if remote_file_path else ""),
             "DELETE",
             stream=True,
-            timeout=mock.ANY,
         )
diff --git a/tests/store/artifact/test_mlflow_artifact_repo.py b/tests/store/artifact/test_mlflow_artifact_repo.py
--- a/tests/store/artifact/test_mlflow_artifact_repo.py
+++ b/tests/store/artifact/test_mlflow_artifact_repo.py
@@ -125,7 +125,6 @@ def test_log_artifact(mlflow_artifact_repo, tmpdir, artifact_path):
             posixpath.join("/", *paths),
             "PUT",
             data=FileObjectMatcher(tmp_path, "rb"),
-            timeout=mock.ANY,
         )
 
     with mock.patch(
@@ -151,7 +150,6 @@ def test_log_artifact_with_host_and_port(mlflow_artifact_repo_with_host, tmpdir,
             posixpath.join("/", *paths),
             "PUT",
             data=FileObjectMatcher(tmp_path, "rb"),
-            timeout=mock.ANY,
         )
 
     with mock.patch(
@@ -202,7 +200,6 @@ def test_list_artifacts(mlflow_artifact_repo):
             endpoint,
             "GET",
             params={"path": ""},
-            timeout=mock.ANY,
         )
 
     with mock.patch(
@@ -262,7 +259,6 @@ def test_download_file(mlflow_artifact_repo, tmpdir, remote_file_path):
             posixpath.join("/", remote_file_path),
             "GET",
             stream=True,
-            timeout=mock.ANY,
         )
         with open(tmp_path) as f:
             assert f.read() == "data"