Commit 38d77b9a authored by Bizid Imen's avatar Bizid Imen
Browse files

Update gluonts_listener.py

parent 2f0da411
......@@ -62,7 +62,7 @@ def worker(self, body, metric):
yhat = yhats[k]
yhat_lower = yhat_lowers[k]
yhat_upper = yhat_uppers[k]
self.connector.send_to_topic('intermediate_prediction.gluonmachines.' + metric,
self.connector.send_to_topic('intermediate_prediction.gluonts.' + metric,
{
"metricValue": float(yhat),
"level": 3,
......@@ -81,7 +81,7 @@ def worker(self, body, metric):
class Gluonts(morphemic.handler.ModelHandler, messaging.listener.MorphemicListener):
id = "gluonmachines"
id = "gluonts"
def __init__(self):
self._run = False
......@@ -91,8 +91,8 @@ class Gluonts(morphemic.handler.ModelHandler, messaging.listener.MorphemicListen
def run(self):
self.connector.connect()
self.connector.set_listener(self.id, self)
self.connector.topic("start_forecasting.gluonmachines", self.id)
self.connector.topic("stop_forecasting.gluonmachines", self.id)
self.connector.topic("start_forecasting.gluonts", self.id)
self.connector.topic("stop_forecasting.gluonts", self.id)
self.connector.topic("metrics_to_predict", self.id)
def reconnect(self):
......@@ -100,7 +100,7 @@ class Gluonts(morphemic.handler.ModelHandler, messaging.listener.MorphemicListen
self.run()
pass
def on_start_forecasting_gluonmachines(self, body):
def on_start_forecasting_gluonts(self, body):
sent_metrics = body["metrics"]
logging.debug(f"Gluonts Start Forecasting the following metrics: {sent_metrics}")
for metric in sent_metrics:
......@@ -134,11 +134,11 @@ class Gluonts(morphemic.handler.ModelHandler, messaging.listener.MorphemicListen
self.connector.send_to_topic("training_models",
{
"metrics": list(metrics),
"forecasting_method": "gluonmachines",
"forecasting_method": "gluonts",
"timestamp": int(time())
})
def on_stop_forecasting_gluonmachines(self, body):
def on_stop_forecasting_gluonts(self, body):
logging.debug(f"Gluonts Stop Forecasting the following metrics: {body['metrics']}")
for metric in body["metrics"]:
if metric in metrics:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment