Skip to content
Snippets Groups Projects
Commit 20972e29 authored by lukas leufen's avatar lukas leufen
Browse files

Merge branch 'lukas_issue294_tech_improve-preprocessing-logging' into 'develop'

Resolve "better understanding why station is removed in preprocessing"

See merge request !276
parents b333c7d2 d1d75c5f
No related branches found
No related tags found
5 merge requests!319add all changes of dev into release v1.4.0 branch,!318Resolve "release v1.4.0",!299Draft: Merge default data handler and preprocessing support parameter use_multiprocessing....,!276Resolve "better understanding why station is removed in preprocessing",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #66394 passed
...@@ -5,6 +5,7 @@ __date__ = '2019-11-25' ...@@ -5,6 +5,7 @@ __date__ = '2019-11-25'
import logging import logging
import os import os
import traceback
from typing import Tuple from typing import Tuple
import multiprocessing import multiprocessing
import requests import requests
...@@ -337,6 +338,15 @@ def f_proc(data_handler, station, name_affix, store, **kwargs): ...@@ -337,6 +338,15 @@ def f_proc(data_handler, station, name_affix, store, **kwargs):
try: try:
res = data_handler.build(station, name_affix=name_affix, store_processed_data=store, **kwargs) res = data_handler.build(station, name_affix=name_affix, store_processed_data=store, **kwargs)
except (AttributeError, EmptyQueryResult, KeyError, requests.ConnectionError, ValueError) as e: 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 res = None
return res, station 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.
Please register or to comment