Parse environmental variables in configuration yaml file
See original GitHub issueI would like to be able to use environmental variables in the configuration yaml file (see also here).
My use case: I am using dask on a cluster where nodes are assigned upon login, and the fast temporary storage will change depending on the particular node one is logged in. It is always identified as $TMPDIR
.
Would it be possible to use a special syntax e.g. temporary-directory: (($TMPDIR))
, so that dask parses the environmental variable each time a cluster/worker is started?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Python YAML configuration with environment variables parsing
Load a YAML configuration file and resolve any environment variables Note: ... Python YAML configuration with environment variables parsing.
Read more >How to replace environment variable value in yaml file to be ...
You can do it through yaml.add_implicit_resolver and yaml.add_constructor . In the code below, you are defining a resolver that will match on ${ ......
Read more >How to use a YAML file or environment variables to populate ...
In most cases, we suggest using a config variables YAML file. YAML files make variables more visible, easily editable, and allow for modularization...
Read more >Python YAML configuration with environment variables parsing
Parsing a YAML file that may contain environment variables for sensitive data. Example of a YAML configuration with environment variables:
Read more >Use environment variables in the configuration - Elastic
Each variable reference is replaced at startup by the value of the environment variable. The replacement is case-sensitive and occurs before the YAML...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jbusecke Dask already provides a function that can handle expansion of environmental variables in
dask.config.expand_environment_variables(...)
It is used in some modules, e.g. here - but is not currently applied to all config. This could be a useful addition!
Thank you very much. I got swamped at work this week, but will hopefully have some time to give this a try in the next days.