mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-25 18:32:35 +08:00
Defer record_node_startup_error in prestartup error path; add docstrings
Buffer prestartup failures into a module-level list inside main.py instead of importing 'nodes' (and therefore 'torch') from within the exception handler. After the normal 'import nodes' line, drain the buffer via nodes.record_node_startup_error so bootstrap order stays deterministic regardless of whether a prestartup script succeeded. Also convert the explanatory '#' comment on the new /node_startup_errors endpoint into a proper docstring and add a docstring to execute_prestartup_script, addressing CodeRabbit's docstring-coverage warning on this PR. Addresses review feedback on PR #13184. Amp-Thread-ID: https://ampcode.com/threads/T-019e2f90-26fe-7048-9855-5ff39d08a3e0 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
25
server.py
25
server.py
@@ -767,17 +767,20 @@ class PromptServer():
|
||||
|
||||
@routes.get("/node_startup_errors")
|
||||
async def get_node_startup_errors(request):
|
||||
# Group errors by source so the frontend/Manager can render them
|
||||
# in distinct sections. `source` is the same string as the
|
||||
# module_parent used at load time (e.g. "custom_nodes",
|
||||
# "comfy_extras", "comfy_api_nodes") and is left as a free-form
|
||||
# string so the contract survives node-source layouts evolving.
|
||||
# The response only contains source buckets that actually had a
|
||||
# failure; consumers should not assume any particular set of keys
|
||||
# is always present.
|
||||
#
|
||||
# `module_path` is stripped because the absolute on-disk path is
|
||||
# internal detail that the frontend has no use for.
|
||||
"""Return startup errors recorded during node loading, grouped by source.
|
||||
|
||||
Group errors by source so the frontend/Manager can render them in
|
||||
distinct sections. ``source`` is the same string as the
|
||||
``module_parent`` used at load time (e.g. ``"custom_nodes"``,
|
||||
``"comfy_extras"``, ``"comfy_api_nodes"``) and is left as a
|
||||
free-form string so the contract survives node-source layouts
|
||||
evolving. The response only contains source buckets that actually
|
||||
had a failure; consumers should not assume any particular set of
|
||||
keys is always present.
|
||||
|
||||
``module_path`` is stripped because the absolute on-disk path is
|
||||
internal detail that the frontend has no use for.
|
||||
"""
|
||||
grouped: dict[str, dict[str, dict]] = {}
|
||||
for entry in nodes.NODE_STARTUP_ERRORS.values():
|
||||
source = entry.get("source", "custom_nodes")
|
||||
|
||||
Reference in New Issue
Block a user