Fix stray folder_paths file; improve node importing errors

This commit is contained in:
doctorpangloss 2024-07-15 10:46:05 -07:00
parent 0b45fa8db1
commit 15d21b66d7
4 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,5 @@
# Define a class for your command-line arguments
from __future__ import annotations from __future__ import annotations
import copy
import enum import enum
from typing import Optional, List, Callable, Any, Union, Mapping, NamedTuple from typing import Optional, List, Callable, Any, Union, Mapping, NamedTuple

View File

@ -29,6 +29,7 @@ class FolderPathsTuple:
def __add__(self, other: "FolderPathsTuple"): def __add__(self, other: "FolderPathsTuple"):
assert self.folder_name == other.folder_name assert self.folder_name == other.folder_name
# todo: make sure the paths are actually unique, as this method intends
new_paths = list(frozenset(self.paths + other.paths)) new_paths = list(frozenset(self.paths + other.paths))
new_supported_extensions = self.supported_extensions | other.supported_extensions new_supported_extensions = self.supported_extensions | other.supported_extensions
return FolderPathsTuple(self.folder_name, new_paths, new_supported_extensions) return FolderPathsTuple(self.folder_name, new_paths, new_supported_extensions)

View File

@ -46,12 +46,13 @@ def _import_and_enumerate_nodes_in_module(module: types.ModuleType,
exceptions = [] exceptions = []
with tracer.start_as_current_span("Load Node") as span: with tracer.start_as_current_span("Load Node") as span:
time_before = time.perf_counter() time_before = time.perf_counter()
full_name = module.__name__
try: try:
module_decl = _import_nodes_in_module(exported_nodes, module) module_decl = _import_nodes_in_module(exported_nodes, module)
full_name = module.__name__
span.set_attribute("full_name", full_name) span.set_attribute("full_name", full_name)
timings.append((time.perf_counter() - time_before, full_name, True, exported_nodes)) timings.append((time.perf_counter() - time_before, full_name, True, exported_nodes))
except Exception as exc: except Exception as exc:
module_decl = None
logging.error(f"{full_name} import failed", exc_info=exc) logging.error(f"{full_name} import failed", exc_info=exc)
span.set_status(Status(StatusCode.ERROR)) span.set_status(Status(StatusCode.ERROR))
span.record_exception(exc) span.record_exception(exc)

View File