From cdcab545518980e3fcb321246d03c6c680408143 Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 11:48:27 +0100 Subject: [PATCH 1/6] update init, changelog and rename parameter --- CHANGELOG.md | 6 ++++++ eogrow/__init__.py | 2 +- eogrow/core/pipeline.py | 2 +- eogrow/core/schemas.py | 4 ++-- tests/core/test_pipeline.py | 8 ++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b67c3628..8ed7e750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [Version 1.7.4] - 2024-01-10 + +- Parameter `raise_if_failed` renamed to `raise_on_failure` and is now enabled by default. +- Numpy version restricted in anticipation of numpy 2.0 release. + + ## [Version 1.7.4] - 2024-01-03 - Pipelines now have an additional parameter `raise_if_failed` to raise an error if the pipeline failed. diff --git a/eogrow/__init__.py b/eogrow/__init__.py index 24ce8874..8030e953 100644 --- a/eogrow/__init__.py +++ b/eogrow/__init__.py @@ -1,3 +1,3 @@ """The main module of the eo-grow package.""" -__version__ = "1.7.4" +__version__ = "1.7.5" diff --git a/eogrow/core/pipeline.py b/eogrow/core/pipeline.py index 92a64178..78db70f6 100644 --- a/eogrow/core/pipeline.py +++ b/eogrow/core/pipeline.py @@ -253,7 +253,7 @@ def run(self) -> None: pipeline_execution_name=self.current_execution_name, finished=finished, failed=failed ) - if failed and self.config.raise_if_failed: + if failed and self.config.raise_on_failure: raise PipelineExecutionError(f"Pipeline failed some executions. Check {log_folder}.") finally: self.logging_manager.stop_logging(root_logger, handlers) diff --git a/eogrow/core/schemas.py b/eogrow/core/schemas.py index f981160f..6bd10c53 100644 --- a/eogrow/core/schemas.py +++ b/eogrow/core/schemas.py @@ -69,8 +69,8 @@ class PipelineSchema(BaseSchema): raise_on_temporal_mismatch: bool = Field( False, description="Treat `TemporalDimensionWarning` as an exception during EOExecution." ) - raise_if_failed: bool = Field( - False, description="Raise an exception if `run_procedure` returns some executions in `failed`." + raise_on_failure: bool = Field( + True, description="Raise an exception if `run_procedure` returns some executions in `failed`." ) debug: bool = Field(False, description="Run pipeline without the `ray` wrapper to enable debugging.") diff --git a/tests/core/test_pipeline.py b/tests/core/test_pipeline.py index e5ba2224..bdbdf641 100644 --- a/tests/core/test_pipeline.py +++ b/tests/core/test_pipeline.py @@ -99,13 +99,13 @@ def test_get_patch_list_filtration_error(test_subset: List[Union[int, str]], sim @pytest.mark.parametrize("fail", [True, False]) -@pytest.mark.parametrize("raise_if_failed", [True, False]) -def test_pipeline_raises_on_failure(fail: bool, raise_if_failed: bool, simple_config_filename: str): +@pytest.mark.parametrize("raise_on_failure", [True, False]) +def test_pipeline_raises_on_failure(fail: bool, raise_on_failure: bool, simple_config_filename: str): config = interpret_config_from_path(simple_config_filename) config.pop("test_param") - pipeline = FailingPipeline.from_raw_config({"fail": fail, "raise_if_failed": raise_if_failed, **config}) + pipeline = FailingPipeline.from_raw_config({"fail": fail, "raise_on_failure": raise_on_failure, **config}) - if fail and raise_if_failed: + if fail and raise_on_failure: with pytest.raises(PipelineExecutionError): pipeline.run() else: From c7a80fed70424c19e9e958bfba6193ea5a8402b3 Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 11:56:19 +0100 Subject: [PATCH 2/6] fix pipeline test --- tests/core/test_pipeline.py | 2 +- tests/test_config_files/other/simple_config.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/core/test_pipeline.py b/tests/core/test_pipeline.py index bdbdf641..13b7df0d 100644 --- a/tests/core/test_pipeline.py +++ b/tests/core/test_pipeline.py @@ -103,7 +103,7 @@ def test_get_patch_list_filtration_error(test_subset: List[Union[int, str]], sim def test_pipeline_raises_on_failure(fail: bool, raise_on_failure: bool, simple_config_filename: str): config = interpret_config_from_path(simple_config_filename) config.pop("test_param") - pipeline = FailingPipeline.from_raw_config({"fail": fail, "raise_on_failure": raise_on_failure, **config}) + pipeline = FailingPipeline.from_raw_config({**config, "fail": fail, "raise_on_failure": raise_on_failure}) if fail and raise_on_failure: with pytest.raises(PipelineExecutionError): diff --git a/tests/test_config_files/other/simple_config.json b/tests/test_config_files/other/simple_config.json index 1542b38f..4ba7bd02 100644 --- a/tests/test_config_files/other/simple_config.json +++ b/tests/test_config_files/other/simple_config.json @@ -8,5 +8,6 @@ "save_logs": true, "show_logs": true, "capture_warnings": true - } + }, + "raise_on_failure": false } From 90f4404baedf4541089a00532f53ec468713f568 Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 12:01:54 +0100 Subject: [PATCH 3/6] fix cli and batch test --- tests/core/area/test_batch.py | 4 +++- tests/test_cli.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/core/area/test_batch.py b/tests/core/area/test_batch.py index b5f63727..3f8b7bca 100644 --- a/tests/core/area/test_batch.py +++ b/tests/core/area/test_batch.py @@ -24,7 +24,9 @@ @pytest.fixture(name="configured_requests_mock") def request_mock_setup(requests_mock): - requests_mock.post(url="/oauth/token", real_http=True) + requests_mock.post( + url="https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token", real_http=True + ) batch_bounds = { "geometry": { diff --git a/tests/test_cli.py b/tests/test_cli.py index 0bd9da09..7ce67f32 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -26,7 +26,7 @@ def test_pipeline_chain_validation(config_folder): assert subprocess.call(f"eogrow-validate {config_folder}/chain_pipeline.json", shell=True) == 0 -@pytest.mark.order(after=["test_zipmap.py::test_zipmap_pipeline"]) +@pytest.mark.order(after="pipelines/test_zipmap.py::test_zipmap_pipeline") def test_pipeline_chain_execution(config_folder): """Tests a simple execution from command line""" assert subprocess.call(f"eogrow {config_folder}/chain_pipeline.json", shell=True) == 0 From c479ae6f4211a4ae3d2413c25639b50c76e7daad Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 13:34:42 +0100 Subject: [PATCH 4/6] try to adjust order marker --- tests/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 7ce67f32..7f83f694 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -26,7 +26,7 @@ def test_pipeline_chain_validation(config_folder): assert subprocess.call(f"eogrow-validate {config_folder}/chain_pipeline.json", shell=True) == 0 -@pytest.mark.order(after="pipelines/test_zipmap.py::test_zipmap_pipeline") +@pytest.mark.order(after="test_zipmap.py::test_zipmap_pipeline") def test_pipeline_chain_execution(config_folder): """Tests a simple execution from command line""" assert subprocess.call(f"eogrow {config_folder}/chain_pipeline.json", shell=True) == 0 From 86a56deda740cc210153f65824d155867d86bff4 Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 13:43:36 +0100 Subject: [PATCH 5/6] another try for test order --- tests/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 7f83f694..82cf69a0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -26,7 +26,7 @@ def test_pipeline_chain_validation(config_folder): assert subprocess.call(f"eogrow-validate {config_folder}/chain_pipeline.json", shell=True) == 0 -@pytest.mark.order(after="test_zipmap.py::test_zipmap_pipeline") +@pytest.mark.order(after="tests/pipelines/test_zipmap.py::test_zipmap_pipeline") def test_pipeline_chain_execution(config_folder): """Tests a simple execution from command line""" assert subprocess.call(f"eogrow {config_folder}/chain_pipeline.json", shell=True) == 0 From 67c43aa0144414e314ae41c2e95d76d2db2435cc Mon Sep 17 00:00:00 2001 From: Ziga Luksic Date: Wed, 10 Jan 2024 13:51:38 +0100 Subject: [PATCH 6/6] add integration mark --- tests/test_cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 82cf69a0..443d503b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -26,6 +26,7 @@ def test_pipeline_chain_validation(config_folder): assert subprocess.call(f"eogrow-validate {config_folder}/chain_pipeline.json", shell=True) == 0 +@pytest.mark.integration() @pytest.mark.order(after="tests/pipelines/test_zipmap.py::test_zipmap_pipeline") def test_pipeline_chain_execution(config_folder): """Tests a simple execution from command line"""