Skip to content

Commit f18dc62

Browse files
ElienVandermaesenVITOsoxofaan
authored andcommitted
issue #687 rename log_error to show_error logs
1 parent cf9e4ec commit f18dc62

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

openeo/rest/datacube.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ def execute_batch(
24772477
job_options: Optional[dict] = None,
24782478
validate: Optional[bool] = None,
24792479
auto_add_save_result: bool = True,
2480-
log_error=True,
2480+
show_error_logs: bool = True,
24812481
# TODO: deprecate `format_options` as keyword arguments
24822482
**format_options,
24832483
) -> BatchJob:
@@ -2495,7 +2495,7 @@ def execute_batch(
24952495
:param validate: Optional toggle to enable/prevent validation of the process graphs before execution
24962496
(overruling the connection's ``auto_validate`` setting).
24972497
:param auto_add_save_result: Automatically add a ``save_result`` node to the process graph if there is none yet.
2498-
:param log_error: whether to print error logs
2498+
:param show_error_logs: whether to automatically print error logs when the batch job failed.
24992499
25002500
.. versionchanged:: 0.32.0
25012501
Added ``auto_add_save_result`` option
@@ -2532,7 +2532,7 @@ def execute_batch(
25322532
return job.run_synchronous(
25332533
outputfile=outputfile,
25342534
print=print, max_poll_interval=max_poll_interval, connection_retry_interval=connection_retry_interval,
2535-
log_error=log_error
2535+
show_error_logs=show_error_logs
25362536
)
25372537

25382538
def create_job(

openeo/rest/job.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def logs(
236236

237237
def run_synchronous(
238238
self, outputfile: Union[str, Path, None] = None,
239-
print=print, max_poll_interval=60, connection_retry_interval=30, log_error=True
239+
print=print, max_poll_interval=60, connection_retry_interval=30, show_error_logs: bool = True
240240
) -> BatchJob:
241241
"""
242242
Start the job, wait for it to finish and download result
@@ -245,12 +245,12 @@ def run_synchronous(
245245
:param print: print/logging function to show progress/status
246246
:param max_poll_interval: maximum number of seconds to sleep between status polls
247247
:param connection_retry_interval: how long to wait when status poll failed due to connection issue
248-
:param log_error: whether to print error logs
248+
:param show_error_logs: whether to automatically print error logs when the batch job failed.
249249
:return:
250250
"""
251251
self.start_and_wait(
252252
print=print, max_poll_interval=max_poll_interval, connection_retry_interval=connection_retry_interval,
253-
log_error=log_error
253+
show_error_logs=show_error_logs
254254
)
255255
# TODO #135 support multi file result sets too?
256256
if outputfile is not None:
@@ -259,7 +259,7 @@ def run_synchronous(
259259

260260
def start_and_wait(
261261
self, print=print, max_poll_interval: int = 60, connection_retry_interval: int = 30, soft_error_max=10,
262-
log_error=True
262+
show_error_logs: bool = True
263263
) -> BatchJob:
264264
"""
265265
Start the batch job, poll its status and wait till it finishes (or fails)
@@ -268,7 +268,7 @@ def start_and_wait(
268268
:param max_poll_interval: maximum number of seconds to sleep between status polls
269269
:param connection_retry_interval: how long to wait when status poll failed due to connection issue
270270
:param soft_error_max: maximum number of soft errors (e.g. temporary connection glitches) to allow
271-
:param log_error: whether to print error logs
271+
:param show_error_logs: whether to automatically print error logs when the batch job failed.
272272
:return:
273273
"""
274274
# TODO rename `connection_retry_interval` to something more generic?
@@ -327,7 +327,7 @@ def soft_error(message: str):
327327

328328
if status != "finished":
329329
# TODO: render logs jupyter-aware in a notebook context?
330-
if log_error:
330+
if show_error_logs:
331331
print(f"Your batch job {self.job_id!r} failed. Error logs:")
332332
print(self.logs(level=logging.ERROR))
333333
print(

tests/rest/test_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def test_execute_batch_with_error_with_error_logs_disabled(con100, requests_mock
182182
with fake_time():
183183
con100.load_collection("SENTINEL2").execute_batch(
184184
outputfile=path, out_format="GTIFF",
185-
max_poll_interval=.1, print=log.append, log_error=False
185+
max_poll_interval=.1, print=log.append, show_error_logs=False
186186
)
187187
pytest.fail("execute_batch should fail")
188188
except JobFailedException as e:

0 commit comments

Comments
 (0)