Skip to content

Commit

Permalink
Remove custom event_log logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreso committed Aug 16, 2024
1 parent 22099d2 commit 6d8c9e4
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
RunModelUpdateEndEvent,
)

event_logger = logging.getLogger("ert.event_log")
logger = logging.getLogger(__name__)

if TYPE_CHECKING:
from ert.config import QueueConfig
Expand Down Expand Up @@ -437,9 +437,9 @@ async def run_monitor(
self, ee_config: EvaluatorServerConfig, iteration: int
) -> bool:
try:
event_logger.debug("connecting to new monitor...")
logger.debug("connecting to new monitor...")
async with Monitor(ee_config.get_connection_info()) as monitor:
event_logger.debug("connected")
logger.debug("connected")
async for event in monitor.track(heartbeat_interval=0.1):
if event is not None and event["type"] in (
EVTYPE_EE_SNAPSHOT,
Expand All @@ -450,29 +450,29 @@ async def run_monitor(
ENSEMBLE_STATE_STOPPED,
ENSEMBLE_STATE_FAILED,
]:
event_logger.debug(
logger.debug(
"observed evaluation stopped event, signal done"
)
await monitor.signal_done()

if event.data.get(STATUS) == ENSEMBLE_STATE_CANCELLED:
event_logger.debug(
logger.debug(
"observed evaluation cancelled event, exit drainer"
)
# Allow track() to emit an EndEvent.
return False
elif event is not None and event["type"] == EVTYPE_EE_TERMINATED:
event_logger.debug("got terminator event")
logger.debug("got terminator event")

if not self._end_queue.empty():
event_logger.debug("Run model canceled - during evaluation")
logger.debug("Run model canceled - during evaluation")
self._end_queue.get()
await monitor.signal_cancel()
event_logger.debug(
logger.debug(
"Run model canceled - during evaluation - cancel sent"
)
except BaseException:
event_logger.exception("unexpected error: ")
logger.exception("unexpected error: ")
# We really don't know what happened... shut down
# the thread and get out of here. The monitor has
# been stopped by the ctx-mgr
Expand All @@ -487,7 +487,7 @@ async def run_ensemble_evaluator_async(
ee_config: EvaluatorServerConfig,
) -> List[int]:
if not self._end_queue.empty():
event_logger.debug("Run model canceled - pre evaluation")
logger.debug("Run model canceled - pre evaluation")
self._end_queue.get()
return []
ee_ensemble = self._build_ensemble(run_args, ensemble.experiment_id)
Expand All @@ -501,14 +501,14 @@ async def run_ensemble_evaluator_async(
if not (await self.run_monitor(ee_config, ensemble.iteration)):
return []

event_logger.debug(
logger.debug(
"observed that model was finished, waiting tasks completion..."
)
# The model has finished, we indicate this by sending a DONE
event_logger.debug("tasks complete")
logger.debug("tasks complete")

if not self._end_queue.empty():
event_logger.debug("Run model canceled - post evaluation")
logger.debug("Run model canceled - post evaluation")
self._end_queue.get()
return []
await evaluator_task
Expand Down Expand Up @@ -630,19 +630,19 @@ def _evaluate_and_postprocess(

num_successful_realizations = len(successful_realizations)
self.validate()
event_logger.info(
logger.info(
f"Experiment ran on QUEUESYSTEM: {self._queue_config.queue_system}"
)
event_logger.info(
logger.info(
f"Experiment ran with number of realizations: {self.ensemble_size}"
)
event_logger.info(
logger.info(
f"Experiment run ended with number of realizations succeeding: {num_successful_realizations}"
)
event_logger.info(
logger.info(
f"Experiment run ended with number of realizations failing: {self.ensemble_size - num_successful_realizations}"
)
event_logger.info(f"Experiment run finished in: {self.get_runtime()}s")
logger.info(f"Experiment run finished in: {self.get_runtime()}s")
self.run_workflows(HookRuntime.POST_SIMULATION, self._storage, ensemble)

return num_successful_realizations
Expand Down

0 comments on commit 6d8c9e4

Please sign in to comment.