blockrun.dask_config¶
Dask cluster config: bundled templates, layered overrides, key validation.
Bundled templates:
--config dask-localresolves throughimportlib.resources, so it works from any directory, including for an installed command.Layering:
--configis repeatable and deep-merged left to right, so a site config holds only the keys that differ from a template:--config dask-slurm-example --config configs/my-site.yaml
Validation: an unknown key would otherwise merge silently and do nothing, so each file is checked against dask’s own config tree (
unknown_keys()).
Attributes¶
Exceptions¶
An unrecognised key in a dask config — almost always a typo. |
Functions¶
|
Names of the dask configs shipped with this package. |
|
|
|
Resolve, load, validate and merge one or more |
|
One |
|
Dotted paths in |
|
Record the config dask actually received. Returns the path written. |
Module Contents¶
- exception blockrun.dask_config.ConfigKeyError¶
Bases:
ValueErrorAn unrecognised key in a dask config — almost always a typo.
Initialize self. See help(type(self)) for accurate signature.
- blockrun.dask_config.bundled_configs() list[str]¶
Names of the dask configs shipped with this package.
- blockrun.dask_config.deep_merge(base: Mapping[str, Any], overlay: Mapping[str, Any]) dict¶
overlayoverbase: recurse into dicts, REPLACE everything else.Lists are replaced, not concatenated —
job-extra-directivesandworker-extra-argsare complete argument vectors, and appending to them produces a command line nobody wrote. Scalars replace so thatspill: falsecan be overridden back to a number.
- blockrun.dask_config.load_config(sources: str | Sequence[str], *, validate: bool = True) tuple[dict, list[str]]¶
Resolve, load, validate and merge one or more
--configvalues.Returns
(merged, resolved_paths). Each file is validated on its own before merging, so an error names the file that introduced the key.
- blockrun.dask_config.resolve_config(value: str) str¶
One
--configvalue -> a filesystem path.An existing path wins over a bundled name, so a local file can shadow a template and every previously-working invocation keeps working.
- blockrun.dask_config.unknown_keys(doc: Mapping[str, Any], reference: Mapping[str, Any] | None = None, _prefix: tuple[str, ...] = ()) list[str]¶
Dotted paths in
docthat dask’s config tree does not define.Names are canonicalised as dask does (
log_directoryislog-directory). Checking stops below an empty-dict default, which dask uses for free-form mappings such asdistributed.worker.resources, and below scalar or list defaults.
- blockrun.dask_config.write_effective_config(dest: str, merged: Mapping[str, Any], sources: Iterable[str]) str¶
Record the config dask actually received. Returns the path written.
destis a directory (the file is nameddask-config.effective.yaml) or a full path. Kept with a run, it records what layered overrides produced.
- blockrun.dask_config.SUFFIX = '.yaml'¶