Skip to content

Commit 546a27a

Browse files
authored
Release 3.3.5, Merge pull request #334 from sentinel-hub/develop
Release 3.3.5
2 parents 3bc62a5 + bef9555 commit 546a27a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1256
-6545
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ repos:
1616
rev: "v4.0.0-alpha.8"
1717
hooks:
1818
- id: prettier
19-
exclude: "tests/(test_stats|test_project)/"
19+
exclude: "tests/test_project/"
2020
types_or: [json]
2121

2222
- repo: https://github.com/psf/black
23-
rev: 24.1.1
23+
rev: 24.2.0
2424
hooks:
2525
- id: black
2626
language_version: python3
2727

2828
- repo: https://github.com/charliermarsh/ruff-pre-commit
29-
rev: "v0.1.14"
29+
rev: "v0.3.2"
3030
hooks:
3131
- id: ruff
3232

3333
- repo: https://github.com/nbQA-dev/nbQA
34-
rev: 1.7.1
34+
rev: 1.8.4
3535
hooks:
3636
- id: nbqa-black
3737
- id: nbqa-ruff

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [Version 1.7.7] - 2024-03-11
2+
3+
- When a Pipeline raises an error it now saves the stack-trace to the `failure.log` file in the logs folder.
4+
5+
16
## [Version 1.7.6] - 2024-01-29
27

38
- Pipelines that are run as part of a pipeline-chain execution will now no longer be retried by ray in the case when an exception occurs.

