sp_validation.data_roots

Named data roots: one config names an input the same way on every machine.

config/data_roots.yaml maps each root name to the directories that hold it on each machine. A config value writes ${name}/relative/path; on load the root becomes the first of its directories that exists here. The environment variable SPV_ROOT_<NAME> (upper case) overrides the file, for a copy the file doesn’t list. A root with no directory on this machine stays written as ${name}, so a path into it fails when opened and names the missing root.

Only declared root names are substituted; any other ${...} passes through.

A root may be a CADC VOSpace URI, vos:cfis/weak_lensing/ShapePipe/v2.x, so a release is read straight from the vault: local() fetches a vos: path, file or directory, once into ~/.cache/sp_validation/vos/ and returns the copy. It authenticates with the CADC proxy certificate ~/.ssl/cadcproxy.pem (cadc-get-cert -u <user> writes it).

roots(roots_file=PosixPath('/__w/sp_validation/sp_validation/config/data_roots.yaml'))[source]

Root name -> its directory on this machine, for roots present here.

expand(value, roots_file=PosixPath('/__w/sp_validation/sp_validation/config/data_roots.yaml'))[source]

Return value with {root} tokens replaced, recursing into containers.

load_yaml(path, roots_file=PosixPath('/__w/sp_validation/sp_validation/config/data_roots.yaml'))[source]

Read a YAML config with its data roots expanded for this machine.

local(path)[source]

A local path for path: itself, or for a vos: URI its cached copy.

A directory is fetched whole, its files in parallel; a copy is complete once it exists (files are written beside it and renamed, a directory is marked by <dir>.complete), so an interrupted fetch resumes.

localise(value)[source]

value with every vos: string fetched (local()), recursing into containers.