Roger Yu
06/23/2024, 10:52 PMglobals.yml
)?
The error is
omegaconf.errors.InterpolationResolutionError: Globals key 'dim_product_filepath' not found and no default value provided.
My set up is:
#conf/base/globals.yml
dim_product_filepath: "data/01_raw/dim_product.parquet"
Clearly dim_product_filepath
is in globals.yml
#conf/base/catalog.yml
dim_product:
type: pandas.ParquetDataset
filepath: ${globals:dim_product_filepath}
#conf/base/parameters.yml
dim_product_filepath: ${globals:dim_product_filepath}
Strangely, running the node works with no problem.
#src/my_project/pipelines/data_processing/pipeline.py
def create_pipeline(**kwargs) -> Pipeline:
return pipeline(
[
node(
func=load_dim_product,
inputs=[
"params:dim_product_sql",
"params:project_id",
"params:dim_product_filepath",
"params:env",
],
outputs="dim_product",
name="load_dim_product",
),
...,
]
)
Nok Lam Chan
06/24/2024, 5:50 AMDataCatalog
OmegaConfigLoader
. These components need to know where is your root directory. when you do kedro run
we automatically figure it out for you, when you put them in pytest
, you may need to specific the location otherwise it's looking ifor config in the wrong place.Nok Lam Chan
06/24/2024, 5:50 AMNok Lam Chan
06/24/2024, 5:54 AMRoger Yu
06/24/2024, 11:27 PMOmegaConfigLoader
2. The example with DataCatalog
hardcodes the catalog keys/values and parameter keys/values. Is this what's expected in unit testing in Kedro? e.g.
catalog.add_feed_dict(
{
"model_input_table" : dummy_data,
"params:model_options": dummy_parameters["model_options"],
}
)
3. There's no example of telling Pytest how to address the globals.yml
. Is there another page that explains this?Nok Lam Chan
06/25/2024, 5:46 AM@pytest.fixture
def config_loader():
return OmegaConfigLoader(conf_source="conf",base_env="base", default_run_env="local")
I cannot find one specific section answering your questions, but there are few concept that are related to this in https://docs.kedro.org/en/stable/configuration/configuration_basics.html#omegaconfigloader
1. base_env
and default_run_env
need to be set correctly when you create OmegaConfigLoader
manually. This isn't needed when you do kedro run
because the framework will read settings.py
and apply the default automatically. The reason for this is that we expect people to use ConfigLoader
outside of framework (decoupled).
2. ^This is related to globals, because the config loader need to know where to locate the config files, the reason why your previous test fail to locate the file is because the conf_source
and env is set incorrectly. The config loader use default config_pattern (customisable)Nok Lam Chan
06/25/2024, 5:47 AMRoger Yu
06/25/2024, 11:46 AM