Skip to content
Snippets Groups Projects
Commit 2fa5d1b9 authored by Stefano Borini's avatar Stefano Borini
Browse files

Added more logging

parent ffd6d256
No related branches found
No related tags found
1 merge request!111Added more logging
...@@ -19,6 +19,8 @@ push_exception_handler(reraise_exceptions=True) ...@@ -19,6 +19,8 @@ push_exception_handler(reraise_exceptions=True)
def run(evaluate, logfile, workflow_filepath): def run(evaluate, logfile, workflow_filepath):
logging_config = {} logging_config = {}
logging_config["level"] = logging.INFO
if logfile is not None: if logfile is not None:
logging_config["filename"] = logfile logging_config["filename"] = logfile
......
...@@ -14,7 +14,6 @@ CORE_EVALUATION_DRIVER_ID = plugin_id("core", "CoreEvaluationDriver") ...@@ -14,7 +14,6 @@ CORE_EVALUATION_DRIVER_ID = plugin_id("core", "CoreEvaluationDriver")
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class CoreEvaluationDriver(BaseCoreDriver): class CoreEvaluationDriver(BaseCoreDriver):
"""Main plugin that handles the execution of the MCO """Main plugin that handles the execution of the MCO
or the evaluation. or the evaluation.
...@@ -35,17 +34,20 @@ class CoreEvaluationDriver(BaseCoreDriver): ...@@ -35,17 +34,20 @@ class CoreEvaluationDriver(BaseCoreDriver):
sys.exit(0) sys.exit(0)
mco_factory = mco_model.factory mco_factory = mco_model.factory
log.info("Creating communicator")
mco_communicator = mco_factory.create_communicator() mco_communicator = mco_factory.create_communicator()
mco_data_values = _get_data_values_from_mco( mco_data_values = _get_data_values_from_mco(
mco_model, mco_communicator) mco_model, mco_communicator)
log.info("Computing data layer 1")
ds_results = _compute_layer_results( ds_results = _compute_layer_results(
mco_data_values, mco_data_values,
workflow.data_sources, workflow.data_sources,
"create_data_source" "create_data_source"
) )
log.info("Computing data layer 2")
kpi_results = _compute_layer_results( kpi_results = _compute_layer_results(
ds_results + mco_data_values, ds_results + mco_data_values,
workflow.kpi_calculators, workflow.kpi_calculators,
...@@ -107,7 +109,13 @@ def _compute_layer_results(environment_data_values, ...@@ -107,7 +109,13 @@ def _compute_layer_results(environment_data_values,
# execute data source, passing only relevant data values. # execute data source, passing only relevant data values.
log.info("Evaluating for Data Source {}".format( log.info("Evaluating for Data Source {}".format(
factory.name)) factory.name))
res = evaluator.run(model, passed_data_values)
try:
res = evaluator.run(model, passed_data_values)
except Exception:
log.error("Evaluation could not be performed. Run method raised"
"exception", exc_info=True)
raise
if len(res) != len(out_slots): if len(res) != len(out_slots):
error_txt = ( error_txt = (
...@@ -165,6 +173,9 @@ def _get_data_values_from_mco(model, communicator): ...@@ -165,6 +173,9 @@ def _get_data_values_from_mco(model, communicator):
""" """
mco_data_values = communicator.receive_from_mco(model) mco_data_values = communicator.receive_from_mco(model)
log.info("Received data from MCO: \n{}".format(
"\n".join([str(x) for x in mco_data_values])))
if len(mco_data_values) != len(model.parameters): if len(mco_data_values) != len(model.parameters):
error_txt = ("The number of data values returned by" error_txt = ("The number of data values returned by"
" the MCO ({} values) does not match the" " the MCO ({} values) does not match the"
......
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