Skip to content

Commit 094e9ef

Browse files
Add a way to disable api nodes: --disable-api-nodes (#7960)
1 parent 1271c4e commit 094e9ef

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

comfy/cli_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class PerformanceFeature(enum.Enum):
148148

149149
parser.add_argument("--disable-metadata", action="store_true", help="Disable saving prompt metadata in files.")
150150
parser.add_argument("--disable-all-custom-nodes", action="store_true", help="Disable loading all custom nodes.")
151+
parser.add_argument("--disable-api-nodes", action="store_true", help="Disable loading all api nodes.")
151152

152153
parser.add_argument("--multi-user", action="store_true", help="Enables per-user storage.")
153154

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def start_comfyui(asyncio_loop=None):
270270
q = execution.PromptQueue(prompt_server)
271271

272272
hook_breaker_ac10a0.save_functions()
273-
nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes)
273+
nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes, init_api_nodes=not args.disable_api_nodes)
274274
hook_breaker_ac10a0.restore_functions()
275275

276276
cuda_malloc_warning()

nodes.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,15 @@ def init_builtin_extra_nodes():
22612261
"nodes_preview_any.py",
22622262
]
22632263

2264+
import_failed = []
2265+
for node_file in extras_files:
2266+
if not load_custom_node(os.path.join(extras_dir, node_file), module_parent="comfy_extras"):
2267+
import_failed.append(node_file)
2268+
2269+
return import_failed
2270+
2271+
2272+
def init_builtin_api_nodes():
22642273
api_nodes_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_api_nodes")
22652274
api_nodes_files = [
22662275
"nodes_ideogram.py",
@@ -2277,25 +2286,36 @@ def init_builtin_extra_nodes():
22772286
]
22782287

22792288
import_failed = []
2280-
for node_file in extras_files:
2281-
if not load_custom_node(os.path.join(extras_dir, node_file), module_parent="comfy_extras"):
2282-
import_failed.append(node_file)
2283-
22842289
for node_file in api_nodes_files:
22852290
if not load_custom_node(os.path.join(api_nodes_dir, node_file), module_parent="comfy_api_nodes"):
22862291
import_failed.append(node_file)
22872292

22882293
return import_failed
22892294

22902295

2291-
def init_extra_nodes(init_custom_nodes=True):
2296+
def init_extra_nodes(init_custom_nodes=True, init_api_nodes=True):
22922297
import_failed = init_builtin_extra_nodes()
22932298

2299+
import_failed_api = []
2300+
if init_api_nodes:
2301+
import_failed_api = init_builtin_api_nodes()
2302+
22942303
if init_custom_nodes:
22952304
init_external_custom_nodes()
22962305
else:
22972306
logging.info("Skipping loading of custom nodes")
22982307

2308+
if len(import_failed_api) > 0:
2309+
logging.warning("WARNING: some comfy_api_nodes/ nodes did not import correctly. This may be because they are missing some dependencies.\n")
2310+
for node in import_failed_api:
2311+
logging.warning("IMPORT FAILED: {}".format(node))
2312+
logging.warning("\nThis issue might be caused by new missing dependencies added the last time you updated ComfyUI.")
2313+
if args.windows_standalone_build:
2314+
logging.warning("Please run the update script: update/update_comfyui.bat")
2315+
else:
2316+
logging.warning("Please do a: pip install -r requirements.txt")
2317+
logging.warning("")
2318+
22992319
if len(import_failed) > 0:
23002320
logging.warning("WARNING: some comfy_extras/ nodes did not import correctly. This may be because they are missing some dependencies.\n")
23012321
for node in import_failed:

0 commit comments

Comments
 (0)