eogrow/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""The main module of the eo-grow package."""
22

3-
__version__ = "1.7.6"
3+
__version__ = "1.7.7"

eogrow/core/pipeline.py

+10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
import logging
66
import time
7+
import traceback
78
import uuid
89
from typing import Any, TypeVar
910

11+
import fs
1012
import ray
1113

1214
from eolearn.core import CreateEOPatchTask, EOExecutor, EONode, EOWorkflow, LoadTask, SaveTask, WorkflowResults
@@ -255,6 +257,14 @@ def run(self) -> None:
255257

256258
if failed and self.config.raise_on_failure:
257259
raise PipelineExecutionError(f"Pipeline failed some executions. Check {log_folder}.")
260+
except Exception as e:
261+
# store any exception info you can
262+
failure_log_path = fs.path.join(
263+
self.logging_manager.get_pipeline_logs_folder(self.current_execution_name), "failure.log"
264+
)
265+
with self.storage.filesystem.open(failure_log_path, mode="w") as log_file:
266+
log_file.writelines(traceback.format_exc())
267+
raise e
258268
finally:
259269
self.logging_manager.stop_logging(root_logger, handlers)
260270

eogrow/tasks/batch_to_eopatch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _parse_timestamps(userdata: dict, userdata_timestamp_reader: str) -> list:
5454
reader = import_object(userdata_timestamp_reader)
5555
time_strings = reader(userdata)
5656
except (ImportError, ValueError):
57-
time_strings = eval(userdata_timestamp_reader) # pylint: disable=eval-used # noqa: PGH001
57+
time_strings = eval(userdata_timestamp_reader) # pylint: disable=eval-used
5858

5959
return [parse_time(time_string, force_datetime=True, ignoretz=True) for time_string in time_strings]
6060

pyproject.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ preview = true
116116
[tool.ruff]
117117
line-length = 120
118118
target-version = "py38"
119-
select = [
119+
lint.select = [
120120
"F", # pyflakes
121121
"E", # pycodestyle
122122
"W", # pycodestyle
@@ -147,11 +147,11 @@ select = [
147147
"RUF", # ruff rules
148148
]
149149
fix = true
150-
fixable = [
150+
lint.fixable = [
151151
"I", # sort imports
152152
"F401", # remove redundant imports
153153
]
154-
ignore = [
154+
lint.ignore = [
155155
"C408", # complains about `dict()` calls, we use them to avoid too many " in the code
156156
"SIM117", # wants to always combine `with` statements, gets ugly for us
157157
"SIM108", # tries to aggresively inline `if`, not always readable
@@ -164,11 +164,11 @@ ignore = [
164164
"B028", # always demands a stacklevel argument when warning
165165
"PT011", # complains for `pytest.raises(ValueError)` but we use it a lot
166166
]
167-
per-file-ignores = { "__init__.py" = ["F401"] }
167+
lint.per-file-ignores = { "__init__.py" = ["F401"] }
168168
exclude = [".git", "__pycache__", "build", "dist"]
169169

170170

171-
[tool.ruff.isort]
171+
[tool.ruff.lint.isort]
172172
section-order = [
173173
"future",
174174
"standard-library",

tests/core/test_pipeline.py

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import logging
22
import os
3+
from contextlib import suppress
4+
from pathlib import Path
35
from typing import List, Tuple, Union
46

57
import pytest
@@ -98,6 +100,23 @@ def test_get_patch_list_filtration_error(test_subset: List[Union[int, str]], sim
98100
pipeline.get_patch_list()
99101

100102

103+
def test_pipeline_logs_exception(simple_config_filename: str) -> None:
104+
def cookie_alarm():
105+
raise RuntimeError("Oh no, someone stole my cookie! :(")
106+
107+
config = interpret_config_from_path(simple_config_filename)
108+
pipeline = SimplePipeline.from_raw_config(config)
109+
pipeline.run_procedure = cookie_alarm
110+
111+
with suppress(RuntimeError):
112+
pipeline.run()
113+
114+
log_folder = pipeline.logging_manager.get_pipeline_logs_folder(pipeline.current_execution_name, full_path=True)
115+
log_path = Path(log_folder) / "failure.log"
116+
assert log_path.exists()
117+
assert "Oh no, someone stole my cookie! :(" in log_path.read_text()
118+
119+
101120
@pytest.mark.parametrize("fail", [True, False])
102121
@pytest.mark.parametrize("raise_on_failure", [True, False])
103122
def test_pipeline_raises_on_failure(fail: bool, raise_on_failure: bool, simple_config_filename: str):

tests/test_stats/download_and_batch/batch_to_eopatch.json

+16-120
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
"bbox": "BBox(((729480.0, 4390045.0), (732120.0, 4391255.0)), crs=CRS('32638'))",
44
"data": {
55
"bands": {
6-
"array_shape": [
7-
7,
8-
300,
9-
200,
10-
3
11-
],
6+
"array_shape": [7, 300, 200, 3],
127
"basic_stats": {
138
"max": 1234.38,
149
"mean": 617.189,
@@ -23,36 +18,15 @@
2318
"dtype": "float32",
2419
"histogram": {
2520
"counts": [
26-
157086,
27-
157534,
28-
157504,
29-
158241,
30-
157351,
31-
157494,
32-
157391,
33-
157399
21+
157086, 157534, 157504, 158241, 157351, 157494, 157391, 157399
3422
],
3523
"edges": [
36-
0.0,
37-
154.297,
38-
308.594,
39-
462.891,
40-
617.188,
41-
771.485,
42-
925.782,
43-
1080.08,
24+
0.0, 154.297, 308.594, 462.891, 617.188, 771.485, 925.782, 1080.08,
4425
1234.38
4526
]
4627
},
4728
"random_values": [
48-
88.3902,
49-
949.824,
50-
1209.32,
51-
265.664,
52-
939.578,
53-
357.388,
54-
668.235,
55-
609.102
29+
88.3902, 949.824, 1209.32, 265.664, 939.578, 357.388, 668.235, 609.102
5630
],
5731
"subsample_basic_stats": {
5832
"max": 1234.38,
@@ -63,12 +37,7 @@
6337
}
6438
},
6539
"bands_repeated": {
66-
"array_shape": [
67-
7,
68-
300,
69-
200,
70-
3
71-
],
40+
"array_shape": [7, 300, 200, 3],
7241
"basic_stats": {
7342
"max": 1234.38,
7443
"mean": 617.189,
@@ -83,36 +52,15 @@
8352
"dtype": "float32",
8453
"histogram": {
8554
"counts": [
86-
157086,
87-
157534,
88-
157504,
89-
158241,
90-
157351,
91-
157494,
92-
157391,
93-
157399
55+
157086, 157534, 157504, 158241, 157351, 157494, 157391, 157399
9456
],
9557
"edges": [
96-
0.0,
97-
154.297,
98-
308.594,
99-
462.891,
100-
617.188,
101-
771.485,
102-
925.782,
103-
1080.08,
58+
0.0, 154.297, 308.594, 462.891, 617.188, 771.485, 925.782, 1080.08,
10459
1234.38
10560
]
10661
},
10762
"random_values": [
108-
88.3902,
109-
949.824,
110-
1209.32,
111-
265.664,
112-
939.578,
113-
357.388,
114-
668.235,
115-
609.102
63+
88.3902, 949.824, 1209.32, 265.664, 939.578, 357.388, 668.235, 609.102
11664
],
11765
"subsample_basic_stats": {
11866
"max": 1234.38,
@@ -140,12 +88,7 @@
14088
"bbox": "BBox(((729480.0, 4391145.0), (732120.0, 4392355.0)), crs=CRS('32638'))",
14189
"data": {
14290
"bands": {
143-
"array_shape": [
144-
7,
145-
300,
146-
200,
147-
3
148-
],
91+
"array_shape": [7, 300, 200, 3],
14992
"basic_stats": {
15093
"max": 1234.38,
15194
"mean": 617.189,
@@ -160,36 +103,15 @@
160103
"dtype": "float32",
161104
"histogram": {
162105
"counts": [
163-
157086,
164-
157534,
165-
157504,
166-
158241,
167-
157351,
168-
157494,
169-
157391,
170-
157399
106+
157086, 157534, 157504, 158241, 157351, 157494, 157391, 157399
171107
],
172108
"edges": [
173-
0.0,
174-
154.297,
175-
308.594,
176-
462.891,
177-
617.188,
178-
771.485,
179-
925.782,
180-
1080.08,
109+
0.0, 154.297, 308.594, 462.891, 617.188, 771.485, 925.782, 1080.08,
181110
1234.38
182111
]
183112
},
184113
"random_values": [
185-
88.3902,
186-
949.824,
187-
1209.32,
188-
265.664,
189-
939.578,
190-
357.388,
191-
668.235,
192-
609.102
114+
88.3902, 949.824, 1209.32, 265.664, 939.578, 357.388, 668.235, 609.102
193115
],
194116
"subsample_basic_stats": {
195117
"max": 1234.38,
@@ -200,12 +122,7 @@
200122
}
201123
},
202124
"bands_repeated": {
203-
"array_shape": [
204-
7,
205-
300,
206-
200,
207-
3
208-
],
125+
"array_shape": [7, 300, 200, 3],
209126
"basic_stats": {
210127
"max": 1234.38,
211128
"mean": 617.189,
@@ -220,36 +137,15 @@
220137
"dtype": "float32",
221138
"histogram": {
222139
"counts": [
223-
157086,
224-
157534,
225-
157504,
226-
158241,
227-
157351,
228-
157494,
229-
157391,
230-
157399
140+
157086, 157534, 157504, 158241, 157351, 157494, 157391, 157399
231141
],
232142
"edges": [
233-
0.0,
234-
154.297,
235-
308.594,
236-
462.891,
237-
617.188,
238-
771.485,
239-
925.782,
240-
1080.08,
143+
0.0, 154.297, 308.594, 462.891, 617.188, 771.485, 925.782, 1080.08,
241144
1234.38
242145
]
243146
},
244147
"random_values": [
245-
88.3902,
246-
949.824,
247-
1209.32,
248-
265.664,
249-
939.578,
250-
357.388,
251-
668.235,
252-
609.102
148+
88.3902, 949.824, 1209.32, 265.664, 939.578, 357.388, 668.235, 609.102
253149
],
254150
"subsample_basic_stats": {
255151
"max": 1234.38,

0 commit comments

Comments
 (0)