Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import asic module issue. #240

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/sai_testbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self, base_dir, name, with_traffic, skip_dataplane=False):

@staticmethod
def __import_module(root_path, module_name):
module_specs = importlib.util.find_spec(module_name, [root_path])
module_specs = importlib.util.spec_from_file_location(module_name, os.path.join(root_path, f"{module_name}.py"))
return module_specs.loader.load_module()

@staticmethod
Expand All @@ -123,11 +123,11 @@ def spawn_asic(base_dir, cfg, asic_type="npu"):
asic_mod = None
module_name = f"sai_{asic_type}"
try:
asic_mod = self.__import_module(asic_dir, module_name)
asic_mod = SaiTestbed.__import_module(asic_dir, module_name)
except:
logging.info("No {} specific module defined..".format(params["asic"]))
try:
asic_mod = self.__import_module(asic_dir + "/../", module_name)
asic_mod = SaiTestbed.__import_module(asic_dir + "/../", module_name)
except:
logging.warning("No NPU specific module defined.")

Expand Down
Loading