diff --git a/.github/workflows/test_ert.yml b/.github/workflows/test_ert.yml index e9685cc8f5d..f8c79a963e9 100644 --- a/.github/workflows/test_ert.yml +++ b/.github/workflows/test_ert.yml @@ -54,7 +54,16 @@ jobs: - name: CLI Test if: inputs.test-type == 'cli-tests' run: | - pytest --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli --durations=25 + echo {{github.workspace}} + pytest -x --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli --durations=25 + + - name: Upload checkme folder if exists + if: ${{ !cancelled() }} + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: folder-artifact + path: '/tmp/pytest-of-runner/**/checkme' - name: Unit Test if: inputs.test-type == 'unit-tests' diff --git a/src/ert/analysis/_es_update.py b/src/ert/analysis/_es_update.py index 44a10ea63e8..205116ebab1 100644 --- a/src/ert/analysis/_es_update.py +++ b/src/ert/analysis/_es_update.py @@ -3,6 +3,7 @@ import functools import logging import time +import traceback from collections.abc import Callable, Iterable, Sequence from fnmatch import fnmatch from typing import ( @@ -876,6 +877,8 @@ def iterative_smoother_update( initial_mask=initial_mask, ) except Exception as e: + print("Exception!") + traceback.print_tb(e.__traceback__) progress_callback( AnalysisErrorEvent( error_msg=str(e), diff --git a/src/ert/run_models/base_run_model.py b/src/ert/run_models/base_run_model.py index d8c795e10ac..79a2c92d76c 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 @@ -233,6 +234,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 9284349b97f..7259e971733 100644 --- a/tests/ert/ui_tests/cli/test_cli.py +++ b/tests/ert/ui_tests/cli/test_cli.py @@ -521,9 +521,11 @@ def test_that_stop_on_fail_workflow_jobs_stop_ert( @pytest.mark.usefixtures("copy_poly_case") -def test_that_pre_post_experiment_hook_works(monkeypatch, capsys): - monkeypatch.setattr(_ert.threading, "_can_raise", False) - +@pytest.mark.parametrize( + "mode", + [ITERATIVE_ENSEMBLE_SMOOTHER_MODE, ES_MDA_MODE, ENSEMBLE_SMOOTHER_MODE], +) +def test_that_pre_post_experiment_hook_works(capsys, mode): # The executable with open("hello_post_exp.sh", "w", encoding="utf-8") as f: f.write( @@ -542,7 +544,7 @@ def test_that_pre_post_experiment_hook_works(monkeypatch, capsys): # The workflow with open("SAY_HELLO_POST_EXP.wf", "w", encoding="utf-8") as s: - s.write("""dump_final_ensemble_id""") + s.write("""alias_for_hello_post_exp_wfjob""") # The executable with open("hello_pre_exp.sh", "w", encoding="utf-8") as f: @@ -562,7 +564,7 @@ def test_that_pre_post_experiment_hook_works(monkeypatch, capsys): # The workflow with open("SAY_HELLO_PRE_EXP.wf", "w", encoding="utf-8") as s: - s.write("""dump_first_ensemble_id""") + s.write("""alias_for_hello_pre_exp_wfjob""") with open("poly.ert", mode="a", encoding="utf-8") as fh: fh.write( @@ -570,23 +572,22 @@ def test_that_pre_post_experiment_hook_works(monkeypatch, capsys): """ NUM_REALIZATIONS 2 - LOAD_WORKFLOW_JOB SAY_HELLO_POST_EXP dump_final_ensemble_id + LOAD_WORKFLOW_JOB SAY_HELLO_POST_EXP alias_for_hello_post_exp_wfjob LOAD_WORKFLOW SAY_HELLO_POST_EXP.wf POST_EXPERIMENT_DUMP HOOK_WORKFLOW POST_EXPERIMENT_DUMP POST_EXPERIMENT - LOAD_WORKFLOW_JOB SAY_HELLO_PRE_EXP dump_first_ensemble_id + LOAD_WORKFLOW_JOB SAY_HELLO_PRE_EXP alias_for_hello_pre_exp_wfjob LOAD_WORKFLOW SAY_HELLO_PRE_EXP.wf PRE_EXPERIMENT_DUMP HOOK_WORKFLOW PRE_EXPERIMENT_DUMP PRE_EXPERIMENT """ ) ) - for mode in [ITERATIVE_ENSEMBLE_SMOOTHER_MODE, ES_MDA_MODE, ENSEMBLE_SMOOTHER_MODE]: - run_cli(mode, "--disable-monitor", "poly.ert") + run_cli(mode, "--disable-monitoring", "poly.ert") - captured = capsys.readouterr() - assert "first" in captured.out - assert "just sending regards" in captured.out + captured = capsys.readouterr() + assert "first" in captured.out + assert "just sending regards" in captured.out @pytest.fixture(name="mock_cli_run")