Avoid processing the same EasyConfig multiple times #4767
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When passing the same EasyConfig file multiple times on the commandline it will be parsed once and put into a cache.
Every future call will get the same
EasyConfig
instance so any modification to it will be reflected in all future uses of supposedly "freshly parsed EasyConfigs".This leads to confusing failures when trying to build the same file twice which is likely a mistake anyway, especially when one file is a symlink to another one passed too.
So just make sure each physical file is parsed only once.
I ran into this when building a software using
usempi: True
that errored during configure due to this:This is actually a bug introduced by 3836140:
copy.deepcopy
was used which would copy the easyconfig instances contained in the cached dictI don't think this was intentional, the commit message reads
But the operation is done on dict instances not EasyConfig instances. Shall we fix that too @boegel ?
That would we an alternative to this PR: If we do get independent EC instances then building the same EC twice should work. But I'd prefer this or both.