Hi friends, when I have a parameters.yml ```data_s...
# questions
j
Hi friends, when I have a parameters.yml
Copy code
data_science:
  active_modelling_pipeline:
    model_options:
      test_size: 0.2...
and I load it via
Copy code
conf_loader = kedro.config.ConfigLoader(".")
parameters = conf_loader['parameters']
that returns me
Copy code
{'data_science': {'active_modelling_pipeline': {'model_options': {'test_size': 0.2,
. When in another place, I
Copy code
data_catalog = DataCatalog.from_config(catalog, credentials)
data_catalog.add_feed_dict(parameters)
this won't work, because eventually that'll land me
Copy code
ValueError: Pipeline input(s) {'params:data_science.candidate_modelling_pipeline.model_options.random_state', ...} not found in the DataCatalog
What's the intermediate step that I'm missing?
I figured it will probably have something to do with https://github.com/kedro-org/kedro/blob/a6919efb2bec81e864fe7fa02849394bcc7ecd17/tests/pipeline/test_modular_pipeline.py#L122 ... but didn't get much further than that.
m
@Jonas Kemper what are you trying to do?
j
Working on an implementation of KedroService, where we're loading catalog and parameters via an s3 URL that get's passed in through a FastAPI endpoint. We want to use configloader to load those config files and then pass them into a pipeline/runner.
m
And what is this step for? Why are you adding parameters into the catalog?
Copy code
data_catalog = DataCatalog.from_config(catalog, credentials)
data_catalog.add_feed_dict(parameters)
j
I probably shouldn't. 🙈 Eventually I'll need them to end up in my
runner.run(pipeline, data_catalog)
somehow, don't I?
(pipeline comes from
pipeline = register_pipelines()[pipeline_name]
)
m
hmmm.. I don’t know on top of my head how to do this. But I’ll have a think.
🙏 1
j
Thank you. 🙂
n
Are you using all these component without a Kedro project? And the problem here is the parameters isn’t loaded into catalog?
j
Yes.
n
Hm, let me try
🥳 1
The problem is the
params:
syntax is something handled by
KedroContext
(search for KedroContext._get_feed_dict) When you use
add_feed_dict
, it really just store the dictionary as A MemoryDataSet
👀 1
💡 1
j
Can you think of any straight-forward workaround?
n
You are using a Kedro Project so I assume KedroSession/context isn’t available?
j
No, not currently.
Probably not a good idea to try and hijack
from kedro.framework.context.context import _get_feed_dict
?
n
It would be easier if it’s possible to just create
KedroContext
and let it create the
catalog
etc
👍 1
Otherwise, you may either fake a
KedroContext
to just use the
context._get_feed_dict
method or just copy that piece of code_
But I think having KedroContext will be ideal
j
Hmhm, I understand, let me evaluate that option and then report back to you here. :)
n
https://github.com/kedro-org/kedro/issues/2169#issuecomment-1447001865 This may be relevant, some of our community take a different approach by creating a WebServerRunner . It describes the high-level approach but there isn’t code for reference.
👀 1