-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
[Bug] key collision when using option@_global_ in defaults list #1784
Labels
Comments
This issue comes from the def get_override_key(self) -> str:
default_pkg = self.get_default_package()
final_pkg = self.get_final_package(default_to_package_header=False)
key = self.get_group_path()
if default_pkg != final_pkg and final_pkg != "":
key = f"{key}@{final_pkg}"
return key Key collision occurs if the defaults list has two entries, where one entry satisfies |
There is some ambiguity here. This could be tricky to fix. |
I'm having success with the following diff: def get_override_key(self) -> str:
default_pkg = self.get_default_package()
final_pkg = self.get_final_package(default_to_package_header=False)
key = self.get_group_path()
- if default_pkg != final_pkg and final_pkg != "":
+ if default_pkg != final_pkg:
+ if final_pkg == "":
+ final_pkg = "_global_"
+
key = f"{key}@{final_pkg}"
return key Will submit a PR shortly. |
Jasha10
added a commit
to Jasha10/hydra
that referenced
this issue
Aug 25, 2021
Jasha10
added a commit
to Jasha10/hydra
that referenced
this issue
Aug 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a defaults list contains entries for both
option
andoption@_global_
, there is a key collision resulting inConfigCompositionException
.Consider the following setup:
If
config.yaml
has a defaults list with just one entry,db: mysql
, the result is as expected:If
config.yaml
has a defaults list with just one entry,db@_global_: sqlite
, the result is as expected:If
config.yaml
has a defaults list with both of these entries, there is an unexpected key collision:The expected output in this scenario would be the following:
The text was updated successfully, but these errors were encountered: