Browse Source

Merge pull request 'fix(db): 修复模型查询字段错误' (#35) from cjl-dev into master

Reviewed-on: http://120.26.116.243:3000/root/model-lab/pulls/35
master
chenjiale 1 month ago
parent
commit
5fe1b3c261
  1. 16
      Dockerfile
  2. 2
      PCA_Test.py

16
Dockerfile

@ -3,8 +3,11 @@
# ======================
FROM python:3.10.16-slim AS builder
RUN sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources \
&& sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources
# 使用清华源(Debian 12 Bookworm)
RUN printf "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n\
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n\
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
@ -23,10 +26,13 @@ RUN pip install --no-cache-dir --prefix=/python_install \
# ======================
FROM python:3.10.16-slim
RUN sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources \
&& sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources
# 使用清华源(HTTPS)
RUN printf "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n\
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n\
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list
# ⭐ pyodbc 运行必须安装 libodbc1(提供 libodbc.so.2)
# pyodbc 必须安装 libodbc1(提供 libodbc.so.2)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libodbc1 unixodbc \

2
PCA_Test.py

@ -189,7 +189,7 @@ class MySQL:
self.conn.close()
def get_model_by_ID(model_id, version="v-test"):
ms = MySQL(host=config._SQL_IP, user="root", pwd="powerSIS#123", database="alert")
resList = ms.ExecQuery(f"SELECT Model_info FROM model_cfg where id={model_id}")
resList = ms.ExecQuery(f"SELECT Model_info FROM model_cfg where model_id={model_id}")
return json.loads(resList[0][0])

Loading…
Cancel
Save