Skip to content

Commit

Permalink
Remove SEBA from everest
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Jan 10, 2025
1 parent 15387e6 commit d51dc1e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
15 changes: 1 addition & 14 deletions src/ert/run_models/everest_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from ropt.evaluator import EvaluatorContext, EvaluatorResult
from ropt.plan import BasicOptimizer
from ropt.plan import Event as OptimizerEvent
from seba_sqlite import SqliteStorage
from typing_extensions import TypedDict

from _ert.events import EESnapshot, EESnapshotUpdate, Event
Expand Down Expand Up @@ -185,23 +184,11 @@ def run_experiment(
/ "OPT_DEFAULT.out",
)

# The SqliteStorage object is used to store optimization results from
# Seba in an sqlite database. It reacts directly to events emitted by
# Seba and is not called by Everest directly. The stored results are
# accessed by Everest via separate SebaSnapshot objects.
# This mechanism is outdated and not supported by the ropt package. It
# is retained for now via the seba_sqlite package.
seba_storage = SqliteStorage( # type: ignore
optimizer, self._everest_config.optimization_output_dir
)

# Run the optimization:
optimizer_exit_code = optimizer.run().exit_code

# Extract the best result from the storage.
self._result = OptimalResult.from_seba_optimal_result(
seba_storage.get_optimal_result() # type: ignore
)
self._result = self.ever_storage.get_optimal_result()

if self._exit_code is None:
match optimizer_exit_code:
Expand Down
12 changes: 0 additions & 12 deletions src/everest/everest_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from ropt.enums import EventType
from ropt.plan import BasicOptimizer, Event
from ropt.results import FunctionResults, GradientResults, convert_to_maximize
from seba_sqlite import sqlite_storage

logger = logging.getLogger(__name__)

Expand All @@ -32,17 +31,6 @@ class OptimalResult:
controls: list[Any]
total_objective: float

@staticmethod
def from_seba_optimal_result(
o: sqlite_storage.OptimalResult | None = None,
) -> OptimalResult | None:
if o is None:
return None

return OptimalResult(
batch=o.batch + 1, controls=o.controls, total_objective=o.total_objective
)


def try_read_df(path: Path) -> polars.DataFrame | None:
return polars.read_parquet(path) if path.exists() else None
Expand Down

0 comments on commit d51dc1e

Please sign in to comment.