Skip to content

Commit

Permalink
Update the error message in Queue config validator
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Nov 1, 2023
1 parent 2e06653 commit 658b66e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/ert/config/queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def generate_dict(option_list: List[Tuple[str, str]]) -> Dict[str, List[str]]:
"QDEL_CMD",
"QSTAT_OPTIONS",
"QUEUE",
"DEBUG_OUTPUT",
"CLUSTER_LABEL",
"JOB_PREFIX",
],
Expand Down Expand Up @@ -187,7 +186,7 @@ def generate_dict(option_list: List[Tuple[str, str]]) -> Dict[str, List[str]]:
}

queue_bool_options: Mapping[str, List[str]] = {
"LSF": ["DEBUG_OUTPUT"],
"LSF": [],
"SLURM": [],
"TORQUE": ["KEEP_QSUB_OUTPUT"],
"LOCAL": [],
Expand All @@ -208,32 +207,28 @@ def _validate_queue_driver_settings(
):
raise ConfigValidationError.with_context(
f"'{option_value}' for {option_name} is not a valid format "
f"for {queue_type} QUEUE. It must be of "
"the format '<integer>mb' or '<integer>gb'.",
"It should be of the format '<integer>mb' or '<integer>gb'.",
option_value,
)
if option_name in queue_string_options[queue_type] and not isinstance(
option_value, str
):
raise ConfigValidationError.with_context(
f"'{option_value}' for {option_name} is not a valid string type "
f"for the {queue_type} QUEUE.",
f"'{option_value}' for {option_name} is not a valid string type.",
option_value,
)
if option_name in queue_positive_number_options[queue_type] and (
re.match(r"^\d+(\.\d+)?$", option_value) is None
):
raise ConfigValidationError.with_context(
f"'{option_value}' for {option_name} is not a valid integer or float"
f" for the {queue_type} QUEUE.",
f"'{option_value}' for {option_name} is not a valid integer or float.",
option_value,
)
if option_name in queue_positive_int_options[queue_type] and (
re.match(r"^\d+$", option_value) is None
):
raise ConfigValidationError.with_context(
f"'{option_value}' for {option_name} is not a valid positive integer"
f" for the {queue_type} QUEUE.",
f"'{option_value}' for {option_name} is not a valid positive integer.",
option_value,
)
if option_name in queue_bool_options[queue_type] and not option_value in [
Expand All @@ -245,7 +240,6 @@ def _validate_queue_driver_settings(
"F",
]:
raise ConfigValidationError.with_context(
f"The '{option_value}' for {option_name} must be one of TRUE, FALSE, T, F, 1, 0 "
f" for the {queue_type}.",
f"The '{option_value}' for {option_name} should be either TRUE or FALSE.",
option_value,
)

0 comments on commit 658b66e

Please sign in to comment.