Elias WILLEMSE
07/10/2024, 12:06 PMOmegaConfigLoader(conf_source=str(Path.cwd()))
doesn’t point to the conf_source
. Other examples use:
from kedro.config import OmegaConfigLoader
from kedro.framework.project import settings
from pathlib import Path
config_loader = OmegaConfigLoader(
conf_source=str(Path.cwd() / settings.CONF_SOURCE)
)
But there is another issue, which I’m not sure is a bug, or just an incorrect docstring. The argument description of OmegaConfigLoader
is:
"""Instantiates a ``OmegaConfigLoader``.
Args:
conf_source: Path to use as root directory for loading configuration.
env: Environment that will take precedence over base.
runtime_params: Extra parameters passed to a Kedro run.
config_patterns: Regex patterns that specify the naming convention for configuration
files so they can be loaded. Can be customised by supplying config_patterns as
in `CONFIG_LOADER_ARGS` in `settings.py`.
base_env: Name of the base environment. Defaults to `"base"`.
This is used in the `conf_paths` property method to construct
the configuration paths.
default_run_env: Name of the default run environment. Defaults to `"local"`.
Can be overridden by supplying the `env` argument.
custom_resolvers: A dictionary of custom resolvers to be registered. For more information,
see here: <https://omegaconf.readthedocs.io/en/2.3_branch/custom_resolvers.html#custom-resolvers>
merge_strategy: A dictionary that specifies the merging strategy for each configuration type.
The accepted merging strategies are `soft` and `destructive`. Defaults to `destructive`.
"""
The issue is that base_env
and default_run_env
don’t default to "base"
and "local"
, they both default to ""
:
self.base_env = base_env or ""
self.default_run_env = default_run_env or ""
and the whole conf
source will get scanned for base_config
. This caused duplicate key errors, since I worked with base
and test
environments.
So the question is, is "base"
and "local"
supposed to default to ""
and the argument docstring is wrong, or are they supposed to default to "base"
and "local"
and it’s a bug?
Manually setting base_config="base"
resolves all issues, so it’s not a major issue:
from kedro.config import OmegaConfigLoader
from kedro.framework.project import settings
from pathlib import Path
config_loader = OmegaConfigLoader(
conf_source=str(Path.cwd() / settings.CONF_SOURCE), base_config="base"
)
PS. Happy to file an issue, just thought it worth checking if it should go under bugs or documentation.Merel
07/10/2024, 12:52 PMElias WILLEMSE
07/10/2024, 12:55 PMHowever, when you use theLike they say, through 3h of debugging you can save up to 10 minutes of reading through documentation!directly, it assumes no environment.OmegaConfigLoader
Merel
07/10/2024, 12:56 PMElias WILLEMSE
07/10/2024, 12:58 PM