question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recursive defaults support

See original GitHub issue

Hydra does not currently support a recursive defaults list. the defaults are only specified at the primary config file. There is some special support for Hydra itself, but this can be ignored for the purpose of this issue.

Recursive defaults list are tricky, it’s important to ensure intuitive and consistent order of merging.

Proposed logic

if the defaults in the primary file are in that order: main.yaml

defaults:
  - aa: x1
  - bb: x2

The relative order should be preserved. it is however possible for other files to be injected in between aa and bb, for example if aa/x1 had it’s own defaults:

aa/x1.yaml

defaults:
  - cc: x3
  - dd: x4

the resulting defaults list might looks like:

  - aa: x1
  - cc: x3  # from aa/x1 
  - dd: x4  # from aa/x1 
  - bb: x2

Let’s look at a more complicated case:

main.yaml

defaults:
  - aa: x1
  - bb: x2
  - cc: must_win

aa/x1.yaml

defaults:
  - cc: x3
  - dd: x4

In this case, the result should be: the resulting intermediate list will looks like:

  - aa: x1
  - cc: x3
  - dd: x4
  - bb: x2
  - cc: must_win

but the final result will be:

  - aa: x1
  - cc: must_win
  - dd: x4
  - bb: x2

Note how cc retains it’s order in the list, but got the last value.

The rule here is:

  1. Composition order determined by the first time a configuration group is introduced (the db in db=mysql).
  2. Composition choice (the mysql in db=mysql) is determined by the last mention of the group).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
omrycommented, Sep 21, 2020

The plan is to implement this for 1.1.

0reactions
omrycommented, Dec 21, 2020

This feature (or more accurately the one from #1170 a complete rewrite that is not merged yet) is more or less ready (mostly only documentation and some followups are missing).

There are a number of other things which are also planned for Hydra 1.1. You can follow the milestone for 1.1 here.

I am guestimating that initial release candidate will be ready sometimes during H1 2021.

Keep in mind that Hydra 1.1 will take even longer to hit fbcode due to the monorepo nature of it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can anyone explain to me how do default argument values ...
I know and fully understand recursive functions, but I do not understand how do these recursive functions with default arguments such as ...
Read more >
What has changed in the behavior of "allow-recursion" and ...
Following is our original ISC article from the time of the change in default behavior. There has been some confusion surrounding the changes...
Read more >
Meaning of "warning #7762: This procedure is recursive by ...
Literally speaking, Fortran 2018, which current Intel Fortran supports, makes all procedures recursive by default. This means that you no longer have to...
Read more >
PBR Recursive Next Hop [Support] - Cisco Systems
The PBR Recursive Next Hop feature enhances route maps to enable configuration of a recursive next-hop IP address that is used by policy-based...
Read more >
What are the default values or recommended values for max ...
What are the default values or recommended values for max-recursion-depth, max-recursion-queries which are introduced in CVE-2014-8500?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found