From ccf9d6d088aca5190210aa9600999fe9a23ede2e Mon Sep 17 00:00:00 2001 From: Jonathan Karlsen Date: Wed, 11 Dec 2024 09:33:22 +0100 Subject: [PATCH] fix more tests --- src/ert/scheduler/openpbs_driver.py | 2 +- src/everest/queue_driver/queue_driver.py | 1 - tests/ert/unit_tests/config/test_queue_config.py | 7 +------ tests/ert/unit_tests/scheduler/test_openpbs_driver.py | 6 ++++-- tests/everest/test_res_initialization.py | 2 -- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ert/scheduler/openpbs_driver.py b/src/ert/scheduler/openpbs_driver.py index 9c021f9a827..8a6d5ae14e4 100644 --- a/src/ert/scheduler/openpbs_driver.py +++ b/src/ert/scheduler/openpbs_driver.py @@ -160,7 +160,7 @@ def _build_resource_string( cpu_resources: list[str] = [] if num_cpu > 1: cpu_resources += [f"ncpus={num_cpu}"] - elif realization_memory > 0: + if realization_memory > 0: cpu_resources += [f"mem={realization_memory // 1024**2 }mb"] if cpu_resources: resource_specifiers.append(":".join(cpu_resources)) diff --git a/src/everest/queue_driver/queue_driver.py b/src/everest/queue_driver/queue_driver.py index cb346e1e326..d33f7601b7d 100644 --- a/src/everest/queue_driver/queue_driver.py +++ b/src/everest/queue_driver/queue_driver.py @@ -32,7 +32,6 @@ (ConfigKeys.TORQUE_QDEL_CMD, "QDEL_CMD"), (ConfigKeys.TORQUE_QUEUE_NAME, "QUEUE"), (ConfigKeys.TORQUE_CLUSTER_LABEL, "CLUSTER_LABEL"), - (ConfigKeys.CORES_PER_NODE, "NUM_CPU"), (ConfigKeys.TORQUE_KEEP_QSUB_OUTPUT, "KEEP_QSUB_OUTPUT"), (ConfigKeys.TORQUE_SUBMIT_SLEEP, "SUBMIT_SLEEP"), (ConfigKeys.TORQUE_PROJECT_CODE, "PROJECT_CODE"), diff --git a/tests/ert/unit_tests/config/test_queue_config.py b/tests/ert/unit_tests/config/test_queue_config.py index 540bed24342..41b434fb92e 100644 --- a/tests/ert/unit_tests/config/test_queue_config.py +++ b/tests/ert/unit_tests/config/test_queue_config.py @@ -206,7 +206,6 @@ def test_initializing_empty_config_queue_options_resets_to_default_value( "queue_system, queue_option, queue_value, err_msg", [ ("SLURM", "SQUEUE_TIMEOUT", "5a", "should be a valid number"), - ("TORQUE", "NUM_CPU", "3.5", "should be a valid integer"), ], ) def test_wrong_config_option_types(queue_system, queue_option, queue_value, err_msg): @@ -217,11 +216,7 @@ def test_wrong_config_option_types(queue_system, queue_option, queue_value, err_ ) with pytest.raises(ConfigValidationError, match=err_msg): - if queue_system == "TORQUE": - with pytest.warns(ConfigWarning, match="deprecated"): - ErtConfig.from_file_contents(file_contents) - else: - ErtConfig.from_file_contents(file_contents) + ErtConfig.from_file_contents(file_contents) def test_that_configuring_another_queue_system_gives_warning(): diff --git a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py index a14e7975c11..feeaacaba7d 100644 --- a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py +++ b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py @@ -273,7 +273,9 @@ async def test_full_resource_string(realization_memory, num_cpu, cluster_label): resources = parse_resource_string( Path("captured_qsub_args").read_text(encoding="utf-8") ) - assert resources.get("mem", "") == realization_memory + assert resources.get("mem", "") == ( + f"{realization_memory // 1024**2 }mb" if realization_memory > 0 else "" + ) assert resources.get("select", "1") == "1" assert resources.get("ncpus", "1") == str(num_cpu) @@ -284,7 +286,7 @@ async def test_full_resource_string(realization_memory, num_cpu, cluster_label): assert len(resources) == sum( [ - bool(realization_memory), + realization_memory > 0, num_cpu > 1, bool(cluster_label), ] diff --git a/tests/everest/test_res_initialization.py b/tests/everest/test_res_initialization.py index bc5c0f8dbee..99664a255da 100644 --- a/tests/everest/test_res_initialization.py +++ b/tests/everest/test_res_initialization.py @@ -43,8 +43,6 @@ "qsub_cmd": "qsub", "qstat_cmd": "qstat", "qdel_cmd": "qdel", - "num_cpus_per_node": 3, - "num_nodes": 1, "keep_qsub_output": True, "queue_name": "permanent_8", },