Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Dec 17, 2024
1 parent f3e2112 commit ccf9d6d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ert/scheduler/openpbs_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion src/everest/queue_driver/queue_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
7 changes: 1 addition & 6 deletions tests/ert/unit_tests/config/test_queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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():
Expand Down
6 changes: 4 additions & 2 deletions tests/ert/unit_tests/scheduler/test_openpbs_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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),
]
Expand Down
2 changes: 0 additions & 2 deletions tests/everest/test_res_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down

0 comments on commit ccf9d6d

Please sign in to comment.