Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Melodic
morphemic-preprocessor
Commits
8c3508c5
Commit
8c3508c5
authored
Jul 07, 2021
by
Anna Warno
Browse files
dockerfile structure changed
parent
7e6db949
Changes
4
Hide whitespace changes
Inline
Side-by-side
deployment/nbeats/Dockerfile
View file @
8c3508c5
...
...
@@ -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"]
...
...
deployment/nbeats/main.py
View file @
8c3508c5
...
...
@@ -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":
3
0000}, {"metric": "response_time", "level": 3, "publish_rate":
6
0000}]'
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate":
1
0000}, {"metric": "response_time", "level": 3, "publish_rate":
10000}, {"metric": "latency", "level": 3, "publish_rate": 10000}, {"metric": "memory", "level": 3, "publish_rate": 1
0000}]'
# msg2 = Msg()
# msg2.body = (
# "{"
# + f'"metrics": ["cpu_usage", "response_time"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) +
3
0}, "number_of_forward_predictions": 8,"prediction_horizon":
6
0'
# + f'"metrics": ["cpu_usage", "response_time"
, "latency", "memory"
],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) +
20
0}, "number_of_forward_predictions": 8,"prediction_horizon":
12
0'
# + "}"
# )
...
...
deployment/tft/Dockerfile
View file @
8c3508c5
...
...
@@ -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"]
...
...
deployment/tft/main.py
View file @
8c3508c5
...
...
@@ -96,14 +96,15 @@ def main():
)
# msg1 = Msg()
# msg1.body = '[{"metric": "cpu_usage", "level": 3, "publish_rate":
45
000}]'
# 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": 10
000}]'
# msg2 = Msg()
# msg2.body = (
# "{"
# + f'"metrics": ["cpu_usage"],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) +
3
0}, "number_of_forward_predictions": 8,"prediction_horizon":
6
0'
# + f'"metrics": ["cpu_usage"
, "response_time", "latency", "memory"
],"timestamp": {int(time.time())}, "epoch_start": {int(time.time()) +
20
0}, "number_of_forward_predictions": 8,"prediction_horizon":
12
0'
# + "}"
# )
# print(msg1)
# StartListener(start_conn.conn, START_APP_TOPIC).on_message(msg1)
# StartForecastingListener(start_conn.conn, START_APP_TOPIC).on_message(msg2)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment