Skip to content

Commit 4b2354b

Browse files
add exc_info_with_locals log on uncaught exception for batch jobs
1 parent 4693cb8 commit 4b2354b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

openeogeotrellis/deploy/batch_job.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import stat
66
from copy import deepcopy
77
from pathlib import Path
8+
from traceback_with_variables import Format, format_exc
89
from typing import Dict, List, Optional, Tuple, Union
910
from urllib.parse import urlparse
1011

@@ -488,5 +489,9 @@ def _extract_and_install_udf_dependencies(process_graph: dict, job_dir: Path):
488489
main(sys.argv)
489490
except Exception as e:
490491
error_summary = GeoPySparkBackendImplementation.summarize_exception_static(e)
491-
logger.exception("OpenEO batch job failed: " + error_summary.summary)
492+
most_recent_exception = sys.exc_info()[1]
493+
fmt = Format(max_value_str_len=1000)
494+
logger.exception("OpenEO batch job failed: " + error_summary.summary, extra = {
495+
"exc_info_with_locals": format_exc(most_recent_exception, fmt = fmt)
496+
})
492497
raise

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"attrs>=22.1.0",
9393
"planetary-computer~=1.0.0",
9494
"reretry~=0.11.8",
95+
"traceback-with-variables==2.0.4",
9596
],
9697
extras_require={
9798
"dev": tests_require,

0 commit comments

Comments
 (0)