Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/ert/dark_storage/endpoints/experiment_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def _failed_realizations_messages(
snapshots[event.iteration] = event.snapshot
elif isinstance(event, SnapshotUpdateEvent) and event.snapshot:
snapshot = snapshots[event.iteration]
assert isinstance(snapshot, EnsembleSnapshot)
snapshot.merge_snapshot(event.snapshot)
logging.getLogger("forward_models").info("Status event")
messages = [
OPT_FAILURE_REALIZATIONS
if exit_code == EverestExitCode.TOO_FEW_REALIZATIONS
Expand All @@ -104,7 +102,7 @@ def _failed_realizations_messages(


def _get_optimization_status(
exit_code: EverestExitCode, events: list[StatusEvents]
exit_code: EverestExitCode | None, events: list[StatusEvents]
) -> tuple[ExperimentState, str]:
match exit_code:
case EverestExitCode.MAX_BATCH_NUM_REACHED:
Expand All @@ -128,8 +126,10 @@ def _get_optimization_status(
for msg in messages:
logging.getLogger(EXPERIMENT_SERVER).error(msg)
return status_, "\n".join(messages)
case _:
case EverestExitCode.COMPLETED:
return ExperimentState.completed, "Optimization completed."
case _:
raise ValueError(f"Invalid exit_code: {exit_code}")


def _check_authentication(auth_header: str | None) -> None:
Expand Down Expand Up @@ -201,21 +201,16 @@ async def start_experiment(
experiment_state = ExperimentRunnerState()
_experiments[experiment_id] = experiment_state
request_data = await request.json()
# The output of warnings is the task of the user interface, not
# of everserver. Therefore we suppress them here:
# Suppress already reported warnings when we re-validate with plugins
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=ConfigWarning)
config = EverestConfig.with_plugins(request_data)
runner = ExperimentRunner(config, experiment_id)
try:
background_tasks.add_task(runner.run)
experiment_state.config_path = config.config_path

experiment_state.run_path = config.simulation_dir
experiment_state.storage_path = config.output_dir

# Assume client and server is always in the same timezone
# so disregard timestamps
experiment_state.start_time_unix = int(time.time())
return JSONResponse({"experiment_id": experiment_id})
except Exception as e:
Expand Down Expand Up @@ -363,7 +358,6 @@ async def run(self) -> None:
await sub.is_done()
break
await simulation_future
assert run_model.exit_code is not None
exp_status, msg = _get_optimization_status(
run_model.exit_code,
run.events,
Expand Down
4 changes: 0 additions & 4 deletions src/everest/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
OPT_FAILURE_ALL_REALIZATIONS = "Optimization failed: all realizations failed."

SESSION_DIR = ".session"
SIMULATION = "simulation"
SIMULATOR_START = "start"
SIMULATOR_UPDATE = "update"
SIMULATOR_END = "end"
SIM_PROGRESS_ID = "simulation_progress"
STORAGE_DIR = "simulation_results"

Expand Down
Loading