Skip to content

Commit

Permalink
fixup! Use queue options directly from ert
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Dec 12, 2024
1 parent c7bb191 commit bc1e0d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/everest/config/server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ServerConfig(BaseModel): # type: ignore
def default_local_queue(cls, v):
if v is None:
return v
elif "activate_script" not in v:
elif "activate_script" not in v and ErtPluginManager().activate_script():
v["activate_script"] = ErtPluginManager().activate_script()
return v

Expand Down
2 changes: 1 addition & 1 deletion src/everest/config/simulator_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ class SimulatorConfig(BaseModel, extra="forbid"): # type: ignore
def default_local_queue(cls, v):
if v is None:
return LocalQueueOptions(max_running=8)
elif "activate_script" not in v:
elif "activate_script" not in v and ErtPluginManager().activate_script():
v["activate_script"] = ErtPluginManager().activate_script()
return v
25 changes: 13 additions & 12 deletions tests/everest/test_detached.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,16 @@ def test_detached_mode_config_base(copy_math_func_test_data_to_tmp):


@pytest.mark.parametrize(
"queue_system, cores, name",
"queue_system, cores",
[
("lsf", 2, None),
("slurm", 4, None),
("lsf", 3, "test_lsf"),
("slurm", 5, "test_slurm"),
("lsf", 2),
("slurm", 4),
("lsf", 3),
("slurm", 5),
],
)
def test_everserver_queue_config_equal_to_run_config(queue_system, cores, name):
def test_everserver_queue_config_equal_to_run_config(queue_system, cores):
simulator_config = {CK.QUEUE_SYSTEM: {"name": queue_system, "max_running": cores}}
if name is not None:
simulator_config[CK.QUEUE_SYSTEM].update({"queue_name": name})
everest_config = EverestConfig.with_defaults(**{"simulator": simulator_config})
everest_config.server.queue_system = SimulatorConfig(**simulator_config)

Expand Down Expand Up @@ -256,12 +254,15 @@ def test_generate_queue_options_no_config():
"queue_options, expected_result",
[
(
{"queue_name": "ever_opt_1", "name": "slurm"},
SlurmQueueOptions(max_running=1, queue_name="ever_opt_1"),
{"partition": "ever_opt_1", "name": "slurm"},
SlurmQueueOptions(max_running=1, partition="ever_opt_1"),
),
(
{"queue_name": "ever_opt_1", "name": "lsf"},
LsfQueueOptions(max_running=1, queue_name="ever_opt_1"),
{"lsf_queue": "ever_opt_1", "name": "lsf"},
LsfQueueOptions(
max_running=1,
lsf_queue="ever_opt_1",
),
),
],
)
Expand Down

0 comments on commit bc1e0d6

Please sign in to comment.