Skip to content

Commit

Permalink
Stop setting minimum_required_realizations in everest_run_model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSava committed Nov 29, 2024
1 parent 3108748 commit e663924
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
12 changes: 3 additions & 9 deletions src/ert/run_models/everest_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from numpy import float64
from numpy._typing import NDArray
from ropt.enums import EventType, OptimizerExitCode
from ropt.evaluator import Evaluator, EvaluatorContext, EvaluatorResult
from ropt.evaluator import EvaluatorContext, EvaluatorResult
from ropt.plan import BasicOptimizer
from ropt.plan import Event as OptimizerEvent
from seba_sqlite import SqliteStorage
Expand Down Expand Up @@ -390,7 +390,7 @@ def _create_optimizer(self) -> BasicOptimizer:
# maximization results, necessitating a conversion step.
optimizer = (
BasicOptimizer(
enopt_config=self.ropt_config, evaluator=self.run_forward_model
enopt_config=self.ropt_config, evaluator=self._forward_model_evaluator
)
.add_table(
columns=RESULT_COLUMNS,
Expand Down Expand Up @@ -582,7 +582,7 @@ def _check_suffix(
control_name, sim_id, ExtParamConfig.to_dataset(control)
)

def run_forward_model(
def _forward_model_evaluator(
self, control_values: NDArray[np.float64], metadata: EvaluatorContext
) -> EvaluatorResult:
def _slug(entity: str) -> str:
Expand Down Expand Up @@ -617,12 +617,6 @@ def _slug(entity: str) -> str:
if self.active_realizations[sim_id]:
substitutions[f"<GEO_ID_{sim_id}_0>"] = str(geo_id)

# TODO: This causes problems with `test_remove_run_path`` Setting it to
# zero fixes that, but breaks `test_state_modifier_workflow_run`. There
# seems to be a disagreement on how everest and ert handle/define failed
# realizations.
self.minimum_required_realizations = len(self.active_realizations)

run_paths = Runpaths(
jobname_format=self.ert_config.model_config.jobname_format_string,
runpath_format=self.ert_config.model_config.runpath_format_string,
Expand Down
4 changes: 2 additions & 2 deletions tests/everest/test_simulator_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def new_call(*args):
)

# Modify the forward model function to track number of calls:
original_call = run_model.run_forward_model
run_model.run_forward_model = new_call
original_call = run_model._forward_model_evaluator
run_model._forward_model_evaluator = new_call

# First run populates the cache:
run_model.run_experiment(evaluator_server_config)
Expand Down
3 changes: 1 addition & 2 deletions tests/everest/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def test_state_modifier_workflow_run(
EverestConfig.load_file(f"everest/model/{config}.yml")
)
evaluator_server_config = evaluator_server_config_generator(run_model)
with pytest.raises(ValueError):
run_model.run_experiment(evaluator_server_config)
run_model.run_experiment(evaluator_server_config)

for path in Path.cwd().glob("**/simulation_0/RESULT.SCH"):
assert path.read_bytes() == (cwd / "eclipse/model/EXPECTED.SCH").read_bytes()

0 comments on commit e663924

Please sign in to comment.