mirror of
				https://github.com/clearml/clearml-server
				synced 2025-06-26 23:15:47 +00:00 
			
		
		
		
	Support skipping mongodb version check on startup
This commit is contained in:
		
							parent
							
								
									98122690df
								
							
						
					
					
						commit
						06a7aa3126
					
				@ -41,6 +41,7 @@
 | 
			
		||||
        # controls whether FieldDoesNotExist exception will be raised for any extra attribute existing in stored data
 | 
			
		||||
        # but not declared in a data model
 | 
			
		||||
        strict: false
 | 
			
		||||
        ensure_db_version_on_startup: true
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    elastic {
 | 
			
		||||
 | 
			
		||||
@ -45,6 +45,10 @@ def get_last_server_version() -> Version:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _ensure_mongodb_version():
 | 
			
		||||
    if not config.get("apiserver.mongo.ensure_db_version_on_startup", True):
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    log.info("Checking DB version")
 | 
			
		||||
    db: pymongo.database.Database = get_db(Database.backend)
 | 
			
		||||
    db_version = db.client.server_info()["version"]
 | 
			
		||||
    if not db_version.startswith("6.0"):
 | 
			
		||||
@ -53,6 +57,7 @@ def _ensure_mongodb_version():
 | 
			
		||||
 | 
			
		||||
    res = db.client.admin.command({"getParameter": 1, "featureCompatibilityVersion": 1})
 | 
			
		||||
    version = nested_get(res, ("featureCompatibilityVersion", "version"))
 | 
			
		||||
    log.info(f"DB version: {version}")
 | 
			
		||||
    if version == "6.0":
 | 
			
		||||
        return
 | 
			
		||||
    if version != "5.0":
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user