mirror of
https://github.com/clearml/clearml
synced 2025-04-15 13:02:24 +00:00
Fix missing configuration error not raised correctly
This commit is contained in:
parent
32832ae46d
commit
fdd2c03900
@ -32,7 +32,10 @@ class ApiServiceProxy(object):
|
||||
)
|
||||
|
||||
# get the most advanced service version that supports our api
|
||||
version = [str(v) for v in ApiServiceProxy._available_versions if Session.check_min_api_version(v)][-1]
|
||||
version = [
|
||||
str(v) for v in ApiServiceProxy._available_versions
|
||||
if Session.check_min_api_version(v, raise_error=False)
|
||||
][-1]
|
||||
Session.api_version = version
|
||||
self.__dict__["__wrapped_version__"] = Session.api_version
|
||||
name = ".v{}.{}".format(
|
||||
|
@ -40,7 +40,6 @@ for a very long time for a non-responding or mis-configured server
|
||||
"""
|
||||
ENV_API_EXTRA_RETRY_CODES = EnvEntry("CLEARML_API_EXTRA_RETRY_CODES")
|
||||
|
||||
|
||||
ENV_FORCE_MAX_API_VERSION = EnvEntry("CLEARML_FORCE_MAX_API_VERSION", type=str)
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@ from .defs import (
|
||||
ENV_API_EXTRA_RETRY_CODES,
|
||||
ENV_API_DEFAULT_REQ_METHOD,
|
||||
ENV_FORCE_MAX_API_VERSION,
|
||||
ENV_IGNORE_MISSING_CONFIG,
|
||||
MissingConfigError
|
||||
)
|
||||
from .request import Request, BatchRequest # noqa: F401
|
||||
@ -736,7 +737,7 @@ class Session(TokenManager):
|
||||
return urlunparse(parsed)
|
||||
|
||||
@classmethod
|
||||
def check_min_api_version(cls, min_api_version):
|
||||
def check_min_api_version(cls, min_api_version, raise_error=True):
|
||||
"""
|
||||
Return True if Session.api_version is greater or equal >= to min_api_version
|
||||
"""
|
||||
@ -764,6 +765,9 @@ class Session(TokenManager):
|
||||
# noinspection PyBroadException
|
||||
try:
|
||||
cls()
|
||||
except MissingConfigError:
|
||||
if raise_error and not ENV_IGNORE_MISSING_CONFIG.get():
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user