minor fixes

This commit is contained in:
Florian Förster 2025-03-20 14:03:03 +01:00
parent 31ca651aca
commit a4604d3dc4
4 changed files with 28 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "delta-barth" name = "delta-barth"
version = "0.3.0" version = "0.3.1"
description = "prognosis module" description = "prognosis module"
authors = [ authors = [
{name = "Florian Förster", email = "f.foerster@d-opt.com"}, {name = "Florian Förster", email = "f.foerster@d-opt.com"},

View File

@ -22,6 +22,7 @@ from delta_barth.constants import (
MIN_NUMBER_DATAPOINTS, MIN_NUMBER_DATAPOINTS,
) )
from delta_barth.errors import STATUS_HANDLER, wrap_result from delta_barth.errors import STATUS_HANDLER, wrap_result
from delta_barth.logging import logger_pipelines as logger
from delta_barth.types import ( from delta_barth.types import (
DualDict, DualDict,
PipeResult, PipeResult,
@ -293,6 +294,11 @@ def pipeline_sales(
start_date=start_date, start_date=start_date,
) )
if status != STATUS_HANDLER.SUCCESS: if status != STATUS_HANDLER.SUCCESS:
logger.error(
"Error during sales prognosis data retrieval, Status: %s",
status,
stack_info=True,
)
return _export_on_fail(status) return _export_on_fail(status)
pipe = _preprocess_sales( pipe = _preprocess_sales(
@ -301,6 +307,11 @@ def pipeline_sales(
target_features=FEATURES_SALES_PROGNOSIS, target_features=FEATURES_SALES_PROGNOSIS,
) )
if pipe.status != STATUS_HANDLER.SUCCESS: if pipe.status != STATUS_HANDLER.SUCCESS:
logger.error(
"Error during sales prognosis preprocessing, Status: %s",
pipe.status,
stack_info=True,
)
return _export_on_fail(pipe.status) return _export_on_fail(pipe.status)
pipe = _process_sales( pipe = _process_sales(
@ -308,6 +319,11 @@ def pipeline_sales(
min_num_data_points=MIN_NUMBER_DATAPOINTS, min_num_data_points=MIN_NUMBER_DATAPOINTS,
) )
if pipe.status != STATUS_HANDLER.SUCCESS: if pipe.status != STATUS_HANDLER.SUCCESS:
logger.error(
"Error during sales prognosis main processing, Status: %s",
pipe.status,
stack_info=True,
)
return _export_on_fail(pipe.status) return _export_on_fail(pipe.status)
pipe = _postprocess_sales( pipe = _postprocess_sales(
@ -315,6 +331,11 @@ def pipeline_sales(
feature_map=DualDict(), feature_map=DualDict(),
) )
if pipe.status != STATUS_HANDLER.SUCCESS: if pipe.status != STATUS_HANDLER.SUCCESS:
logger.error(
"Error during sales prognosis postprocessing, Status: %s",
pipe.status,
stack_info=True,
)
return _export_on_fail(pipe.status) return _export_on_fail(pipe.status)
assert pipe.results is not None, "needed export response not set in pipeline" assert pipe.results is not None, "needed export response not set in pipeline"

View File

@ -242,7 +242,10 @@ def wrap_result(
fmt_exc = traceback.format_exception(err) fmt_exc = traceback.format_exception(err)
exc_str = "".join(fmt_exc) exc_str = "".join(fmt_exc)
logger.error( logger.error(
"An exception in routine %s occured:\n%s", func.__name__, exc_str "An exception in routine %s occurred:\n%s",
func.__name__,
exc_str,
stack_info=True,
) )
return status return status

View File

@ -51,3 +51,5 @@ logger_all.addHandler(logger_all_handler_file)
logger_wrapped_results = logging.getLogger("delta_barth.wrapped_results") logger_wrapped_results = logging.getLogger("delta_barth.wrapped_results")
logger_wrapped_results.setLevel(logging.DEBUG) logger_wrapped_results.setLevel(logging.DEBUG)
logger_pipelines = logging.getLogger("delta_barth.logger_pipelines")
logger_pipelines.setLevel(logging.DEBUG)