Commit 8c3508c5 authored by Anna Warno's avatar Anna Warno
Browse files

dockerfile structure changed

parent 7e6db949
......@@ -2,15 +2,22 @@ FROM python:3.8-slim-buster
# Install Python dependencies.
WORKDIR /wd
COPY deployment/nbeats/requirements.txt .
# COPY deployment/nbeats/requirements.txt .
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt && mkdir models
ADD https://gitlab.ow2.org/melodic/morphemic-preprocessor/-/archive/morphemic-rc1.5/morphemic-preprocessor-morphemic-rc1.5.tar.gz /var/lib/morphemic/
# Copy the rest of the codebase into the image
COPY deployment/nbeats ./
COPY morphemic-datasetmaker ./morphemic-datasetmaker
COPY amq-message-python-library ./amq-message-python-library
COPY . ./
RUN cd morphemic-datasetmaker && python3 setup.py install && cd .. && rm -r morphemic-datasetmaker && mv amq-message-python-library amq_message_python_library
RUN cd /var/lib/morphemic/ \
&& tar -zxf morphemic-preprocessor-morphemic-rc1.5.tar.gz \
&& cd morphemic-preprocessor-morphemic-rc1.5 \
&& cd morphemic-datasetmaker && python3 setup.py install \
&& cd ../.. \
&& cp -R /var/lib/morphemic/morphemic-preprocessor-morphemic-rc1.5/amq-message-python-library /wd/amq_message_python_library \
&& rm -rf /var/lib/morphemic
CMD ["python3", "main.py"]
......
......@@ -11,7 +11,7 @@ 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")
START_APP_TOPIC = "metrics_to_predict"
METHOD = os.environ.get("METHOD", "tft")
METHOD = os.environ.get("METHOD", "nbeats")
START_TOPIC = f"start_forecasting.{METHOD}"
......@@ -76,15 +76,14 @@ class Msg(object):
def main():
print("STARTTTTT")
logging.getLogger().setLevel(logging.DEBUG)
start_app_conn = morphemic.Connection(
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER, debug=True
)
start_app_conn.connect()
start_conn = morphemic.Connection(
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER
AMQ_USER, AMQ_PASSWORD, host=AMQ_HOST, port=AMQ_PORT_BROKER, debug=True
)
start_conn.connect()
......@@ -97,11 +96,11 @@ def main():
)
# msg1 = Msg()
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate": 30000}, {"metric": "response_time", "level": 3, "publish_rate": 60000}]'
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate": 10000}, {"metric": "response_time", "level": 3, "publish_rate": 10000}, {"metric": "latency", "level": 3, "publish_rate": 10000}, {"metric": "memory", "level": 3, "publish_rate": 10000}]'
# msg2 = Msg()
# msg2.body = (
# "{"
# + f'"metrics": ["cpu_usage", "response_time"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) + 30}, "number_of_forward_predictions": 8,"prediction_horizon": 60'
# + f'"metrics": ["cpu_usage", "response_time", "latency", "memory"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) + 200}, "number_of_forward_predictions": 8,"prediction_horizon": 120'
# + "}"
# )
......
......@@ -2,15 +2,22 @@ FROM python:3.8-slim-buster
# Install Python dependencies.
WORKDIR /wd
COPY deployment/tft/requirements.txt .
# COPY deployment/nbeats/requirements.txt .
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt && mkdir models
ADD https://gitlab.ow2.org/melodic/morphemic-preprocessor/-/archive/morphemic-rc1.5/morphemic-preprocessor-morphemic-rc1.5.tar.gz /var/lib/morphemic/
# Copy the rest of the codebase into the image
COPY deployment/tft ./
COPY morphemic-datasetmaker ./morphemic-datasetmaker
COPY amq-message-python-library ./amq-message-python-library
COPY . ./
RUN cd morphemic-datasetmaker && python3 setup.py install && cd .. && rm -r morphemic-datasetmaker && mv amq-message-python-library amq_message_python_library
RUN cd /var/lib/morphemic/ \
&& tar -zxf morphemic-preprocessor-morphemic-rc1.5.tar.gz \
&& cd morphemic-preprocessor-morphemic-rc1.5 \
&& cd morphemic-datasetmaker && python3 setup.py install \
&& cd ../.. \
&& cp -R /var/lib/morphemic/morphemic-preprocessor-morphemic-rc1.5/amq-message-python-library /wd/amq_message_python_library \
&& rm -rf /var/lib/morphemic
CMD ["python3", "main.py"]
......
......@@ -96,14 +96,15 @@ def main():
)
# msg1 = Msg()
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate": 45000}]'
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate": 10000}, {"metric": "response_time", "level": 3, "publish_rate": 10000}, {"metric": "latency", "level": 3, "publish_rate": 10000}, {"metric": "memory", "level": 3, "publish_rate": 10000}]'
# msg2 = Msg()
# msg2.body = (
# "{"
# + f'"metrics": ["cpu_usage"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) + 30}, "number_of_forward_predictions": 8,"prediction_horizon": 60'
# + f'"metrics": ["cpu_usage", "response_time", "latency", "memory"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) + 200}, "number_of_forward_predictions": 8,"prediction_horizon": 120'
# + "}"
# )
# print(msg1)
# StartListener(start_conn.conn, START_APP_TOPIC).on_message(msg1)
# StartForecastingListener(start_conn.conn, START_APP_TOPIC).on_message(msg2)
......
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