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.

Ability to specify composition order of primary config file

See original GitHub issue

There are multiple use cases for having configuration in the users config:

Use it as scaffolding and use defaults to populate it:

defalts:
  - foo: bar

foo:
   a: ???
   b: ???

In the above case foo/bar.yaml can be used to populate a and b.

An alternative approach is to allow the user to override things populated by the defaults from the config file:

defalts:
  - foo: bar

foo:
   a: 10
   b: 20

In this scenario, the user wants to force foo.a and foo.b to specific values.

Those two approaches are conflicting, each one requires a different composition order. Currently, the supported mode is the first one and the second is not possible. Composition order is roughly:

  • hydra related configs
  • user config file
  • user provided defaults

The idea is to support explicit specification of when to merge in the users config via a special keyword in the defaults, like _self_. for example:

defalts:
  - _self_
  - foo: bar

or:

defalts:
  - foo: bar
  - _self_

In the first case, the config file would be composed before foo/bar, in the second one after.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
omrycommented, Dec 25, 2019

The primary motivation here is to address the framework use case better.

__SELF__ might be useful, but it’s already weird because hydra has it’s own defaults list that is being merged before the user defaults list, so something like:

defaults:
   - _SELF_
   - hydra/launcher: my_launcher

would actually result in hydra/launcher being merged in before SELF. There is a task to consider allowing other files to provide their own defaults (making the hydra special case a norm). those things are all interacting with one another.

There might still be room for it though, but I would want to explore it once things settles down as implementing it early might limit the design space.

by the way, a less magical form of this is to specify the file name:

my_config.yaml:

defaults:
   - my_config
   - foo: bar
2reactions
omrycommented, Jan 31, 2020

switching to target to 1.1.0 as there is a workaround for now and this is a big change with significant implications.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changes to default composition order
Structured Configs used as primary config may see changes as well. You should add _self_ to the defaults list to indicate the composition...
Read more >
hydra - structured config group/package override via yaml
What I want to achieve is the same behavior as the CLI override "python myapp.py db=mysql" when the defaults lists of the config...
Read more >
Configure instance fleets - Amazon EMR
For the primary fleet, the target is always one. You can choose one subnet (Availability Zone) or a range. If you choose a...
Read more >
Configuration Blocks and Attributes - Terragrunt
Learn about all the blocks and attributes supported in the terragrunt configuration file.
Read more >
Raspberry Pi Documentation - The config.txt file
Setting hdmi_enable_4kp60 will increase power consumption and the ... gpio settings are applied in order, so those appearing later override those appearing ...
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