From 73cc4da4d59315b409e562a564a28ffbd78f6e3d Mon Sep 17 00:00:00 2001 From: "Yngve S. Kristiansen" Date: Wed, 8 Jan 2025 11:50:24 +0100 Subject: [PATCH] Debugging --- src/ert/run_models/base_run_model.py | 5 +++++ tests/ert/ui_tests/cli/test_cli.py | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ert/run_models/base_run_model.py b/src/ert/run_models/base_run_model.py index 22036bc18bc..894c35e2e6c 100644 --- a/src/ert/run_models/base_run_model.py +++ b/src/ert/run_models/base_run_model.py @@ -7,6 +7,7 @@ import os import shutil import time +import traceback import uuid from abc import ABC, abstractmethod from collections import defaultdict @@ -212,6 +213,10 @@ def group(cls) -> str | None: return None def send_event(self, event: StatusEvents) -> None: + if hasattr(event, "error_msg"): + traceback.print_stack() + print(event.error_msg) + self._status_queue.put(event) def send_smoother_event( diff --git a/tests/ert/ui_tests/cli/test_cli.py b/tests/ert/ui_tests/cli/test_cli.py index e9bbe8351df..d87845acaba 100644 --- a/tests/ert/ui_tests/cli/test_cli.py +++ b/tests/ert/ui_tests/cli/test_cli.py @@ -5,6 +5,7 @@ import os import stat import threading +import traceback from datetime import datetime from pathlib import Path from textwrap import dedent @@ -615,7 +616,13 @@ def test_that_pre_post_experiment_hook_works(capsys): ) for mode in [ITERATIVE_ENSEMBLE_SMOOTHER_MODE, ES_MDA_MODE, ENSEMBLE_SMOOTHER_MODE]: - run_cli(mode, "--disable-monitor", "poly.ert") + try: + run_cli(mode, "--disable-monitor", "poly.ert") + except Exception as e: + print(f"{mode}") + print(traceback.format_exc()) + print("\n".join(traceback.format_tb(e.__traceback__))) + print(str(e.__traceback__)) captured = capsys.readouterr() assert "first" in captured.out