-
Notifications
You must be signed in to change notification settings - Fork 915
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
Use soft-merge for certain configuration files for OmegaConfLoader
#2122
Comments
OmegaConfLoader
OmegaConfLoader
OmegaConfLoader
After I explored the first iteration of the To iterate further on this, we should come up with a way to expose to the user which patterns they would like to use in "merge mode" and which ones they would like to use in "overwrite mode" (.e.g merge params, but overwrite catalog entries). As a final note (having used a
With OmegaConf, this is no longer possible and while replacing Yaml anchors with interpolations is possible, this would also mean that the keys "s3" and "parquet" would end up in our catalog config files. So, ideally, we should come up with a way to filter these keys (or implement something similar to what we had in Finally, one other disadvantage of the current implementations of Anyway, I found this a fun exercise to do and I hope this brings some additional ideas/inspiration to the table for future development. Happy to discuss this further as well (you can also find me on the Kedro Slack channel). |
This is amazing @MatthiasRoels , thanks so much for having a look at the
Nice one! This will definitely be useful when we implement the functionality. We'll likely get this in for the
This is a very good point, and definitely something we need to explore further. If
This is somewhat related to: #2175 You're absolutely right that we should come up with a way to use interpolations across config.
Awesome! 😄 This is really insightful and I appreciate you taking the time to investigate and leave the feedback ⭐ I'll definitely reach out to you when I need more input! |
Thanks! Related to #2175, I think I have a neat implementation for that one too, extending on what I already implemented (with just a tiny bit refactoring). Will code that up tomorrow and post a link to my code in that issue. Happy to create a PR to contribute my changes! |
As another temporary workaround, at least for the Base tracking:
disable_tracking:
pipelines:
- on_exit_notification
experiment:
name: name-of-local-experiment
params:
long_params_strategy: tag Overriding tracking.experiment.name: name-of-prod-experiment Results in: tracking:
disable_tracking:
pipelines:
- on_exit_notification
experiment:
name: name-of-prod-experiment
params:
long_params_strategy: tag |
Has anyone found a workaround for globals as well? The above mentioned does only work for parameters sadly. |
For anyone interested, I solved it by adding this to our custom config loader.
For us it is especially useful when writing test cases. As you then often want to overwrite only a limited number of parameters, to check if the base config is still valid. |
Hi @IngerMathilde , thanks for sharing your workaround! This was marked as a blocker for 0.19, so we will get to it very soon. |
Completed in #3229 |
Description
At the moment all configuration files are merged in a destructive way. This means all fields/keys are overwritten when two files are merged e.g.:
Base catalog file:
Overriding catalog file:
Will result in:
With catalog and logging files this behaviour is desirable because if you'd like to change a file type, you don't want any fields to remain that belonged to the other file type (e.g.
plotly_args:
for thePlotlyDataSet
). However, with parameter or other config files (e.g. for mlflow) it might be better to merge them in a soft way so you can do something like:Base
mlflow.yml
file:Overriding
mlflow.yml
file:Results in:
This can be achieved my using the OmegaConf merge: https://omegaconf.readthedocs.io/en/2.2_branch/usage.html#merging-configurations
Context
#1868 (comment)
Possible Implementation
Add another setting to
OmegaConfLoader
where the user can specify which files to merge in a destructive way and which one with the regular OmegaConf merge.OmegaConf
merge.Possible Alternative
Merge
catalog
files in a destructive way and all other in a soft way. This would be a breaking change.The text was updated successfully, but these errors were encountered: