Skip to content

Commit 4e8ce4a

Browse files
feat(app): more detailed messages when loading custom nodes
1 parent d40f2fa commit 4e8ce4a

File tree

1 file changed

+11
-5
lines changed
  • invokeai/app/invocations/custom_nodes

1 file changed

+11
-5
lines changed

invokeai/app/invocations/custom_nodes/init.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
from invokeai.backend.util.logging import InvokeAILogger
1111

1212
logger = InvokeAILogger.get_logger()
13-
loaded_count = 0
13+
loaded_packs: list[str] = []
14+
failed_packs: list[str] = []
1415

16+
custom_nodes_dir = Path(__file__).parent
1517

16-
for d in Path(__file__).parent.iterdir():
18+
for d in custom_nodes_dir.iterdir():
1719
# skip files
1820
if not d.is_dir():
1921
continue
@@ -47,12 +49,16 @@
4749
sys.modules[spec.name] = module
4850
spec.loader.exec_module(module)
4951

50-
loaded_count += 1
52+
loaded_packs.append(module_name)
5153
except Exception:
54+
failed_packs.append(module_name)
5255
full_error = traceback.format_exc()
53-
logger.error(f"Failed to load node pack {module_name}:\n{full_error}")
56+
logger.error(f"Failed to load node pack {module_name} (may have partially loaded):\n{full_error}")
5457

5558
del init, module_name
5659

60+
loaded_count = len(loaded_packs)
5761
if loaded_count > 0:
58-
logger.info(f"Loaded {loaded_count} node packs from {Path(__file__).parent}")
62+
logger.info(
63+
f"Loaded {loaded_count} node pack{'s' if loaded_count != 1 else ''} from {custom_nodes_dir}: {', '.join(loaded_packs)}"
64+
)

0 commit comments

Comments
 (0)