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

Improve OmegaConfigLoader performance when global/variable interpolations are involved #4322

Open
ravi-kumar-pilla opened this issue Nov 12, 2024 · 2 comments

Comments

@ravi-kumar-pilla
Copy link
Contributor

Description

Extending on the investigation in #3893 , OmegaConfigLoader lags in resolving catalog configurations when global/variable interpolations are involved.

Context

Some previous observations:
#3893 (comment)
#3893 (comment)

Steps to Reproduce

Run stress test which creates a single catalog with variable interpolations - https://github.com/kedro-org/kedro/blob/test/ocl-bottleneck/kedro_benchmarks/temp_investigate_ocl/ocl_plot_variables.py

Expected Result

Reduce the time spent on below methods (when interpolations are involved, the bottleneck seems to be OmegaConf.to_container)

Actual Result

#3893 (comment)

Your Environment

image
  • Kedro version used (pip show kedro or kedro -V): 0.19.9
  • Python version used (python -V): 3.11
  • Operating system and version: macOS and Sonoma 14.7.1
@noklam
Copy link
Contributor

noklam commented Nov 18, 2024

During the investigation, I found that there was a slow bit in _set_globals_value. I didn't spent enough time to fix it, but with a quick fix it improves roughly from 1.5s -> 0.9s, but there are probably more.

@noklam
Copy link
Contributor

noklam commented Nov 18, 2024

Particularly, there is an obvious slow path global_oc get created and destroyed for every reference of $globals

def _get_globals_value(self, variable: str, default_value: Any = _NO_VALUE) -> Any:
"""Return the globals values to the resolver"""
if variable.startswith("_"):
raise InterpolationResolutionError(
"Keys starting with '_' are not supported for globals."
)
globals_oc = OmegaConf.create(self._globals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Do
Development

No branches or pull requests

3 participants