Pārlūkot izejas kodu

提交 hypercorn_config.py
用 hypercorn来控制服务数量

罗俊辉 1 gadu atpakaļ
vecāks
revīzija
69d94a4464
3 mainītis faili ar 185 papildinājumiem un 2 dzēšanām
  1. 22 0
      Dockerfile
  2. 0 2
      async_app.py
  3. 163 0
      environment.yml

+ 22 - 0
Dockerfile

@@ -0,0 +1,22 @@
+FROM continuumio/miniconda3
+
+# 容器内部的工作路径
+WORKDIR /app
+
+# 把环境配置文件 copy 到 docker 容器中
+COPY environment.yml /app/environment.yml
+
+# 使用environment.yml文件中定义的环境设置Conda环境
+RUN conda env create -f /app/environment.yml
+
+# 复制你的项目文件到工作目录
+COPY . /app
+
+# 启动容器内python 环境
+CMD ["conda", "activate", "lightGBM"]
+
+# 用 hypercorn 启动服务
+CMD ["hypercorn", "async_app:app", "--config", "hypercorn_config.toml"]
+
+
+

+ 0 - 2
async_app.py

@@ -32,7 +32,5 @@ async def preload_jieba():
     print("jieba 缓存加载完成")
 
 
-
-
 if __name__ == '__main__':
     app.run(debug=True)

+ 163 - 0
environment.yml

