diff --git a/src/ert/config/queue_config.py b/src/ert/config/queue_config.py index ad593b50b1f..1a3a3c3b8ef 100644 --- a/src/ert/config/queue_config.py +++ b/src/ert/config/queue_config.py @@ -2,14 +2,13 @@ import re import shutil -import warnings -from collections import Counter, defaultdict +from collections import defaultdict from dataclasses import dataclass, field from typing import Any, Dict, List, Tuple, Union, no_type_check from ert import _clib -from .parsing import ConfigDict, ConfigValidationError, ConfigWarning, ErrorInfo +from .parsing import ConfigDict, ConfigValidationError, ErrorInfo from .queue_system import QueueSystem GENERIC_QUEUE_OPTIONS: List[str] = ["MAX_RUNNING"] @@ -101,14 +100,6 @@ def from_dict(cls, config_dict: ConfigDict) -> QueueConfig: ): _validate_torque_options(queue_options[QueueSystem.TORQUE]) - if ( - selected_queue_system != QueueSystem.LOCAL - and queue_options[selected_queue_system] - ): - _check_for_overwritten_queue_system_options( - queue_options[selected_queue_system] - ) - return QueueConfig(job_script, max_submit, selected_queue_system, queue_options) def create_local_copy(self) -> QueueConfig: @@ -120,26 +111,6 @@ def create_local_copy(self) -> QueueConfig: ) -def _check_for_overwritten_queue_system_options( - queue_system_options: List[Tuple[str, str]] -) -> None: - keywords_counter = Counter( - [ - option_string[0] - for option_string in queue_system_options - if option_string[0] != "MAX_RUNNING" - ] - ) - for keyword, keyword_count in keywords_counter.items(): - if keyword_count > 1: - warnings.warn( - ConfigWarning( - f"Overwriting {keyword} keyword, this may lead to an error." - ), - stacklevel=1, - ) - - def _validate_torque_options(torque_options: List[Tuple[str, str]]) -> None: for option_strings in torque_options: if isinstance(option_strings, tuple): diff --git a/tests/unit_tests/config/test_queue_config.py b/tests/unit_tests/config/test_queue_config.py index 81950ca8d76..6f328d8563e 100644 --- a/tests/unit_tests/config/test_queue_config.py +++ b/tests/unit_tests/config/test_queue_config.py @@ -7,13 +7,7 @@ import pytest from hypothesis import given -from ert.config import ( - ConfigValidationError, - ConfigWarning, - ErtConfig, - QueueConfig, - QueueSystem, -) +from ert.config import ConfigValidationError, ErtConfig, QueueConfig, QueueSystem from ert.job_queue import Driver @@ -133,30 +127,3 @@ def test_torque_queue_config_invalid_memory_pr_job(memory_with_unit_str): f.write(f"QUEUE_OPTION TORQUE MEMORY_PER_JOB {memory_with_unit_str}") with pytest.raises(ConfigValidationError): ErtConfig.from_file(filename) - - -@pytest.mark.usefixtures("use_tmpdir") -@pytest.mark.parametrize( - "queue_system, queue_system_option", - [("LSF", "LSF_SERVER"), ("SLURM", "SQUEUE"), ("TORQUE", "QUEUE")], -) -def test_overwriting_QUEUE_OPTIONS_warning( - tmp_path, monkeypatch, queue_system, queue_system_option -): - filename = "config.ert" - with open(filename, "w", encoding="utf-8") as f: - f.write("NUM_REALIZATIONS 1\n") - f.write(f"QUEUE_SYSTEM {queue_system}\n") - f.write(f"QUEUE_OPTION {queue_system} {queue_system_option} test_1\n") - test_site_config = tmp_path / "test_site_config.ert" - test_site_config.write_text( - "JOB_SCRIPT job_dispatch.py\n" - f"QUEUE_SYSTEM {queue_system}\n" - f"QUEUE_OPTION {queue_system} {queue_system_option} test_2\n" - ) - monkeypatch.setenv("ERT_SITE_CONFIG", str(test_site_config)) - with pytest.warns( - ConfigWarning, - match=rf"Overwriting {queue_system_option} keyword, this may lead to an error.", - ): - ErtConfig.from_file(filename)