From 071aa81f37f294c1c83a423e994883a9ece403a8 Mon Sep 17 00:00:00 2001 From: atsag Date: Tue, 8 Oct 2024 13:22:40 +0300 Subject: [PATCH] Amendment in the previous correction to the forecasting termination process --- exponential-smoothing-predictor/src/runtime/Predictor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exponential-smoothing-predictor/src/runtime/Predictor.py b/exponential-smoothing-predictor/src/runtime/Predictor.py index 3204cc2..978040d 100755 --- a/exponential-smoothing-predictor/src/runtime/Predictor.py +++ b/exponential-smoothing-predictor/src/runtime/Predictor.py @@ -459,12 +459,12 @@ def on_message(self, key, address, body, context, **kwargs): application_name = body["name"] application_state = EsPredictorState.individual_application_state[application_name] print_with_time("Received message to stop predicting some of the metrics") - metrics_to_remove = json.loads(body)["metrics"] + metrics_to_remove = body["metrics"] for metric in metrics_to_remove: if (application_state.metrics_to_predict.__contains__(metric)): print_with_time("Stopping generating predictions for metric "+metric) application_state.metrics_to_predict.remove(metric) - if len(application_state.metrics_to_predict)==0: + if (len(metrics_to_remove)==0 or len(application_state.metrics_to_predict)==0): EsPredictorState.individual_application_state[application_name].start_forecasting = False EsPredictorState[application_name].prediction_thread.join()