Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit d0ccf01

Browse files
Merge branch 'AICoE:master' into master
2 parents f66dfde + d46d0a1 commit d0ccf01

File tree

11 files changed

+501
-975
lines changed

11 files changed

+501
-975
lines changed

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM continuumio/miniconda3
2-
3-
SHELL ["/bin/bash", "-c"]
4-
ADD . /
5-
RUN chmod +x set_uid.sh
6-
7-
ADD environment.yml /tmp/environment.yml
8-
RUN chmod g+w /etc/passwd
9-
RUN conda env create -f /tmp/environment.yml
1+
FROM registry.access.redhat.com/ubi8/python-38:latest
102

3+
# Add application sources to a directory that the assemble script expects them
4+
# and set permissions so that the container runs without root access
5+
USER 0
6+
ADD . /tmp/src
7+
RUN /usr/bin/fix-permissions /tmp/src
118
USER 1001
129

13-
# Ensure that assigned uid has entry in /etc/passwd.
14-
CMD ./set_uid.sh && /opt/conda/envs/prophet-env/bin/python ${APP_FILE}
10+
# Install the dependencies
11+
RUN /usr/libexec/s2i/assemble
12+
13+
# Set the default command for the resulting image
14+
CMD /usr/libexec/s2i/run

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ schedule = "*"
99
prometheus_client = "*"
1010
prometheus_api_client = "*"
1111
tornado = "*"
12-
fbprophet = "*"
12+
pystan = "==2.19.1.1"
13+
prophet = "*"
1314
dateparser = "*"
1415
mlflow = "*"
15-
keras = "*"
1616
numpy = "*"
1717
scikit-learn = "*"
1818
tensorflow = "*"

Pipfile.lock

Lines changed: 411 additions & 949 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
name: prophet-env
2+
name: PAD
33
channels:
44
- conda-forge
55
dependencies:
66
- python=3.8
77
- pip
8-
- fbprophet
8+
- prophet
99
- pip:
1010
- pandas
1111
- schedule
@@ -15,5 +15,5 @@ dependencies:
1515
- dateparser
1616
- mlflow
1717
- numpy
18-
- keras
18+
- tensorflow
1919
- scikit-learn

model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import datetime
33
import logging
44
import pandas
5-
from fbprophet import Prophet
5+
from prophet import Prophet
66
from prometheus_api_client import Metric
77

88
# Set up logging

model_lstm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""doctsring for packages."""
22
import logging
33
from prometheus_api_client import Metric
4-
from keras.models import Sequential
5-
from keras.layers import Dense
6-
from keras.layers import LSTM
4+
from tensorflow.keras.models import Sequential
5+
from tensorflow.keras.layers import Dense
6+
from tensorflow.keras.layers import LSTM
77

88
import numpy as np
99
from sklearn.preprocessing import MinMaxScaler

openshift/k8s-deployment.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: prometheus-anomaly-detector
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: prometheus-anomaly-detector
10+
replicas: 1
11+
template:
12+
metadata:
13+
labels:
14+
app: prometheus-anomaly-detector
15+
spec:
16+
containers:
17+
- env:
18+
- name: FLT_PROM_URL
19+
value: "http://demo.robustperception.io:9090/"
20+
- name: FLT_PROM_ACCESS_TOKEN
21+
value: "my-oauth-token"
22+
- name: FLT_METRICS_LIST
23+
value: "up"
24+
- name: FLT_RETRAINING_INTERVAL_MINUTES
25+
value: "15m"
26+
- name: FLT_ROLLING_TRAINING_WINDOW_SIZE
27+
value: "24h"
28+
- name: FLT_DEBUG_MODE
29+
value: "True"
30+
- name: APP_FILE
31+
value: "app.py"
32+
name: prometheus-anomaly-detector
33+
image: quay.io/aicoe/prometheus-anomaly-detector:latest
34+
ports:
35+
- containerPort: 8080

openshift/k8s-service.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: prometheus-anomaly-detector
6+
labels:
7+
app: prometheus-anomaly-detector
8+
operated-prometheus: 'true'
9+
spec:
10+
selector:
11+
app: prometheus-anomaly-detector
12+
ports:
13+
- protocol: TCP
14+
port: 8080
15+
targetPort: 8080
16+
name: metrics

openshift/k8s-servicemonitor.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: prometheus-anomaly-detector-monitor
6+
spec:
7+
endpoints:
8+
- port: metrics
9+
interval: 60s
10+
selector:
11+
matchLabels:
12+
operated-prometheus: 'true'
13+
app: prometheus-anomaly-detector
14+
namespaceSelector:
15+
matchNames:
16+
- prometheus-anomaly-detector # update namespace to where the service is deployed

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ schedule
33
prometheus_client
44
prometheus_api_client
55
tornado
6-
fbprophet
6+
pystan==2.19.1.1
7+
prophet
78
mlflow
89
numpy
9-
Keras
1010
scikit-learn
11+
tensorflow

0 commit comments

Comments
 (0)