dask / dask/distributed

Misleading variable naming in `dask_worker.py`

Open
#6,323 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

In `dask_worker.py`, we switch between using workers and nannies based on the `--nanny/--no-nanny` option. This choice is obfuscated by some of the variable names, in particular the `t` variable capturing the class to be initialized
https://github.com/dask/distributed/blob/main/distributed/cli/dask_worker.py#L414-L420

and the `nannies` list, which collects all instances of nannies _or_ workers
https://github.com/dask/distributed/blob/main/distributed/cli/dask_worker.py#L435

Renaming these to something clearer would be helpful for a better understanding, but is also not easy. I'd suggest either switching to
* `t` -> `nanny_or_worker_class`
* `nannies` -> `nannies_or_workers`

which captures the distinction explicitly

or

* `t` -> runner_class`
* `nannies` -> `runners`

which tries to capture the common essence between the two classes in the name `runner`, though I'm not sure if that really cuts it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.