-
Notifications
You must be signed in to change notification settings - Fork 913
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
Clarify in docs how runtime parameter resolution works #4096
Conversation
…un env is also set Signed-off-by: Merel Theisen <[email protected]>
OmegaConfLoader
runtime parameter resolution when run env
is set
Signed-off-by: Merel Theisen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it difficult to understand conceptually that we only include runtime_params for base_env but not the others. I think this may be buggy:
I try this with an example:
# base
model_options:
test_size: 0.2
random_state: 3
features:
- engines
# local
model_options:
test_size: 0.2
random_state: 3
features:
- engines
nok: 1
%reload_kedro --params nok=3
config = context.config_loader
config["parameters"]
The expexted parameters should give me nok=3
, but instead I get nok=1
. If I remove nok:1
from local
then I get nok=3
again.
@noklam you're right. Let me dig some more! |
Signed-off-by: Merel Theisen <[email protected]>
This issue is more complicated than it seemed at first. The current behaviour is as follows:
I've added some tests to highlight what's going on and what the desired behaviour is:
Solutions tried:
Proposed "solution": not change anything. All the behaviours can be met with the current implementation in place, but to meet the first expectation the user has to specify soft merging for parameters to ensure the |
What if we just merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for digging into that so thoroughly, @merelcht! From what I understand, the desired behavior is achievable, but we need to clearly document it for the users, right?
@ElenaKhaustova I thought the same and tried this, but then this part doesn't work anymore:
|
Then, it looks like there's no easy way to fix that without refactoring the logic. So, just explaining how to achieve the desired behaviour looks good, though it's not easy cause the examples are quite niche and require an understanding of how resolution works from the user side. We can keep an eye on this case in if we decide to refactor this part to avoid corner cases because it looks quite complex now. |
…n works. Signed-off-by: Merel Theisen <[email protected]>
OmegaConfLoader
runtime parameter resolution when run env
is setThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @merelcht! I'm not sure, but perhaps including an example to the docs similar to the one you provided in the tests would help to better illustrate the concept.
Signed-off-by: Merel Theisen <[email protected]>
Done! Let me know if this is what you expected. |
Signed-off-by: Merel Theisen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
super, thank you! |
Description
Closes #3456
Development notes
The problem is that when runtime parameters are provided, they get merged with both the config loaded from the base environment as well as the run environment. So they are duplicated and because of the destructive merge happening by default this can end up removing values present in base config and not in the runtime config.
Solutions tried:
runtime_params
into base config and not in all loaded configs: this meets the requirements for point 1 and 3 above, but not 2.runtime_params
to after bothbase
anddefault_run_env
config have been loaded. This meets requirements for 1 and 2, but not 3.Proposed "solution"
not change anything. All the behaviours can be met with the current implementation in place, but to meet the expectation described in #3456 the user has to specify soft merging for parameters to ensure the
default_run_env
doesn't destructively overwrite (nested) parameters inbase
config.Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file