Skip to content

Commit

Permalink
fix: Remove settings API hash comparison and runtime generation of se…
Browse files Browse the repository at this point in the history
…ttings API classes
  • Loading branch information
mkundu1 committed Oct 25, 2024
1 parent cb236c6 commit cd02f3a
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2204,42 +2204,28 @@ def get_root(
"""
from ansys.fluent.core import CODEGEN_OUTDIR, CODEGEN_ZIP_SETTINGS, utils

obj_info = flproxy.get_static_info()
try:
if os.getenv("PYFLUENT_USE_OLD_SETTINGSGEN") != "1":
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
if os.getenv("PYFLUENT_USE_OLD_SETTINGSGEN") != "1":
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
)
else:
if CODEGEN_ZIP_SETTINGS:
importer = zipimporter(
str(CODEGEN_OUTDIR / "solver" / f"settings_{version}.zip")
)
settings = importer.load_module("settings")
else:
if CODEGEN_ZIP_SETTINGS:
importer = zipimporter(
str(CODEGEN_OUTDIR / "solver" / f"settings_{version}.zip")
)
settings = importer.load_module("settings")
else:
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}" / "__init__.py",
)

if settings.SHASH != _gethash(obj_info):
settings_logger.warning(
"Mismatch between generated file and server object "
"info. Dynamically created settings classes will "
"be used."
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}" / "__init__.py",
)
raise RuntimeError("Mismatch in hash values")
cls = settings.root
except Exception:
cls, _ = get_cls("", obj_info, version=version)
root = cls()
root = settings.root()
root.set_flproxy(flproxy)
root._set_on_interrupt(interrupt)
root._set_file_transfer_service(file_transfer_service)
_Alias.scheme_eval = scheme_eval
_fix_parameter_list_return.scheme_eval = scheme_eval
root._setattr("_static_info", obj_info)
root._setattr("_file_transfer_service", file_transfer_service)
return root

Expand Down

0 comments on commit cd02f3a

Please sign in to comment.