@@ -0,0 +1,163 @@
+name: lightGBM
+channels:
+  - defaults
+dependencies:
+  - _libgcc_mutex=0.1=main
+  - _openmp_mutex=5.1=1_gnu
+  - bzip2=1.0.8=h5eee18b_5
+  - ca-certificates=2023.12.12=h06a4308_0
+  - ld_impl_linux-64=2.38=h1181459_1
+  - libffi=3.4.4=h6a678d5_0
+  - libgcc-ng=11.2.0=h1234567_1
+  - libgomp=11.2.0=h1234567_1
+  - libstdcxx-ng=11.2.0=h1234567_1
+  - libuuid=1.41.5=h5eee18b_0
+  - ncurses=6.4=h6a678d5_0
+  - openssl=3.0.13=h7f8727e_0
+  - pip=23.3.1=py310h06a4308_0
+  - python=3.10.13=h955ad1f_0
+  - readline=8.2=h5eee18b_0
+  - setuptools=68.2.2=py310h06a4308_0
+  - sqlite=3.41.2=h5eee18b_0
+  - tk=8.6.12=h1ccaba5_0
+  - wheel=0.41.2=py310h06a4308_0
+  - xz=5.4.6=h5eee18b_0
+  - zlib=1.2.13=h5eee18b_0
+  - pip:
+      - aiofiles==23.2.1
+      - alembic==1.13.1
+      - anyio==4.3.0
+      - argon2-cffi==23.1.0
+      - argon2-cffi-bindings==21.2.0
+      - arrow==1.3.0
+      - asttokens==2.4.1
+      - async-lru==2.0.4
+      - attrs==23.2.0
+      - babel==2.14.0
+      - bayesian-optimization==1.4.3
+      - beautifulsoup4==4.12.3
+      - bleach==6.1.0
+      - blinker==1.7.0
+      - certifi==2024.2.2
+      - cffi==1.16.0
+      - charset-normalizer==3.3.2
+      - click==8.1.7
+      - colorama==0.4.6
+      - colorlog==6.8.2
+      - comm==0.2.2
+      - debugpy==1.8.1
+      - decorator==5.1.1
+      - defusedxml==0.7.1
+      - et-xmlfile==1.1.0
+      - exceptiongroup==1.2.0
+      - executing==2.0.1
+      - fastjsonschema==2.19.1
+      - flask==3.0.3
+      - fqdn==1.5.1
+      - greenlet==3.0.3
+      - h11==0.14.0
+      - h2==4.1.0
+      - hpack==4.0.0
+      - httpcore==1.0.4
+      - httpx==0.27.0
+      - hypercorn==0.16.0
+      - hyperframe==6.0.1
+      - idna==3.6
+      - ipykernel==6.29.3
+      - ipython==8.22.2
+      - ipywidgets==8.1.2
+      - isoduration==20.11.0
+      - itsdangerous==2.1.2
+      - jedi==0.19.1
+      - jieba==0.42.1
+      - jinja2==3.1.3
+      - joblib==1.3.2
+      - json5==0.9.24
+      - jsonpointer==2.4
+      - jsonschema==4.21.1
+      - jsonschema-specifications==2023.12.1
+      - jupyter-client==8.6.1
+      - jupyter-console==6.6.3
+      - jupyter-core==5.7.2
+      - jupyter-events==0.9.1
+      - jupyter-lsp==2.2.4
+      - jupyter-server==2.13.0
+      - jupyter-server-terminals==0.5.3
+      - jupyterlab==4.1.5
+      - jupyterlab-pygments==0.3.0
+      - jupyterlab-server==2.25.4
+      - jupyterlab-widgets==3.0.10
+      - lightgbm==4.3.0
+      - mako==1.3.2
+      - markupsafe==2.1.5
+      - matplotlib-inline==0.1.6
+      - mistune==3.0.2
+      - nbclient==0.10.0
+      - nbconvert==7.16.2
+      - nbformat==5.10.3
+      - nest-asyncio==1.6.0
+      - notebook-shim==0.2.4
+      - numpy==1.26.4
+      - odps==3.5.1
+      - openpyxl==3.1.2
+      - optuna==3.6.0
+      - overrides==7.7.0
+      - packaging==24.0
+      - pandas==2.2.1
+      - pandocfilters==1.5.1
+      - parso==0.8.3
+      - pexpect==4.9.0
+      - platformdirs==4.2.0
+      - priority==2.0.0
+      - prometheus-client==0.20.0
+      - prompt-toolkit==3.0.43
+      - psutil==5.9.8
+      - ptyprocess==0.7.0
+      - pure-eval==0.2.2
+      - pyarrow==15.0.2
+      - pycparser==2.21
+      - pygments==2.17.2
+      - pymysql==1.1.0
+      - pyodps==0.11.5.post0
+      - python-dateutil==2.9.0.post0
+      - python-json-logger==2.0.7
+      - pytz==2024.1
+      - pyyaml==6.0.1
+      - pyzmq==25.1.2
+      - qtconsole==5.5.1
+      - qtpy==2.4.1
+      - quart==0.19.5
+      - referencing==0.34.0
+      - requests==2.31.0
+      - rfc3339-validator==0.1.4
+      - rfc3986-validator==0.1.1
+      - rpds-py==0.18.0
+      - scikit-learn==1.4.1.post1
+      - scipy==1.12.0
+      - send2trash==1.8.2
+      - six==1.16.0
+      - sniffio==1.3.1
+      - soupsieve==2.5
+      - sqlalchemy==2.0.29
+      - stack-data==0.6.3
+      - taskgroup==0.0.0a4
+      - terminado==0.18.1
+      - threadpoolctl==3.3.0
+      - tinycss2==1.2.1
+      - tomli==2.0.1
+      - tornado==6.4
+      - tqdm==4.66.2
+      - traitlets==5.14.2
+      - types-python-dateutil==2.9.0.20240316
+      - typing-extensions==4.10.0
+      - tzdata==2024.1
+      - uri-template==1.3.0
+      - urllib3==1.26.18
+      - wcwidth==0.2.13
+      - webcolors==1.13
+      - webencodings==0.5.1
+      - websocket-client==1.7.0
+      - werkzeug==3.0.2
+      - widgetsnbextension==4.0.10
+      - wsproto==1.2.0
+prefix: /root/anaconda3/envs/lightGBM