peal.preflight

Check whether a run config could run, without starting it.

Starting a PEAL run costs anywhere from minutes to a day, and several failure modes only surface late: a config that does not parse, a student or generator that is not on this machine, an output directory that would be moved aside because overwrite is on. This module answers those questions in under a second so a reproduction script, or CI, can refuse to start instead.

Use it from the command line via preflight.py in the repository root, or programmatically:

from peal.preflight import check_config, check_script
problems, notes = check_config("configs/.../square1000x098_sce_cfkd.yaml")

Module attributes

INPUT_KEYS

config keys whose value is a path to something that must already exist

NESTED_PATH_KEYS

sub-keys carrying a path when one of the INPUT_KEYS holds an inline block rather than a path, as in teacher: {type: symbolic, model: <checkpoint>}

OUTPUT_KEYS

keys naming a directory the run writes, which therefore need not exist yet

CHECKPOINT_SUFFIXES

an adaptor names the checkpoint it corrects (a file that must exist), a predictor names the directory it will train into.

WEIGHT_SUFFIXES

file extensions that count as loadable weights for a generator or a sparse dictionary.

PERSONAL_PREFIXES

absolute-path prefixes that are personal by convention (another user's home directory is detected separately in is_personal())

Functions

check_config

Return (problems, notes) for one config.

check_script

Run check_config over every config a script references, in script order.

check_script_executables

Check the files a script runs, not the configs it passes.

configs_in_script

Every --config argument a reproduction script passes, in order.

expand

Resolve the placeholders PEAL configs use.

is_personal

True if a config path lives in another user's home directory or a scratch space, unless it sits under $PEAL_DATA or $PEAL_RUNS.

produced_by

The artefact paths running this config would create.

project_root

Absolute path of the repository root (the parent of the peal package).

scripts_invoked_by

Every python <file> target a reproduction script invokes, in order.