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

Enable overriding of config keys through run time parameters #2931

Closed
wants to merge 4 commits into from
Closed
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
21 changes: 12 additions & 9 deletions kedro/config/omegaconf_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,20 @@ def load_and_merge_dir_config( # noqa: too-many-arguments
return {}

if key == "parameters":
# Merge with runtime parameters only for "parameters"
return OmegaConf.to_container(
merged_conf = OmegaConf.to_container(
OmegaConf.merge(*aggregate_config, self.runtime_params), resolve=True
)
return {
k: v
for k, v in OmegaConf.to_container(
OmegaConf.merge(*aggregate_config), resolve=True
).items()
if not k.startswith("_")
}
else:
original_keys = OmegaConf.merge(*aggregate_config).keys()
merged_conf = {
k: v
for k, v in OmegaConf.to_container(
OmegaConf.merge(*aggregate_config, self.runtime_params),
resolve=True,
).items()
if not k.startswith("_") and k in original_keys
}
return merged_conf

def _is_valid_config_path(self, path):
"""Check if given path is a file path and file type is yaml or json."""
Expand Down
Loading