-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve validation error #320
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears the behavior of config.validate(validator)
has changed significantly.
@@ -13,7 +13,7 @@ www = "#expand user_www#zppy_test_complete_run_www" | |||
[climo] | |||
active = True | |||
walltime = "00:30:00" | |||
years = "1850:1854:2", "1850:1854:4", | |||
years = "1850:1854:2", "1850:1854:4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Launches the following:
climo_atm_monthly_180x360_aave_1850-1851
climo_atm_monthly_180x360_aave_1852-1853
climo_atm_monthly_180x360_aave_1850-1853
climo_atm_monthly_diurnal_8xdaily_180x360_aave_1850-1851
climo_atm_monthly_diurnal_8xdaily_180x360_aave_1852-1853
climo_atm_monthly_diurnal_8xdaily_180x360_aave_1850-1853
Both the "1850:1854:2"
(2-year increment) jobs and the "1850:1854:4"
(4-year increment) jobs are launched successfully. Does this mean the trailing comma is no longer a requirement of string_list
parameters?
@@ -25,9 +25,9 @@ years = "1850:1854:2", "1850:1854:4", | |||
vars = "PRECT" | |||
|
|||
[ts] | |||
active = True | |||
active = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Causes ValueError: Invalid value 4 for 'active'
at runtime rather than a failed configuration validation.
walltime = "00:30:00" | ||
years = "1850:1854:2", | ||
years = "1850:1854:2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If active = True
above, then the error we get here is ValueError: Error interpreting years 1
. climo
's multiple year sets above no longer appear to need a trailing comma. However, this error seems to indicate at least one comma must be present in a string_list
parameter.
@@ -167,8 +168,12 @@ def _validate_config(config): | |||
validator = Validator() | |||
|
|||
result = config.validate(validator) | |||
print(type(result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result
is a bool
now. In the past, it has historically been some sort of dictionary or dictionary-like object. For example, from a validation failure discussed in a 3/22 Slack message, we had:
Validation results={'e3sm_diags': True, 'e3sm_diags_vs_model': True, 'mpas_analysis': True, 'default': True, 'climo': {'qos': True, 'nodes': True, 'walltime': True, 'input_files': True, 'fre
quency': True, 'mapping_file': True, 'grid': True, 'years': False, 'exclude': True, 'vars': True, 'atm_monthly_180x360_aave': True}, 'ts': True, 'tc_analysis': True, 'amwg': True, 'global_ti
me_series': {'input_subdir': True, 'qos': True, 'nodes': True, 'walltime': True, 'color': True, 'years': True, 'ts_num_years': True, 'figstr': True, 'moc_file': True, 'experiment_name': True
, 'ts_years': False, 'climo_years': False, 'atmosphere_only': True}}
@golaz See above comments regarding new issues with the validator. I can't find too much about the |
8254cfa
to
32680ef
Compare
I turned my branch of this into Ideally, we would get the validator working again (#319), at which point we can improve its error message (#281/#320), so I'm leaving this pull request open, but removing it from the December 2022 project. |
Improve validation error. Resolves #281. Inadvertently discovered #319 in the process.