Skip to content

Commit

Permalink
Log all settings for run-models
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Sep 18, 2024
1 parent ab512a6 commit 2fd710c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
18 changes: 18 additions & 0 deletions src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,24 @@ def __init__(
self.start_iteration = start_iteration
self.validate()

def log_at_startup(self) -> None:
keys_to_drop = [
"_end_queue",
"_queue_config",
"_status_queue",
"_storage",
"ert_config",
"rng",
"run_paths",
"substitution_list",
]
settings_dict = {
key: value
for key, value in self.__dict__.items()
if key not in keys_to_drop
}
logger.info(f"Running '{self.name()}' with settings {settings_dict}")

@classmethod
@abstractmethod
def name(cls) -> str: ...
Expand Down
2 changes: 1 addition & 1 deletion src/ert/run_models/ensemble_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run_experiment(
evaluator_server_config: EvaluatorServerConfig,
restart: bool = False,
) -> None:
logger.info(f"Running {self.name()}")
self.log_at_startup()
if not restart:
self.experiment = self._storage.create_experiment(
name=self.experiment_name,
Expand Down
2 changes: 1 addition & 1 deletion src/ert/run_models/ensemble_smoother.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
def run_experiment(
self, evaluator_server_config: EvaluatorServerConfig, restart: bool = False
) -> None:
logger.info(f"Running {self.name()}")
self.log_at_startup()
ensemble_format = self.target_ensemble_format
experiment = self._storage.create_experiment(
parameters=self.ert_config.ensemble_config.parameter_configuration,
Expand Down
2 changes: 1 addition & 1 deletion src/ert/run_models/evaluate_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
def run_experiment(
self, evaluator_server_config: EvaluatorServerConfig, restart: bool = False
) -> None:
logger.info(f"Running {self.name()}")
self.log_at_startup()
ensemble = self.ensemble
experiment = ensemble.experiment
self.set_env_key("_ERT_EXPERIMENT_ID", str(experiment.id))
Expand Down
6 changes: 1 addition & 5 deletions src/ert/run_models/iterated_ensemble_smoother.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ def analyzeStep(
def run_experiment(
self, evaluator_server_config: EvaluatorServerConfig, restart: bool = False
) -> None:
log_msg = (
f"Running {self.name} for {self._total_iterations} "
f'iteration{"s" if (self._total_iterations != 1) else ""}.'
)
logger.info(log_msg)
self.log_at_startup()

target_ensemble_format = self.target_ensemble_format
experiment = self._storage.create_experiment(
Expand Down
2 changes: 1 addition & 1 deletion src/ert/run_models/manual_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
def run_experiment(
self, evaluator_server_config: EvaluatorServerConfig, restart: bool = False
) -> None:
logger.info(f"Running {self.name()}")
self.log_at_startup()
self.set_env_key("_ERT_EXPERIMENT_ID", str(self.prior.experiment.id))
self.set_env_key("_ERT_ENSEMBLE_ID", str(self.prior.id))

Expand Down
3 changes: 1 addition & 2 deletions src/ert/run_models/multiple_data_assimilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def __init__(
def run_experiment(
self, evaluator_server_config: EvaluatorServerConfig, restart: bool = False
) -> None:
logger.info(f"Running {self.name()} with normalized weights {self.weights}")

self.log_at_startup()
if self.restart_run:
id = self.prior_ensemble_id
try:
Expand Down

0 comments on commit 2fd710c

Please sign in to comment.