Commit 08af8a14 authored by Anna Warno's avatar Anna Warno
Browse files

training miliseconds -> seconds

parent b4428b6b
......@@ -93,7 +93,7 @@ def train(target_column, prediction_length, yaml_file="model.yaml"):
msg = {
"metrics": [target_column],
"forecasting_method": os.environ.get("METHOD", "nbetas"),
"timestamp": int(time.time()) * 1000,
"timestamp": int(time.time()),
}
print(msg)
return msg
......@@ -4,6 +4,7 @@ import stomp
import json
from amq_message_python_library import * # python amq-message-python-library
import logging
import time
AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
......@@ -97,12 +98,11 @@ def main():
# msg1 = Msg()
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate": 60000}]'
# msg2 = Msg()
# msg2.body = """{
# "metrics": ["cpu_usage"],
# "timestamp": 0,
# "epoch_start": 0,
# "number_of_forward_predictions": 8,
# "prediction_horizon": 60}"""
# msg2.body = (
# "{"
# + f'"metrics": ["cpu_usage"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) + 30}, "number_of_forward_predictions": 8,"prediction_horizon": 60'
# + "}"
# )
# StartListener(start_conn.conn, START_APP_TOPIC).on_message(msg1)
# StartForecastingListener(start_conn.conn, START_APP_TOPIC).on_message(msg2)
......
......@@ -112,7 +112,6 @@ def main():
logging.debug("prediction")
dataset_preprocessor.prepare_csv()
global time_0
time_1 = time_0
print("time 00000000 ", time_0)
time_0 = time_0 + prediction_cycle
for metric in predicted_metrics:
......@@ -139,6 +138,9 @@ def main():
if prediction_msgs:
dest = f"{PRED_TOPIC_PREF}.{metric}"
print(
f'{int(prediction_msgs[metric]["predictionTime"]) - int(prediction_msgs[metric]["timestamp"])} difference between current and predicted in secnds'
)
start_conn.send_to_topic(dest, prediction_msgs[metric])
influxdb_conn.send_to_influxdb(metric, prediction_msgs)
......
......@@ -97,7 +97,7 @@ def train(target_column, prediction_length, yaml_file="model.yaml"):
msg = {
"metrics": [target_column],
"forecasting_method": os.environ.get("METHOD", "tft"),
"timestamp": int(time.time()) * 1000,
"timestamp": int(time.time()),
}
return msg
Markdown is supported
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