You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the dask/distributed repository maintains configuration information in ~/.dask/... and in particular the file ~/.dask/config.yaml. This configuration has grown organically over time and may not be ideal. If we're going to make a change then we might make a few changes at once:
Move to ~/.config/dask/... which seems to be standard
Move configuration parsing logic from dask/distributed to dask/dask
Perhaps re-organize and clean up our current configuration files
It would be good to collect feedback about current standards before undertaking this work. Presumably there is a lot we can learn from others.
Jupyter has generally spent a lot of time with configuration files (and their layout). Maybe @minrk could offer some good advice here (if you have time Min).
I'm not sure what dask should do, but a few things we learned from building the Jupyter config layout after learning from IPython:
clearly separating config from data/runtime files is good and can avoid permission issues. Try to never put runtime-generated files in the config directory.
loading system-wide and per-env config is useful, especially when building docker images (we load from /etc/jupyter and {sys.prefix}/etc/jupyter in addition to ~/.jupyter)
there's a tricky tradeoff between being good platform citizens (~/Library on macOS, XDG on Linux, etc.) and being consistent (e.g. just use ~/.dask or ~/.config/dask), especially for directories that users will manually interact with.
Following platform standards for this can be nice, but it also makes documentation of paths more complicated and following configuration documentation more confusing for users. If you do something like this, make sure you provide a simple path discovery entrypoint (we have jupyter --paths, jupyter --config-dir, etc.). There is disagreement among mac users about whether tools should pretend that macs follow XDG specs like linux and use ~/.config (not a mac standard) vs using the mac's standard ~/Library paths vs top-level ~/.dask. After briefly following XDG in IPython on Linux, we switched back to platform-insensitive ~/.ipython because we found the confusion caused by this directory having variable locations caused a lot more pain than it was worth.
Based on our experience in IPython/Jupyter, I would use a platform-insensitive path (~/.dask or ~/.config/dask) for a config directory that users are expected to interact with manually. Programmatically interacted-with paths (runtime files, side effects of installation/other entrypoints etc.) can follow platform standards more easily and appdirs seems like a handy implementation of that. In particular, respecting cache and runtime directory environment variables (if you have such files) can be useful on managed systems, which set these to scratch disks, etc.
So dask.distributed has a soft dependency on yaml currently. The suggestion is hardening it? Yeah that could be ok.
Requiring yaml for just dask might be off putting for people. My impression thus far is we are not comfortable requiring toolz there. yaml is a much bigger ask than a pure Python, 2/3 compatible, no extra deps package like toolz.
Taking a step back (given this issue is a 1.0 blocker), I think it is worth evaluating generally whether we are still comfortable with yaml. There are some pros like users are already familiar with it, human readable, etc. There are also some cons heavy dependency, requires C library, complex spec, some security issues (safe_load), maintenance of the flagship library for Python PyYAML has been weak (though improving some in recent months). It's probably also worth generally reviewing what the alternatives are (JSON, TOML, AXON, etc.). Not that we even have to switch. Just this is a good time to take stock, reexamine what we hope to get out of the config format, and see what options best fit our needs.
Agreed that now would be a good time to hear about alternatives. In
practice I like YAML because it is JSON-like, is somewhat more human
readable (though there are counter-arguments to this) and allows for
comments. It is also a widely adopted standard. Having played with
Kubernetes recently though I may be somewhat biased towards it due to
recent experience (kubernetes uses yaml heavily).
On Tue, Apr 24, 2018 at 4:45 PM, jakirkham ***@***.***> wrote:
So dask.distributed has a soft dependency on yaml currently. The
suggestion is hardening it? Yeah that could be ok.
Requiring yaml for just dask might be off putting for people. My
impression thus far is we are not comfortable requiring toolz there. yaml
is a much bigger ask than a pure Python, 2/3 compatible, no extra deps
package like toolz.
Taking a step back (given this issue is a 1.0 blocker), I think it is
worth evaluating generally whether we are still comfortable with yaml.
There are some pros like users are already familiar with it, human
readable, etc. There are also some cons heavy dependency, requires C
library, complex spec, some security issues (safe_load), maintenance of
the flagship library for Python PyYAML has been weak (though improving some
in recent months). It's probably also worth generally reviewing what the
alternatives are (JSON, TOML, AXON, etc.). Not that we even have to switch.
Just this is a good time to take stock, reexamine what we hope to get out
of the config format, and see what options best fit our needs.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3367 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszJRNQgkdtsEm46tW2yjDxlwBJnutks5tr47qgaJpZM4TDxs6>
.
Do we have a (formal) spec for what we are looking for in this config? We've discussed a bit about location here. We also discussed a bit in person about what sorts of things we might like to see in it down the road. It's just not clear to me yet how this forms the spec. IOW what things do we expect to find in the config long term, what things plan to use it, and what are the bare minimum requirements needed to represent it?
On Tue, Apr 24, 2018 at 5:55 PM, jakirkham ***@***.***> wrote:
Do we have a (formal) spec for what we are looking for in this config?
We've discussed a bit about location here. We also discussed a bit in
person about what sorts of things we might like to see in it down the road.
It's just not clear to me yet how this forms the spec. IOW what things do
we expect to find in the config long term, what things plan to use it, and
what are the bare minimum requirements needed to represent it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3367 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszIOnPayh23eY-4xl44R3nvHr5TCQks5tr59bgaJpZM4TDxs6>
.
We do this because we often want to change the default values over time, but don't want to muck with the user's files in case they have already modified the config file.
However this becomes somewhat cumbersome and results in a lot of repetition over time, especially when we use the same config value in many places in the codebase or when those values tend to shift over time (I recently went through and changed all of our default timeouts for example).
I'm curious if we should instead include an uncommented config file in the codebase where we maintain defaults, comment-and-write this to the user's directory if it's not there, and copy it to a location of default configs uncommented that we feel comfortable overwriting whenever we please (perhaps {sys.prefix}/etc/dask/defaults).
Other suggestions would be welcome.
When do we write an empty config file to user space?
Currently we try to write config files to the user's home directory on first import of the project if they don't already exist. This mostly works, but can get a bit odd if you import dask (which gets the configuration), then import dask_foo (which creates a new config file) and find that those values aren't in the configuration.
I wonder if instead we should do this at installation time. If so, how hard is this to do?
Alternatively we could follow other projects and do this from the command line with some sort of dask config init tool.
My concern with using yaml is basically that we won't feel comfortable using it Dask proper (without Distributed) and it will result in more of the status quo. Namely a disparity between Dask and Dask + Distributed. If we pick something simple and easy to use for a configuration file, we will feel more comfortable using that configuration file in Dask.
I'm not sure I understand. I'm proposing that we use YAML everywhere, but that we write dask/dask so that it can work even if it can't read the config files.
For dask/distributed we do not take care to make the project resilient to not being able to read the configuration files. The dask/distributed project has a bunch more configuration than dask/dask, so it's more of a pain to keep default values within the code itself.
Looking at dask/distributed#1948 might be informative of what these changes mean for dask/distributed.
For dask/dask there is no pragmatic difference, other than that there is now some code in dask/config.py to handle configuration for all of the downstream projects.
Since conda depends on YAML it basically comes with Python as far a I (and every other Anaconda user) are concerned. That being the case, I'm obviously fine with the dep for either of distributed or dask.
For non-anaconda users, is a dependency on a YAML library that much of a concern? The deployment situation with pip/Python is so much smoother/easier these days* that I think it's much less of a concern than it used to be.
Activity
martindurant commentedon Apr 2, 2018
You might consider https://github.com/ActiveState/appdirs to place config files , so as to not worry about how things are done on different platforms; then would need a top-level function and/or text during startup to display this path to the user.
ogrisel commentedon Apr 3, 2018
Actually, configuration should rather go to
~/.config/daskaccording to https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html~/.local/share/daskis more user data.jakirkham commentedon Apr 5, 2018
Jupyter has generally spent a lot of time with configuration files (and their layout). Maybe @minrk could offer some good advice here (if you have time Min).
minrk commentedon Apr 5, 2018
I'm not sure what dask should do, but a few things we learned from building the Jupyter config layout after learning from IPython:
/etc/jupyterand{sys.prefix}/etc/jupyterin addition to~/.jupyter)Following platform standards for this can be nice, but it also makes documentation of paths more complicated and following configuration documentation more confusing for users. If you do something like this, make sure you provide a simple path discovery entrypoint (we have
jupyter --paths,jupyter --config-dir, etc.). There is disagreement among mac users about whether tools should pretend that macs follow XDG specs like linux and use~/.config(not a mac standard) vs using the mac's standard~/Librarypaths vs top-level~/.dask. After briefly following XDG in IPython on Linux, we switched back to platform-insensitive~/.ipythonbecause we found the confusion caused by this directory having variable locations caused a lot more pain than it was worth.Based on our experience in IPython/Jupyter, I would use a platform-insensitive path (~/.dask or ~/.config/dask) for a config directory that users are expected to interact with manually. Programmatically interacted-with paths (runtime files, side effects of installation/other entrypoints etc.) can follow platform standards more easily and appdirs seems like a handy implementation of that. In particular, respecting cache and runtime directory environment variables (if you have such files) can be useful on managed systems, which set these to scratch disks, etc.
Add standard configuration file handling
mrocklin commentedon Apr 24, 2018
How do people feel about Dask depending on
yaml?mrocklin commentedon Apr 24, 2018
or at least dask.distributed?
martindurant commentedon Apr 24, 2018
I think its reasonable.
jakirkham commentedon Apr 24, 2018
So
dask.distributedhas a soft dependency onyamlcurrently. The suggestion is hardening it? Yeah that could be ok.Requiring
yamlfor justdaskmight be off putting for people. My impression thus far is we are not comfortable requiringtoolzthere.yamlis a much bigger ask than a pure Python, 2/3 compatible, no extra deps package liketoolz.Taking a step back (given this issue is a 1.0 blocker), I think it is worth evaluating generally whether we are still comfortable with
yaml. There are some pros like users are already familiar with it, human readable, etc. There are also some cons heavy dependency, requires C library, complex spec, some security issues (safe_load), maintenance of the flagship library for Python PyYAML has been weak (though improving some in recent months). It's probably also worth generally reviewing what the alternatives are (JSON, TOML, AXON, etc.). Not that we even have to switch. Just this is a good time to take stock, reexamine what we hope to get out of the config format, and see what options best fit our needs.mrocklin commentedon Apr 24, 2018
jakirkham commentedon Apr 24, 2018
Do we have a (formal) spec for what we are looking for in this config? We've discussed a bit about location here. We also discussed a bit in person about what sorts of things we might like to see in it down the road. It's just not clear to me yet how this forms the spec. IOW what things do we expect to find in the config long term, what things plan to use it, and what are the bare minimum requirements needed to represent it?
mrocklin commentedon Apr 25, 2018
mrocklin commentedon Apr 25, 2018
So in working through this in #3432 I've run across a few questions
Where do we specify defaults?
Currently we provide a commented-out config file in the user's space if possible:
And we include default values in the codebase itself
We do this because we often want to change the default values over time, but don't want to muck with the user's files in case they have already modified the config file.
However this becomes somewhat cumbersome and results in a lot of repetition over time, especially when we use the same config value in many places in the codebase or when those values tend to shift over time (I recently went through and changed all of our default timeouts for example).
I'm curious if we should instead include an uncommented config file in the codebase where we maintain defaults, comment-and-write this to the user's directory if it's not there, and copy it to a location of default configs uncommented that we feel comfortable overwriting whenever we please (perhaps
{sys.prefix}/etc/dask/defaults).Other suggestions would be welcome.
When do we write an empty config file to user space?
Currently we try to write config files to the user's home directory on first import of the project if they don't already exist. This mostly works, but can get a bit odd if you
import dask(which gets the configuration), thenimport dask_foo(which creates a new config file) and find that those values aren't in the configuration.I wonder if instead we should do this at installation time. If so, how hard is this to do?
Alternatively we could follow other projects and do this from the command line with some sort of
dask config inittool.mrocklin commentedon Apr 26, 2018
We could also use
.pyfiles for configuration. Jupyter does this.mrocklin commentedon Apr 29, 2018
My current plan if no one speaks up is the following:
~/.config/dask/I'll start implementing this tomorrow if there is no further conversation.
jakirkham commentedon Apr 30, 2018
My concern with using
yamlis basically that we won't feel comfortable using it Dask proper (without Distributed) and it will result in more of the status quo. Namely a disparity between Dask and Dask + Distributed. If we pick something simple and easy to use for a configuration file, we will feel more comfortable using that configuration file in Dask.mrocklin commentedon Apr 30, 2018
I'm not sure I understand. I'm proposing that we use YAML everywhere, but that we write dask/dask so that it can work even if it can't read the config files.
For dask/distributed we do not take care to make the project resilient to not being able to read the configuration files. The dask/distributed project has a bunch more configuration than dask/dask, so it's more of a pain to keep default values within the code itself.
mrocklin commentedon Apr 30, 2018
Looking at dask/distributed#1948 might be informative of what these changes mean for dask/distributed.
For dask/dask there is no pragmatic difference, other than that there is now some code in dask/config.py to handle configuration for all of the downstream projects.
dhirschfeld commentedon May 2, 2018
Since
condadepends on YAML it basically comes with Python as far a I (and every other Anaconda user) are concerned. That being the case, I'm obviously fine with the dep for either ofdistributedordask.For non-anaconda users, is a dependency on a YAML library that much of a concern? The deployment situation with pip/Python is so much smoother/easier these days* that I think it's much less of a concern than it used to be.
* Notwithstanding xkcd digs 😛
Add standard configuration file handling
Add standard configuration file handling