1- import uvicorn
2-
3- from invokeai .app .invocations .load_custom_nodes import load_custom_nodes
4- from invokeai .app .services .config .config_default import get_config
5- from invokeai .app .util .torch_cuda_allocator import configure_torch_cuda_allocator
6- from invokeai .backend .util .logging import InvokeAILogger
7- from invokeai .frontend .cli .arg_parser import InvokeAIArgs
8-
9-
101def get_app ():
112 """Import the app and event loop. We wrap this in a function to more explicitly control when it happens, because
123 importing from api_app does a bunch of stuff - it's more like calling a function than importing a module.
@@ -18,9 +9,20 @@ def get_app():
189
1910def run_app () -> None :
2011 """The main entrypoint for the app."""
21- # Parse the CLI arguments.
12+ from invokeai .frontend .cli .arg_parser import InvokeAIArgs
13+
14+ # Parse the CLI arguments before doing anything else, which ensures CLI args correctly override settings from other
15+ # sources like `invokeai.yaml` or env vars.
2216 InvokeAIArgs .parse_args ()
2317
18+ import uvicorn
19+
20+ from invokeai .app .invocations .baseinvocation import InvocationRegistry
21+ from invokeai .app .invocations .load_custom_nodes import load_custom_nodes
22+ from invokeai .app .services .config .config_default import get_config
23+ from invokeai .app .util .torch_cuda_allocator import configure_torch_cuda_allocator
24+ from invokeai .backend .util .logging import InvokeAILogger
25+
2426 # Load config.
2527 app_config = get_config ()
2628
@@ -66,6 +68,15 @@ def run_app() -> None:
6668 # core nodes have been imported so that we can catch when a custom node clobbers a core node.
6769 load_custom_nodes (custom_nodes_path = app_config .custom_nodes_path , logger = logger )
6870
71+ # Check all invocations and ensure their outputs are registered.
72+ for invocation in InvocationRegistry .get_invocation_classes ():
73+ invocation_type = invocation .get_type ()
74+ output_annotation = invocation .get_output_annotation ()
75+ if output_annotation not in InvocationRegistry .get_output_classes ():
76+ logger .warning (
77+ f'Invocation "{ invocation_type } " has unregistered output class "{ output_annotation .__name__ } "'
78+ )
79+
6980 if app_config .dev_reload :
7081 # load_custom_nodes seems to bypass jurrigged's import sniffer, so be sure to call it *after* they're already
7182 # imported.
0 commit comments