Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions microservices/time-series-analytics/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,33 @@ RUN git clone --depth 1 --filter=blob:none --sparse --branch v${KAPACITOR_VERSIO
mv /tmp/kapacitor/udf/agent/py /app/kapacitor_python && \
rm -rf /tmp/kapacitor

RUN apt-get update && apt-get install -y intel-gpu-tools

RUN export no_proxy= && \
apt-get update && \
. /etc/os-release && \
if [[ ! "jammy" =~ ${VERSION_CODENAME} ]]; then \
echo "Ubuntu version ${VERSION_CODENAME} not supported"; \
else \
wget --no-check-certificate -qO- https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor --output /usr/share/keyrings/gpu-intel-graphics.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gpu-intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
tee /etc/apt/sources.list.d/intel-gpu-"${VERSION_CODENAME}".list && \
apt-get update; \
fi && \
apt-get install -y --no-install-recommends \
intel-opencl-icd=\* ocl-icd-opencl-dev=\* intel-level-zero-gpu=\* level-zero=\* \
libmfx1=\* libmfxgen1=\* libvpl2=\* intel-media-va-driver-non-free=\* \
libgbm1=\* libigdgmm12=\* libxatracker2=\* libdrm-amdgpu1=\* \
va-driver-all=\* vainfo=\* hwinfo=\* clinfo=\* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/cca951e1-31e7-485e-b300-fe7627cb8c08/intel-oneapi-base-toolkit-2025.1.0.651_offline.sh

RUN sh ./intel-oneapi-base-toolkit-2025.1.0.651_offline.sh -a --silent --cli --eula accept

RUN apt update && apt install -y cmake pkg-config build-essential

ARG TIMESERIES_UID
ARG TIMESERIES_USER_NAME
ARG PYTHON_VERSION
Expand All @@ -41,7 +68,7 @@ RUN pip3 install --no-cache-dir -r requirements.txt

# Set environment variables in a single ENV instruction for better layer caching
ENV PYTHONPATH="$PYTHONPATH:/tmp/py_package:/app/kapacitor_python/" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/app/idp/lib"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/intel/oneapi/2025.1/lib"

# Adding classifier program
# Copy Python source files in a single layer for better caching
Expand Down Expand Up @@ -97,4 +124,4 @@ USER $TIMESERIES_USER_NAME
# Simple healthcheck to verify container is running
HEALTHCHECK --interval=5m CMD exit 0

ENTRYPOINT ["python3", "./main.py"]
ENTRYPOINT ["bash", "-c", "source /opt/intel/oneapi/setvars.sh && python3 main.py"]
18 changes: 18 additions & 0 deletions microservices/time-series-analytics/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
hostname: ia-time-series-analytics-microservice
image: ${DOCKER_REGISTRY}${TIME_SERIES_ANALYTICS_IMAGE}${IMAGE_SUFFIX:+-${IMAGE_SUFFIX}}
restart: unless-stopped
privileged: true
security_opt:
- no-new-privileges
read_only: true
Expand Down Expand Up @@ -52,6 +53,23 @@ services:
volumes:
- "vol_temp_time_series_analytics_microservice:/tmp/"
- ../config.json:/app/config.json
- /dev/dri:/dev/dri
- "/run/udev:/run/udev:ro"
device_cgroup_rules:
# Default run - device-cgroup-rule='c 189:* rmw'
# Selective rules can be applied for deployment
- 'c 189:* rmw'
- 'c 209:* rmw'
- 'a 189:* rwm'
devices:
# Following devices under /dev filesystem will be needed based on usecase
# dri - GPU
- "/dev/dri:/dev/dri"
group_add:
# render group ID for ubuntu 20.04 host OS
- "109"
# render group ID for ubuntu 22.04 host OS
- "110"

networks:
timeseries_network:
Expand Down
4 changes: 3 additions & 1 deletion microservices/time-series-analytics/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
scikit-learn-intelex==2025.2.0
scikit-learn-intelex==2025.7.0
scikit-learn==1.6.1
dpcpp-cpp-rt==2025.1.1
dpctl==0.20.2
protobuf==6.31.1
modin==0.32.0
tomlkit==0.13.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ def classifier_startup(config):

udf_section[udf_name]['timeout'] = "60s"
udf_section[udf_name]['env'] = {
'PYTHONPATH': "/tmp/py_package:/app/kapacitor_python/:"
'PYTHONPATH': "/tmp/py_package:/app/kapacitor_python/:",
"ONEAPI_DEVICE_SELECTOR": "level_zero:gpu",
"SYCL_DEVICE_FILTER": "level_zero:gpu"
}
if "alerts" in config.keys() and "mqtt" in config["alerts"].keys():
config_data["mqtt"][0]["name"] = config["alerts"]["mqtt"]["name"]
Expand Down
Loading