From d1d75c5f4f4dc2facc88b5b30c7b8dbe3167e606 Mon Sep 17 00:00:00 2001 From: leufen1 <l.leufen@fz-juelich.de> Date: Thu, 18 Mar 2021 15:10:54 +0100 Subject: [PATCH] different logging message --- mlair/run_modules/pre_processing.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mlair/run_modules/pre_processing.py b/mlair/run_modules/pre_processing.py index 7f3ce51e..4d90f87b 100644 --- a/mlair/run_modules/pre_processing.py +++ b/mlair/run_modules/pre_processing.py @@ -5,11 +5,11 @@ __date__ = '2019-11-25' import logging import os +import traceback from typing import Tuple import multiprocessing import requests import psutil -import traceback import numpy as np import pandas as pd @@ -338,6 +338,14 @@ def f_proc(data_handler, station, name_affix, 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: formatted_lines = traceback.format_exc().splitlines() - logging.info(f"remove station {station} because it raised an error: {e} (from {' | '.join(formatted_lines[-3:])}") + 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] -- GitLab