Skip to content
Snippets Groups Projects
Commit 45c07a95 authored by Felix Kleinert's avatar Felix Kleinert
Browse files

include error traceback

parent 186f32f3
No related branches found
No related tags found
1 merge request!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #63939 passed
......@@ -9,6 +9,7 @@ from typing import Tuple
import multiprocessing
import requests
import psutil
import traceback
import numpy as np
import pandas as pd
......@@ -79,7 +80,10 @@ class PreProcessing(RunEnvironment):
logging.debug(f"Number of training stations: {n_train}")
logging.debug(f"Number of val stations: {n_val}")
logging.debug(f"Number of test stations: {n_test}")
self.create_latex_report()
try:
self.create_latex_report()
except Exception as e:
logging.warning(f"Can't create latex report: {e} ")
def create_latex_report(self):
"""
......@@ -336,6 +340,14 @@ def f_proc(data_handler, station, name_affix, store, **kwargs):
try:
res = data_handler.build(station, name_affix=name_affix, store_processed_data=store, **kwargs)
except (AttributeError, EmptyQueryResult, KeyError, requests.ConnectionError, ValueError) as e:
logging.info(f"remove station {station} because it raised an error: {e}")
formatted_lines = traceback.format_exc().splitlines()
logging.info(f"remove station {station} because it raised an error: {e} -> {' | '.join(f_inspect_error(formatted_lines))}")
res = None
return res, station
def f_inspect_error(formatted):
for i in range(len(formatted) - 1, -1, -1):
if "mlair/mlair" not in formatted[i]:
return formatted[i - 3:i]
return formatted[-3:0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment