Skip to content

Commit 1e2c7c5

Browse files
committed
Move load_custom_nodes() to run_app() entrypoint.
1 parent da2b681 commit 1e2c7c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

invokeai/app/api_app.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
workflows,
2929
)
3030
from invokeai.app.api.sockets import SocketIO
31-
from invokeai.app.invocations.load_custom_nodes import load_custom_nodes
3231
from invokeai.app.services.config.config_default import get_config
3332
from invokeai.app.util.custom_openapi import get_openapi_func
3433
from invokeai.backend.util.logging import InvokeAILogger
@@ -38,11 +37,6 @@
3837

3938
loop = asyncio.new_event_loop()
4039

41-
# Load custom nodes. This must be done after importing the Graph class, which itself imports all modules from the
42-
# invocations module. The ordering here is implicit, but important - we want to load custom nodes after all the
43-
# core nodes have been imported so that we can catch when a custom node clobbers a core node.
44-
load_custom_nodes(custom_nodes_path=app_config.custom_nodes_path)
45-
4640

4741
@asynccontextmanager
4842
async def lifespan(app: FastAPI):

invokeai/app/run_app.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import uvicorn
22

3+
from invokeai.app.invocations.load_custom_nodes import load_custom_nodes
34
from invokeai.app.services.config.config_default import get_config
45
from invokeai.app.util.startup_utils import (
56
apply_monkeypatches,
@@ -47,6 +48,11 @@ def run_app() -> None:
4748
# Initialize the app and event loop.
4849
app, loop = get_app()
4950

51+
# Load custom nodes. This must be done after importing the Graph class, which itself imports all modules from the
52+
# invocations module. The ordering here is implicit, but important - we want to load custom nodes after all the
53+
# core nodes have been imported so that we can catch when a custom node clobbers a core node.
54+
load_custom_nodes(custom_nodes_path=app_config.custom_nodes_path)
55+
5056
# Start the server.
5157
config = uvicorn.Config(
5258
app=app,

0 commit comments

Comments
 (0)