From 30921a6550cbfa40ce4eb1673841e9b4525b0453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Jankowski?= Date: Tue, 14 Mar 2023 14:28:07 +0100 Subject: [PATCH] Setting request timeout to 10 minutes instead of inf (#1295) --- CHANGELOG.md | 3 +++ src/neptune/envs.py | 3 +++ src/neptune/internal/backends/hosted_client.py | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c410c0c59..97dbdd46a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ - Added `SupportsNamespaces` interface in `neptune.typing` for proper type annotations of Handler and Neptune objects ([#1280](https://github.com/neptune-ai/neptune-client/pull/1280)) - `Run`, `Model`, `ModelVersion` and `Project` could be created with constructor in addition to `init_*` functions ([#1246](https://github.com/neptune-ai/neptune-client/pull/1246)) +### Fixes +- Setting request timeout to 10 minutes instead of infinite ([#1295](https://github.com/neptune-ai/neptune-client/pull/1295)) + ## neptune 1.0.2 ### Fixes diff --git a/src/neptune/envs.py b/src/neptune/envs.py index db437f173..f094168fb 100644 --- a/src/neptune/envs.py +++ b/src/neptune/envs.py @@ -26,6 +26,7 @@ "NEPTUNE_SYNC_BATCH_TIMEOUT_ENV", "NEPTUNE_SUBPROCESS_KILL_TIMEOUT", "NEPTUNE_FETCH_TABLE_STEP_SIZE", + "NEPTUNE_REQUEST_TIMEOUT", ] from neptune.common.envs import ( @@ -53,4 +54,6 @@ NEPTUNE_FETCH_TABLE_STEP_SIZE = "NEPTUNE_FETCH_TABLE_STEP_SIZE" +NEPTUNE_REQUEST_TIMEOUT = "NEPTUNE_REQUEST_TIMEOUT" + S3_ENDPOINT_URL = "S3_ENDPOINT_URL" diff --git a/src/neptune/internal/backends/hosted_client.py b/src/neptune/internal/backends/hosted_client.py index 78fe71aee..2fdbcee2e 100644 --- a/src/neptune/internal/backends/hosted_client.py +++ b/src/neptune/internal/backends/hosted_client.py @@ -21,6 +21,7 @@ "create_artifacts_client", ] +import os import platform from typing import ( Dict, @@ -32,6 +33,7 @@ from neptune.common.backends.utils import with_api_exceptions_handler from neptune.common.oauth import NeptuneAuthenticator +from neptune.envs import NEPTUNE_REQUEST_TIMEOUT from neptune.exceptions import NeptuneClientUpgradeRequiredError from neptune.internal.backends.api_model import ClientConfig from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper @@ -52,7 +54,7 @@ ARTIFACTS_SWAGGER_PATH = "/api/artifacts/swagger.json" CONNECT_TIMEOUT = 30 # helps detecting internet connection lost -REQUEST_TIMEOUT = None +REQUEST_TIMEOUT = int(os.getenv(NEPTUNE_REQUEST_TIMEOUT, "600")) DEFAULT_REQUEST_KWARGS = { "_request_options": {