mirror of
https://github.com/clearml/clearml-server
synced 2025-03-03 18:54:20 +00:00
Improve startup sequence
This commit is contained in:
parent
0abfd8da0d
commit
b93591ec32
@ -49,16 +49,17 @@ class ConnectionErrorFilter(logging.Filter):
|
||||
self.last_blocked = None
|
||||
|
||||
def filter(self, record):
|
||||
allow = (
|
||||
(self.err_type is None or record.exc_info[0] != self.err_type)
|
||||
and (self.level is None or record.levelno != self.level)
|
||||
and (self.args is None or record.args[: len(self.args)] != self.args)
|
||||
)
|
||||
|
||||
if not allow:
|
||||
self.last_blocked = record
|
||||
|
||||
return int(allow)
|
||||
try:
|
||||
allow = (
|
||||
(self.err_type is None or record.exc_info[0] != self.err_type)
|
||||
and (self.level is None or record.levelno != self.level)
|
||||
and (self.args is None or record.args[: len(self.args)] != self.args)
|
||||
)
|
||||
if not allow:
|
||||
self.last_blocked = record
|
||||
return allow
|
||||
except Exception:
|
||||
return True
|
||||
|
||||
|
||||
def check_elastic_empty() -> bool:
|
||||
|
@ -57,21 +57,26 @@ with distributed_lock(key, timeout=config.get("apiserver.db_init_timout", 120)):
|
||||
info.es_connection_error = True
|
||||
|
||||
empty_db = check_mongo_empty()
|
||||
if upgrade_monitoring:
|
||||
if not empty_db and (info.es_connection_error or empty_es):
|
||||
if get_last_server_version() < Version("0.16.0"):
|
||||
log.info(f"ES database seems not migrated")
|
||||
info.missed_es_upgrade = True
|
||||
proceed_with_init = not (info.es_connection_error or info.missed_es_upgrade)
|
||||
else:
|
||||
proceed_with_init = True
|
||||
if (
|
||||
upgrade_monitoring
|
||||
and not empty_db
|
||||
and (info.es_connection_error or empty_es)
|
||||
and get_last_server_version() < Version("0.16.0")
|
||||
):
|
||||
log.info(f"ES database seems not migrated")
|
||||
info.missed_es_upgrade = True
|
||||
|
||||
if proceed_with_init:
|
||||
if info.es_connection_error and not info.missed_es_upgrade:
|
||||
raise Exception(
|
||||
"Error starting server: failed connecting to ElasticSearch service"
|
||||
)
|
||||
|
||||
if not info.missed_es_upgrade:
|
||||
init_es_data()
|
||||
init_mongo_data()
|
||||
|
||||
if (
|
||||
proceed_with_init
|
||||
not info.missed_es_upgrade
|
||||
and empty_db
|
||||
and config.get("apiserver.pre_populate.enabled", False)
|
||||
):
|
||||
|
Loading…
Reference in New Issue
Block a user