Skip to content

Commit

Permalink
Ruff on queue_config
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Oct 24, 2023
1 parent 92466d1 commit b0376a6
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions src/ert/config/queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,28 +203,33 @@ def _validate_lsf_options(lsf_options: List[Tuple[str, str]]) -> None:
for option_strings in lsf_options:
option_name = option_strings[0]
option_value = option_strings[1]
if option_name in string_lsf_options:
if not isinstance(option_value, str):
raise ConfigValidationError(
f"The value '{option_value}' is not valid string for the LSF option "
"{option_name}, it must be of string type."
)

if option_name in ["SUBMIT_SLEEP", "SQUEUE_TIMEOUT"]:
if re.match("\d+(\.\d+)", option_value) is None:
raise ConfigValidationError(
f"The value '{option_value}' is not valid integer or float"
" for the LSF option {option_name}."
)
if option_name in positive_int_lsf_options:
if re.match("\d+", option_value) is None:
if option_name in string_lsf_options and not isinstance(option_value, str):
raise ConfigValidationError(
f"The value '{option_value}' is not valid positive integer "
" for the LSF option {option_name}."
f"The value '{option_value}' is not valid string for the LSF option "
"{option_name}, it must be of string type."
)
if option_name in ["KEEP_QSUB_OUTPUT", "DEBUG_OUTPUT"]:
if not option_value in ["TRUE", "FALSE"]:

if (
option_name in ["SUBMIT_SLEEP", "SQUEUE_TIMEOUT"]
and re.match(r"\d+(\.\d+)", option_value) is None
):
raise ConfigValidationError(
f"The value '{option_value}' must be either TRUE or FALSE "
f"The value '{option_value}' is not valid integer or float"
" for the LSF option {option_name}."
)
if (
option_name in positive_int_lsf_options
and re.match(r"\d+", option_value) is None
):
raise ConfigValidationError(
f"The value '{option_value}' is not valid positive integer "
" for the LSF option {option_name}."
)
if option_name in ["KEEP_QSUB_OUTPUT", "DEBUG_OUTPUT"] and not option_value in [
"TRUE",
"FALSE",
]:
raise ConfigValidationError(
f"The value '{option_value}' must be either TRUE or FALSE "
" for the LSF option {option_name}."
)

0 comments on commit b0376a6

Please sign in to comment.