Skip to content

Commit

Permalink
Add also the simulation jobs to the list of possible simulator instan…
Browse files Browse the repository at this point in the history
…ces.

Everest is adding SIMULATION_JOB key and not FORWARD_MODEL key for the steps in the forward model
  • Loading branch information
DanSava committed Dec 2, 2024
1 parent 08e98c5 commit 0d1430e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/ert/config/summary_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def from_config_dict(cls, config_dict: ConfigDict) -> Optional[SummaryConfig]:
"In order to use summary responses, ECLBASE has to be set."
)
time_map = set(refcase.dates) if refcase is not None else None
forward_model = config_dict.get(ConfigKeys.FORWARD_MODEL, [])
names = [fm_step[0] for fm_step in forward_model]
fm_steps = config_dict.get(ConfigKeys.FORWARD_MODEL, [])
sim_steps = config_dict.get(ConfigKeys.SIMULATION_JOB, [])
names = [fm_step[0] for fm_step in fm_steps + sim_steps]
simulation_step_exists = any(
any(sim in _name.lower() for sim in ["eclipse", "flow"])
for _name in names
Expand Down
20 changes: 15 additions & 5 deletions tests/ert/unit_tests/config/test_ert_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1820,10 +1820,22 @@ def test_warning_raised_when_summary_key_and_no_simulation_job_present():


@pytest.mark.parametrize(
"job_name", ["eclipse", "eclipse100", "flow", "FLOW", "ECLIPSE100"]
"job_name, key",
[
("eclipse", "FORWARD_MODEL"),
("eclipse100", "FORWARD_MODEL"),
("flow", "FORWARD_MODEL"),
("FLOW", "FORWARD_MODEL"),
("ECLIPSE100", "FORWARD_MODEL"),
("eclipse", "SIMULATION_JOB"),
("eclipse100", "SIMULATION_JOB"),
("flow", "SIMULATION_JOB"),
("FLOW", "SIMULATION_JOB"),
("ECLIPSE100", "SIMULATION_JOB"),
],
)
@pytest.mark.usefixtures("use_tmpdir")
def test_no_warning_when_summary_key_and_simulation_job_present(job_name):
def test_no_warning_when_summary_key_and_simulation_job_present(job_name, key):
with open("job_file", "w", encoding="utf-8") as fout:
fout.write("EXECUTABLE echo\nARGLIST <ECLBASE> <RUNPATH>\n")

Expand All @@ -1834,9 +1846,7 @@ def test_no_warning_when_summary_key_and_simulation_job_present(job_name):
fout.write("ECLBASE RESULT_SUMMARY\n")

fout.write(f"INSTALL_JOB {job_name} job_file\n")
fout.write(
f"FORWARD_MODEL {job_name}(<ECLBASE>=A/<ECLBASE>, <RUNPATH>=<RUNPATH>/x)\n"
)
fout.write(f"{key} {job_name} (<ECLBASE>=A/<ECLBASE>, <RUNPATH>=<RUNPATH>/x)\n")
# Check no warning is logged when config contains
# forward model step with <ECLBASE> and <RUNPATH> as arguments
with warnings.catch_warnings():
Expand Down

0 comments on commit 0d1430e

Please sign in to comment.