Find a Dask config key by searching config location paths
(key)
| 75 | @config.command(name="find") |
| 76 | @click.argument("key", required=True) |
| 77 | def config_find(key): |
| 78 | """Find a Dask config key by searching config location paths""" |
| 79 | paths = list(dask.config.paths_containing_key(key)) |
| 80 | if paths: |
| 81 | click.echo(f"Found [{key}] in the following files:") |
| 82 | max_len = len(str(max(paths, key=lambda v: len(str(v))))) |
| 83 | for path in paths: |
| 84 | config = next(dask.config.collect_yaml([path])) |
| 85 | value = dask.config.get(key, config=config) |
| 86 | spacing = " " * (max_len - len(str(path))) |
| 87 | click.echo(f"{path} {spacing} [{key}={value}]") |
| 88 | else: |
| 89 | click.echo(f"Unable to find [{key}] in any of the following paths:") |
| 90 | click.echo("\n".join(map(str, dask.config.paths))) |
| 91 | |
| 92 | |
| 93 | @config.command(name="set") |