Commit 0430f366 authored by Eva Schiffer's avatar Eva Schiffer
Browse files

adding support for pass/fail control in config files instead of only on the command line

parent b8ad57f9
......@@ -12,6 +12,7 @@ import glance.constants as constants
# general settings to control how reports are created
settings = {}
settings[constants.DO_TEST_PASSFAIL_KEY] = False
settings[constants.DO_MAKE_IMAGES_KEY] = True
settings[constants.USE_SHARED_ORIG_RANGE_KEY] = True
......@@ -21,6 +22,8 @@ lat_lon_info = {}
# per variable defaults
defaultValues = {
# note: as of Glance 0.6 these defaults are not strictly nessicary to turn off pass/fail
# as long as you set the settings[constants.DO_TEST_PASSFAIL_KEY] to False pass/fail will be disabled
constants.EPSILON_KEY: None,
constants.EPSILON_FAIL_TOLERANCE_KEY: None,
constants.NONFINITE_TOLERANCE_KEY: None,
......
......@@ -832,12 +832,13 @@ def report_two_inputs_library_call (a_path, b_path, var_list=None,
# have all the variables passed test criteria set for them?
# if no criteria were set then this will be true
didPassAll = True
do_pass_fail = options_set[DO_TEST_PASSFAIL_KEY] # todo, this is a temporary hack, should be loaded with other options
# load the user settings from either the command line or a user defined config file
pathsTemp, runInfo, defaultValues, requestedNames, usedConfigFile = config_organizer.load_config_or_options(a_path, b_path,
options_set,
requestedVars = var_list)
do_pass_fail = runInfo[DO_TEST_PASSFAIL_KEY]
warn_on_missing = runInfo[OPTIONS_WARN_MISSING_KEY] if OPTIONS_WARN_MISSING_KEY in runInfo else False
# note some of this information for debugging purposes
......@@ -1273,7 +1274,7 @@ def stats_two_inputs_library_call(afn, bfn, var_list=None,
default_nonfinite_tolerance = defaultValues[NONFINITE_TOLERANCE_KEY] if NONFINITE_TOLERANCE_KEY in defaultValues else None
default_total_fail_tolerance = defaultValues[TOTAL_FAIL_TOLERANCE_KEY] if TOTAL_FAIL_TOLERANCE_KEY in defaultValues else None
default_min_r_squared_coeff = defaultValues[MIN_OK_R_SQUARED_COEFF_KEY] if MIN_OK_R_SQUARED_COEFF_KEY in defaultValues else None
do_pass_fail = options_set[DO_TEST_PASSFAIL_KEY]
do_pass_fail = options_set[DO_TEST_PASSFAIL_KEY] # TODO, once stats respects config files # do_pass_fail = runInfo[DO_TEST_PASSFAIL_KEY]
has_failed = False # for keeping track of if each variable comparison failed
warn_missing = options_set[OPTIONS_WARN_MISSING_KEY] if OPTIONS_WARN_MISSING_KEY in options_set else False
......
......@@ -21,14 +21,15 @@ LOG = logging.getLogger(__name__)
# these are the built in defaults for the settings
glance_setting_defaults = {
DO_MAKE_REPORT_KEY: True,
DO_MAKE_IMAGES_KEY: False,
DO_MAKE_FORKS_KEY: False,
DO_CLEAR_MEM_THREADED_KEY: False,
USE_SHARED_ORIG_RANGE_KEY: False,
USE_NO_LON_OR_LAT_VARS_KEY: False,
DETAIL_DPI_KEY: 150,
THUMBNAIL_DPI_KEY: 50
DO_MAKE_REPORT_KEY: True,
DO_MAKE_IMAGES_KEY: False,
DO_MAKE_FORKS_KEY: False,
DO_CLEAR_MEM_THREADED_KEY: False,
USE_SHARED_ORIG_RANGE_KEY: False,
USE_NO_LON_OR_LAT_VARS_KEY: False,
DETAIL_DPI_KEY: 150,
THUMBNAIL_DPI_KEY: 50,
DO_TEST_PASSFAIL_KEY: True,
}
# these are the built in longitude/latitude defaults
......@@ -393,6 +394,7 @@ _STOMPABLE_OPTIONS = {
OPTIONS_LONLAT_EPSILON_KEY: 0.0,
OPTIONS_IMAGES_ON_FAIL_KEY: False,
DO_MAKE_FORKS_KEY: False,
DO_TEST_PASSFAIL_KEY: True,
}
def _warn_for_stomped_commandline_options(optionSet) :
"""
......@@ -408,7 +410,7 @@ def _warn_for_stomped_commandline_options(optionSet) :
"This part of the command line input will be ignored.")
LOG.debug("User value for " + option_key + ": " + str(optionSet[option_key]))
# TODO, right now this is the top level function that the library functions in compare.py call
# note: right now this is the top level function that the library functions in compare.py call
def load_config_or_options(aPath, bPath, optionsSet, requestedVars = [ ]) :
"""
load information on how the user wants to run the command from a dictionary of options
......@@ -509,6 +511,7 @@ def load_config_or_options(aPath, bPath, optionsSet, requestedVars = [ ]) :
runInfo[DO_IMAGES_ONLY_ON_FAIL_KEY] = optionsSet[OPTIONS_IMAGES_ON_FAIL_KEY]
runInfo[DO_MAKE_FORKS_KEY] = optionsSet[DO_MAKE_FORKS_KEY]
runInfo[OPTIONS_WARN_MISSING_KEY] = optionsSet[OPTIONS_WARN_MISSING_KEY]
runInfo[DO_TEST_PASSFAIL_KEY] = optionsSet[DO_TEST_PASSFAIL_KEY]
# only record these if we are using lon/lat
runInfo[USE_NO_LON_OR_LAT_VARS_KEY] = optionsSet[USE_NO_LON_OR_LAT_VARS_KEY]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment