Skip to content

Commit d225aa2

Browse files
committed
Warn about existing save_result nodes from _auto_save_result
related to #720 #402 #725 #732
1 parent 9b1e6a4 commit d225aa2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

openeo/rest/datacube.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,6 +2367,9 @@ def _auto_save_result(
23672367
outputfile: Optional[Union[str, pathlib.Path]] = None,
23682368
options: Optional[dict] = None,
23692369
) -> SaveResult:
2370+
if any(n.process_id == "save_result" for n in self.result_node().walk_nodes()):
2371+
log.warning(f"This {type(self).__name__} already contains 1 or more `save_result` nodes.")
2372+
23702373
return self.save_result(
23712374
format=format or (guess_format(outputfile) if outputfile else None) or self._DEFAULT_RASTER_FORMAT,
23722375
options=options,

openeo/rest/vectorcube.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import json
4+
import logging
45
import pathlib
56
import typing
67
from typing import Callable, List, Optional, Tuple, Union
@@ -33,6 +34,9 @@
3334
from openeo import Connection
3435

3536

37+
_log = logging.getLogger(__name__)
38+
39+
3640
class VectorCube(_ProcessGraphAbstraction):
3741
"""
3842
A Vector Cube, or 'Vector Collection' is a data structure containing 'Features':
@@ -224,6 +228,9 @@ def _auto_save_result(
224228
outputfile: Optional[Union[str, pathlib.Path]] = None,
225229
options: Optional[dict] = None,
226230
) -> SaveResult:
231+
if any(n.process_id == "save_result" for n in self.result_node().walk_nodes()):
232+
_log.warning(f"This {type(self).__name__} already contains 1 or more `save_result` nodes.")
233+
227234
return self.save_result(
228235
format=format or (guess_format(outputfile) if outputfile else None) or self._DEFAULT_VECTOR_FORMAT,
229236
options=options,

0 commit comments

Comments
 (0)