Skip to content

Commit

Permalink
Merge pull request #38 from jaimervq/improve_class_registry_time
Browse files Browse the repository at this point in the history
Change class registry approach
  • Loading branch information
jaimervq committed Feb 19, 2024
2 parents 35bf39a + e02a6bd commit 974c780
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions logic/class_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@


import concurrent.futures
import os
import importlib
import inspect
import os
import time

from PySide2 import QtCore
import yaml
Expand Down Expand Up @@ -146,10 +147,15 @@ def get_all_node_classes():
all_py.append(p)

all_classes_dict = dict()
t1 = time.time()
executor = concurrent.futures.ThreadPoolExecutor()
for full_path in all_py:
future = executor.submit(register_node_lib, full_path)
all_classes_dict.update(future.result())
with concurrent.futures.ThreadPoolExecutor(10) as executor:
futures = [
executor.submit(register_node_lib, full_path) for full_path in all_py
]
for future in concurrent.futures.as_completed(futures):
all_classes_dict.update(future.result())
LOGGER.info(f"Total time scanning classes: {time.time()-t1} s.")

# TODO examine classes to make sure there are no repeated names?
return all_classes_dict
Expand Down

0 comments on commit 974c780

Please sign in to comment.