-
Notifications
You must be signed in to change notification settings - Fork 44
Make Dask configurable in our configuration #2616
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2616 +/- ##
==========================================
+ Coverage 94.93% 94.95% +0.01%
==========================================
Files 252 252
Lines 14620 14672 +52
==========================================
+ Hits 13880 13932 +52
Misses 740 740 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
valeriupredoi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, Manu! I would strongly recommend we removed all valid HPC account/user-related information - this is a public space, and that info is confidential in that it can ease hacking. Put some bogus ones instead 👍
doc/quickstart/configure.rst
Outdated
| slurm_cluster: | ||
| type: dask_jobqueue.SLURMCluster | ||
| queue: shared | ||
| account: bk1088 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove this as public info, Manu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a40fb69
doc/quickstart/configure.rst
Outdated
| memory: 7680MiB | ||
| processes: 2 | ||
| interface: ib0 | ||
| local_directory: "/scratch/b/b381141/dask-tmp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valid user name, pls remove this as public information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a40fb69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to see this finally happening @schlunma!
I just wondered about the format of the configuration file. Would it make sense to be able to specify the configuration parameters per 'cluster'?
How about using the following as a format:
dask:
use: threaded # Use the `threaded` profile defined below
profiles:
threaded:
scheduler: threaded
num_workers: 4
debug:
scheduler: synchronous
local:
scheduler: distributed.LocalCluster
n_workers: 2
threads_per_worker: 2
memory_limit: 4GiB
compute:
scheduler: dask_jobqueue.SLURMCluster
queue: compute
account: bd0854
cores: 128
memory: 240GiB
processes: 32
interface: ib0
local_directory: /scratch/b/b381141/dask-tmp
n_workers: 32
walltime: '2:00:00'
external:
scheduler: distributed.Client
address: "tcp://127.0.0.1:43605"So all the parameters from the profile selected with use will just be applied using dask.config.set, but we do have a special treatment of the scheduler key if it is not one of the values that are supported by Dask by default, we import the module and instantiate the class.
doc/quickstart/configure.rst
Outdated
| run: default # This can be omitted | ||
| clusters: | ||
| default: | ||
| type: default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming this to threaded? That is what is called in the Dask documentation too: https://docs.dask.org/en/stable/scheduler-overview.html#configuring-the-schedulers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to local_threaded in a40fb69
esmvalcore/config/_dask.py
Outdated
| client.dashboard_link, | ||
| ) | ||
| else: | ||
| logger.warning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| logger.warning( | |
| logger.info( |
Maybe this is fine in many cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in d52a5ac
esmvalcore/config/_dask.py
Outdated
| ) | ||
| else: | ||
| logger.warning( | ||
| "Using Dask default scheduler, checkout " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rephrase this as:
"Using the Dask threaded scheduler. The distributed scheduler is recommended, please read ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in d52a5ac
doc/quickstart/configure.rst
Outdated
| .. code:: yaml | ||
| dask: | ||
| run: <NAME_OF_CLUSTER> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| run: <NAME_OF_CLUSTER> | |
| use: <NAME_OF_CLUSTER> |
Would it be nicer to call this use instead of run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f9f4315
I'm not quite sure I understand. This doesn't look like valid YAML to me 😬 My idea was that you should be able to use arbitrary kwargs for the scheduler, the client, and |
🤦 Sorry for the confusion, I tried to write that a bit too fast. Here is a working YAML file: dask:
use: local-threaded # Use the `local-threaded` profile defined below
profiles:
local-threaded:
scheduler: threaded
num_workers: 4
local-distributed:
cluster:
type: distributed.LocalCluster
n_workers: 2
threads_per_worker: 2
memory_limit: 4GiB
debug:
scheduler: synchronous
external:
scheduler-address: "tcp://127.0.0.1:43605"
dkrz-compute:
cluster:
type: dask_jobqueue.SLURMCluster
queue: compute
account: bd0854
cores: 128
memory: 240GiB
processes: 32
interface: ib0
local_directory: /scratch/b/b381141/dask-tmp
n_workers: 32
walltime: '2:00:00'
|
|
Thanks for your comments @bouweandela! I implemented all your desired changes and tested this thoroughly, everything seems to be working fine! Let me know what you think. |
bouweandela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the udpates @schlunma! I've now done a full review of the documentation and suggested a few improvements to the code.
Co-authored-by: Bouwe Andela <[email protected]>
Thanks for the review! I think I address everything. |
bouweandela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍻
Description
This PR makes Dask configurable in our configuration. These are the default settings:
The entries given under
clusterscan be selected via therunoption; this also works in the command line, e.g.,esmvaltool run --dask='{"run": "local"}' recipe_example.ymlI chose not to add a predefined
SLURMClustersetting since this needs to be customized by the user anyway (account and scratch directory).This PR also deprecates the usage of the file
~/.esmvaltool/dask.yml(see below).Closes #2040
Closes #2369
Link to documentation: https://esmvaltool--2616.org.readthedocs.build/projects/ESMValCore/en/2616/quickstart/configure.html#dask-configuration
Deprecation (since v2.12.0, will be removed in v2.14.0) #
Usage of Dask configuration file
~/.esmvaltool/dask.yml: please use the new configuration optiondaskinstead (see details above). If the deprecated file is present, it will be used but a warning will be printed. In this case, alldaskconfiguration options are ignored. To use the new configuration option, delete or move~/.esmvaltool/dask.yml. To force using the new Dask configuration option and ignore~/.esmvaltool/dask.ymlalready now, you can set the environment variableESMVALTOOL_USE_NEW_DASK_CONFIGto any truthy value.Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: