mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 02:46:53 +00:00
Fix crash when mongodb host is overridden with cluster settings
This commit is contained in:
parent
893ba48eda
commit
478f6b531b
@ -37,6 +37,8 @@ OVERRIDE_QUERY_ENV_KEY = "CLEARML_MONGODB_SERVICE_QUERY"
|
|||||||
class DatabaseEntry(models.Base):
|
class DatabaseEntry(models.Base):
|
||||||
host = StringField(required=True)
|
host = StringField(required=True)
|
||||||
alias = StringField()
|
alias = StringField()
|
||||||
|
name = StringField()
|
||||||
|
db = StringField()
|
||||||
|
|
||||||
|
|
||||||
class DatabaseFactory:
|
class DatabaseFactory:
|
||||||
@ -78,10 +80,13 @@ class DatabaseFactory:
|
|||||||
missing.append(key)
|
missing.append(key)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
entry = cls._create_db_entry(alias=alias, settings=db_entries.get(key))
|
settings = {**db_entries.get(key)}
|
||||||
|
if not any(field in settings for field in ("name", "db")):
|
||||||
|
settings["name"] = key
|
||||||
|
entry = cls._create_db_entry(alias=alias, settings=settings)
|
||||||
|
|
||||||
if override_connection_string:
|
if override_connection_string:
|
||||||
con_str = furl(override_connection_string).add(path=key).url
|
con_str = override_connection_string
|
||||||
log.info(f"Using override mongodb connection string for {alias}: {con_str}")
|
log.info(f"Using override mongodb connection string for {alias}: {con_str}")
|
||||||
entry.host = con_str
|
entry.host = con_str
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user