From 18c6d8690ba6b57392f2cd82534f84121c8cb719 Mon Sep 17 00:00:00 2001 From: larsevj Date: Tue, 26 Nov 2024 14:31:52 +0100 Subject: [PATCH 1/4] Use the same xdist group for heat equation tests --- tests/ert/ui_tests/cli/test_field_parameter.py | 2 ++ tests/ert/ui_tests/gui/test_plotting_of_snake_oil.py | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/ert/ui_tests/cli/test_field_parameter.py b/tests/ert/ui_tests/cli/test_field_parameter.py index 6c1c7cb193a..5aa92bdb6df 100644 --- a/tests/ert/ui_tests/cli/test_field_parameter.py +++ b/tests/ert/ui_tests/cli/test_field_parameter.py @@ -23,6 +23,7 @@ from .run_cli import run_cli +@pytest.mark.xdist_group(name="heat_equation_storage") def test_field_param_update_using_heat_equation(heat_equation_storage): config = ErtConfig.from_file("config.ert") with open_storage(config.ens_path, mode="w") as storage: @@ -223,6 +224,7 @@ def test_parameter_update_with_inactive_cells_xtgeo_grdecl(tmpdir): @pytest.mark.timeout(600) +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.filterwarnings("ignore:.*Cross-correlation.*:") @pytest.mark.filterwarnings("ignore:.*divide by zero.*:") def test_field_param_update_using_heat_equation_zero_var_params_and_adaptive_loc( diff --git a/tests/ert/ui_tests/gui/test_plotting_of_snake_oil.py b/tests/ert/ui_tests/gui/test_plotting_of_snake_oil.py index 617acceb206..2fadc1ae918 100644 --- a/tests/ert/ui_tests/gui/test_plotting_of_snake_oil.py +++ b/tests/ert/ui_tests/gui/test_plotting_of_snake_oil.py @@ -41,6 +41,7 @@ ("SNAKE_OIL_PARAM:OP1_OCTAVES", HISTOGRAM, "snake_oil"), ], ) +@pytest.mark.xdist_group(name="heat_equation_storage") def plot_figure(qtbot, heat_equation_storage, snake_oil_case_storage, request): key, plot_name, storage_type = request.param args_mock = Mock() From 0b34fd52272f3e5800df7e006be143578cd66acc Mon Sep 17 00:00:00 2001 From: larsevj Date: Wed, 27 Nov 2024 09:32:54 +0100 Subject: [PATCH 2/4] Increase timeout of heat equation test and show durations --- .github/workflows/test_ert.yml | 8 ++++---- tests/ert/ui_tests/cli/test_field_parameter.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_ert.yml b/.github/workflows/test_ert.yml index ca87acd8946..062b575c76a 100644 --- a/.github/workflows/test_ert.yml +++ b/.github/workflows/test_ert.yml @@ -40,7 +40,7 @@ jobs: - name: GUI Test if: inputs.test-type == 'gui-tests' run: | - pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --mpl --benchmark-disable tests/ert/ui_tests/gui + pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --mpl --benchmark-disable tests/ert/ui_tests/gui --durations=25 - name: Upload artifact images uses: actions/upload-artifact@v4 @@ -53,18 +53,18 @@ jobs: - name: CLI Test if: inputs.test-type == 'cli-tests' run: | - pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --maxprocesses=2 -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli + pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --maxprocesses=2 -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli --durations=25 - name: Unit Test if: inputs.test-type == 'unit-tests' run: | - pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --mpl --dist loadgroup tests/ert/unit_tests + pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --mpl --dist loadgroup tests/ert/unit_tests --durations=25 pytest --doctest-modules --cov=ert --cov-report=xml:cov2.xml src/ --ignore src/ert/dark_storage - name: Performance Test if: inputs.test-type == 'performance-tests' run: | - pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --dist loadgroup tests/ert/performance_tests + pytest --cov=ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --dist loadgroup tests/ert/performance_tests --durations=25 - name: Test for a clean repository run: | diff --git a/tests/ert/ui_tests/cli/test_field_parameter.py b/tests/ert/ui_tests/cli/test_field_parameter.py index 5aa92bdb6df..37f2a42a3c8 100644 --- a/tests/ert/ui_tests/cli/test_field_parameter.py +++ b/tests/ert/ui_tests/cli/test_field_parameter.py @@ -23,6 +23,7 @@ from .run_cli import run_cli +@pytest.mark.timeout(600) @pytest.mark.xdist_group(name="heat_equation_storage") def test_field_param_update_using_heat_equation(heat_equation_storage): config = ErtConfig.from_file("config.ert") From 659af57a4913311c4cf0dcdc8a62b4db7380ff17 Mon Sep 17 00:00:00 2001 From: larsevj Date: Fri, 22 Nov 2024 14:03:19 +0100 Subject: [PATCH 3/4] Set polars max threads to 1 in cli tests --- tests/ert/ui_tests/cli/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ert/ui_tests/cli/conftest.py b/tests/ert/ui_tests/cli/conftest.py index e04d2bd3764..e99b3121999 100644 --- a/tests/ert/ui_tests/cli/conftest.py +++ b/tests/ert/ui_tests/cli/conftest.py @@ -6,7 +6,9 @@ @pytest.fixture(autouse=True) def reduce_omp_num_threads_count(): old_omp_num_threads = os.environ.get("OMP_NUM_THREADS") + old_polars_max_thread = os.environ.get("POLARS_MAX_THREADS") os.environ["OMP_NUM_THREADS"] = "1" + os.environ["POLARS_MAX_THREADS"] = "1" yield @@ -14,3 +16,7 @@ def reduce_omp_num_threads_count(): del os.environ["OMP_NUM_THREADS"] else: os.environ["OMP_NUM_THREADS"] = old_omp_num_threads + if old_polars_max_thread is None: + del os.environ["POLARS_MAX_THREADS"] + else: + os.environ["POLARS_MAX_THREADS"] = old_polars_max_thread From caef26089367ed551532a917f618207d0b5e87bb Mon Sep 17 00:00:00 2001 From: larsevj Date: Wed, 27 Nov 2024 09:53:01 +0100 Subject: [PATCH 4/4] Try group all heavy tests toghether --- .../ert/ui_tests/cli/analysis/test_adaptive_localization.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/ert/ui_tests/cli/analysis/test_adaptive_localization.py b/tests/ert/ui_tests/cli/analysis/test_adaptive_localization.py index e61ebc23d4d..f3fcd369a5d 100644 --- a/tests/ert/ui_tests/cli/analysis/test_adaptive_localization.py +++ b/tests/ert/ui_tests/cli/analysis/test_adaptive_localization.py @@ -30,6 +30,7 @@ def run_cli_ES_with_case(poly_config): return prior_ensemble, posterior_ensemble +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.timeout(600) @pytest.mark.usefixtures("copy_poly_case") def test_that_adaptive_localization_with_cutoff_1_equals_ensemble_prior(): @@ -60,6 +61,7 @@ def test_that_adaptive_localization_with_cutoff_1_equals_ensemble_prior(): assert np.allclose(posterior_sample, prior_sample) +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.timeout(600) @pytest.mark.usefixtures("copy_poly_case") def test_that_adaptive_localization_works_with_a_single_observation(): @@ -97,6 +99,7 @@ def test_that_adaptive_localization_works_with_a_single_observation(): _, _ = run_cli_ES_with_case("poly_localization_0.ert") +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.timeout(600) @pytest.mark.usefixtures("copy_poly_case") def test_that_adaptive_localization_works_with_multiple_observations(snapshot): @@ -217,6 +220,7 @@ def _evaluate(coeffs, x): assert set(map(tuple, records_from_pl)) == expected_records +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.timeout(600) @pytest.mark.usefixtures("copy_poly_case") def test_that_adaptive_localization_with_cutoff_0_equals_ESupdate(): @@ -255,6 +259,7 @@ def test_that_adaptive_localization_with_cutoff_0_equals_ESupdate(): assert np.allclose(posterior_sample_loc0, posterior_sample_noloc, atol=1e-6) +@pytest.mark.xdist_group(name="heat_equation_storage") @pytest.mark.timeout(600) @pytest.mark.usefixtures("copy_poly_case") def test_that_posterior_generalized_variance_increases_in_cutoff():