tidy: "validate_root" -> "validate_directories"

This commit is contained in:
psychedelicious 2024-03-18 21:17:37 +11:00
parent 982b513af3
commit 1d4517d00d
3 changed files with 8 additions and 8 deletions

View File

@ -233,9 +233,9 @@ def invoke_api() -> None:
else: else:
return port return port
from invokeai.backend.install.check_root import check_invokeai_root from invokeai.backend.install.check_root import check_directories
check_invokeai_root(app_config) # note, may exit with an exception if root not set up check_directories(app_config) # note, may exit with an exception if root not set up
if app_config.dev_reload: if app_config.dev_reload:
try: try:

View File

@ -8,19 +8,19 @@ from invokeai.app.services.config import InvokeAIAppConfig
# TODO(psyche): Should this also check for things like ESRGAN models, database, etc? # TODO(psyche): Should this also check for things like ESRGAN models, database, etc?
def validate_root_structure(config: InvokeAIAppConfig) -> None: def validate_directories(config: InvokeAIAppConfig) -> None:
assert config.db_path.parent.exists(), f"{config.db_path.parent} not found" assert config.db_path.parent.exists(), f"{config.db_path.parent} not found"
assert config.models_path.exists(), f"{config.models_path} not found" assert config.models_path.exists(), f"{config.models_path} not found"
def check_invokeai_root(config: InvokeAIAppConfig): def check_directories(config: InvokeAIAppConfig):
try: try:
validate_root_structure(config) validate_directories(config)
except Exception as e: except Exception as e:
print() print()
print(f"An exception has occurred: {str(e)}") print(f"An exception has occurred: {str(e)}")
print("== STARTUP ABORTED ==") print("== STARTUP ABORTED ==")
print("** One or more necessary files is missing from your InvokeAI root directory **") print("** One or more necessary files is missing from your InvokeAI directories **")
print("** Please rerun the configuration script to fix this problem. **") print("** Please rerun the configuration script to fix this problem. **")
print("** From the launcher, selection option [6]. **") print("** From the launcher, selection option [6]. **")
print( print(

View File

@ -25,7 +25,7 @@ from npyscreen import widget
from invokeai.app.services.config.config_default import get_config from invokeai.app.services.config.config_default import get_config
from invokeai.app.services.model_install import ModelInstallServiceBase from invokeai.app.services.model_install import ModelInstallServiceBase
from invokeai.backend.install.check_root import validate_root_structure from invokeai.backend.install.check_root import validate_directories
from invokeai.backend.install.install_helper import InstallHelper, InstallSelections, UnifiedModelInfo from invokeai.backend.install.install_helper import InstallHelper, InstallSelections, UnifiedModelInfo
from invokeai.backend.model_manager import ModelType from invokeai.backend.model_manager import ModelType
from invokeai.backend.util import choose_precision, choose_torch_device from invokeai.backend.util import choose_precision, choose_torch_device
@ -611,7 +611,7 @@ def main() -> None:
logger = InvokeAILogger().get_logger(config=config) logger = InvokeAILogger().get_logger(config=config)
try: try:
validate_root_structure(config) validate_directories(config)
except AssertionError: except AssertionError:
logger.info("Your InvokeAI root directory is not set up. Calling invokeai-configure.") logger.info("Your InvokeAI root directory is not set up. Calling invokeai-configure.")
sys.argv = ["invokeai_configure", "--yes", "--skip-sd-weights"] sys.argv = ["invokeai_configure", "--yes", "--skip-sd-weights"]