Skip to content

Fix default values for checks options

Dylan Jaide White requested to merge djwhite/checks-fix-defaults into master

Up to now, default values for checks have been given in multiple places (some in parsing.py, some in a block the top of checks.py, some as default values for the arguments when running a particular check). In some cases these default values were even different, making it uncertain what value it would take. The application of default values in parsing.py didn't seem to work as intended either, making it all in all quite unclear what was happening.

This MR aims to simplify this through the following changes:

  • Default values are now defined in parsing.py only (ie. none in checks.py)
  • Default values for check-type-specific options have been separated from ones common to all check types, so that these values are not unintentionally passed to the wrong check types
  • run_job_checks() in checks.py now accesses values from the checks data dictionary using dict.get(key) instead of dict[key], so it can now handle missing optional values without having to use var = dict[key] if key in dict else default-style structures everywhere
  • Functions for running individual check types have been reworked to expect None for unspecified optional parameters (ie. ones without defaults in parsing.py)
  • Adds some extra requirements for YAML validation for optional arguments for range checks

FYI @gtuci

Work related to https://gitlab.cern.ch/lhcb-dpa/project/-/issues/93 and lhcb-dpa&1 (closed)

Edited by Dylan Jaide White

Merge request reports