Commit b96d1f00 authored by Anna Warno's avatar Anna Warno
Browse files

time zone corrected

parent 426b891a
......@@ -2,7 +2,7 @@ FROM python:3.8-slim-buster
# Install Python dependencies.
WORKDIR /wd
# COPY deployment/nbeats/requirements.txt .
# COPY deployment/arima/requirements.txt .
COPY deployment/arima/requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt && mkdir models
......
......@@ -6,6 +6,7 @@ from amq_message_python_library import * # python amq-message-python-library
import logging
import time
from datetime import datetime
import pytz
AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
......@@ -14,6 +15,7 @@ AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
START_APP_TOPIC = "metrics_to_predict"
METHOD = os.environ.get("METHOD", "nbeats")
START_TOPIC = f"start_forecasting.{METHOD}"
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'tft')}.out", level=logging.INFO
......@@ -85,7 +87,9 @@ def main():
logging.info(
f"EXPERIMENT STARTED FOR APPLICATION: {os.environ.get('APP_NAME', 'demo')}"
)
logging.info(f"TIME: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}")
logging.info(
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
start_app_conn = morphemic.Connection(
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER, debug=True
......@@ -103,6 +107,7 @@ def main():
start_app_conn.conn.set_listener(
"2", StartForecastingListener(start_conn.conn, START_TOPIC)
)
# msg1 = Msg()
# msg1.body = '[{"metric": "memory", "level": 3, "publish_rate": 10000}]'
# msg2 = Msg()
......
......@@ -9,8 +9,9 @@ import json
import sys
import pandas as pd
import logging
import datetime
from datetime import datetime
from src.dataset_maker import CSVData
import pytz
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'nbeats')}.out", level=logging.INFO
......@@ -27,6 +28,7 @@ AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
AMQ_HOST = os.environ.get("AMQ_HOST", "localhost")
AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
class CustomListener(stomp.ConnectionListener):
......@@ -140,7 +142,7 @@ def main():
if prediction_msgs:
logging.info(f"Sending predictions for {metric} metric")
logging.info(
f"time: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}"
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
dest = f"{PRED_TOPIC_PREF}.{metric}"
print(
......
......@@ -6,6 +6,7 @@ from amq_message_python_library import * # python amq-message-python-library
import logging
import time
from datetime import datetime
import pytz
AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
......@@ -14,6 +15,7 @@ AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
START_APP_TOPIC = "metrics_to_predict"
METHOD = os.environ.get("METHOD", "nbeats")
START_TOPIC = f"start_forecasting.{METHOD}"
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'tft')}.out", level=logging.INFO
......@@ -85,7 +87,9 @@ def main():
logging.info(
f"EXPERIMENT STARTED FOR APPLICATION: {os.environ.get('APP_NAME', 'demo')}"
)
logging.info(f"TIME: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}")
logging.info(
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
start_app_conn = morphemic.Connection(
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER, debug=True
......@@ -103,6 +107,7 @@ def main():
start_app_conn.conn.set_listener(
"2", StartForecastingListener(start_conn.conn, START_TOPIC)
)
# msg1 = Msg()
# msg1.body = '[{"metric": "memory", "level": 3, "publish_rate": 10000}]'
# msg2 = Msg()
......
......@@ -9,8 +9,9 @@ import json
import sys
import pandas as pd
import logging
import datetime
from datetime import datetime
from src.dataset_maker import CSVData
import pytz
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'nbeats')}.out", level=logging.INFO
......@@ -27,6 +28,7 @@ AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
AMQ_HOST = os.environ.get("AMQ_HOST", "localhost")
AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
class CustomListener(stomp.ConnectionListener):
......@@ -140,7 +142,7 @@ def main():
if prediction_msgs:
logging.info(f"Sending predictions for {metric} metric")
logging.info(
f"time: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}"
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
dest = f"{PRED_TOPIC_PREF}.{metric}"
print(
......
......@@ -6,6 +6,7 @@ from amq_message_python_library import * # python amq-message-python-library
import logging
import time
from datetime import datetime
import pytz
AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
......@@ -14,6 +15,7 @@ AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
START_APP_TOPIC = "metrics_to_predict"
METHOD = os.environ.get("METHOD", "nbeats")
START_TOPIC = f"start_forecasting.{METHOD}"
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'tft')}.out", level=logging.INFO
......@@ -85,7 +87,9 @@ def main():
logging.info(
f"EXPERIMENT STARTED FOR APPLICATION: {os.environ.get('APP_NAME', 'demo')}"
)
logging.info(f"TIME: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}")
logging.info(
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
start_app_conn = morphemic.Connection(
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER, debug=True
......
......@@ -11,6 +11,7 @@ import pandas as pd
import logging
from datetime import datetime
from src.dataset_maker import CSVData
import pytz
logging.basicConfig(
filename=f"logs/{os.environ.get('METHOD', 'nbeats')}.out", level=logging.INFO
......@@ -27,6 +28,7 @@ AMQ_USER = os.environ.get("AMQ_USER", "admin")
AMQ_PASSWORD = os.environ.get("AMQ_PASSWORD", "admin")
AMQ_HOST = os.environ.get("AMQ_HOST", "localhost")
AMQ_PORT_BROKER = os.environ.get("AMQ_PORT_BROKER", "61613")
TZ = os.environ.get("TIME_ZONE", "Europe/Vienna")
class CustomListener(stomp.ConnectionListener):
......@@ -140,7 +142,7 @@ def main():
if prediction_msgs:
logging.info(f"Sending predictions for {metric} metric")
logging.info(
f"time: {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}"
f"TIME: {datetime.now(pytz.timezone(TZ)).strftime('%d/%m/%Y %H:%M:%S')}"
)
dest = f"{PRED_TOPIC_PREF}.{metric}"
print(
......
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