Fix worker db
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
# namenode/KDC phân giải theo /etc/hosts của host.
|
||||
# kie chỉ khởi động sau khi chandra healthy để hai vLLM không đo bộ nhớ GPU cùng lúc;
|
||||
# worker đợi cả hai model healthy mới nhận trang.
|
||||
# Chandra đọc weight nhúng sẵn trong image tại /model. Qwen đọc weight đã giải nén
|
||||
# từ qwen35-4b-weights.tar tại KIE_MODEL_DIR, dùng cùng image làm runtime vLLM.
|
||||
|
||||
x-gpu: &gpu
|
||||
resources:
|
||||
@@ -20,6 +22,8 @@ x-gpu: &gpu
|
||||
device_ids: ["${GPU_DEVICE:-0}"] # như `docker run --gpus device=0`
|
||||
capabilities: [gpu]
|
||||
|
||||
x-vllm-image: &vllm-image ${IMAGE_TAG:-chandra-dla-api:v2-20260906-024126}
|
||||
|
||||
x-vllm-env: &vllm-env
|
||||
HF_HUB_OFFLINE: "1"
|
||||
TRANSFORMERS_OFFLINE: "1"
|
||||
@@ -41,7 +45,8 @@ x-app: &app
|
||||
|
||||
services:
|
||||
chandra:
|
||||
image: ${IMAGE_TAG:-chandra-dla-api:v2-20260906-024126}
|
||||
image: *vllm-image
|
||||
pull_policy: never
|
||||
container_name: chandra-ocr
|
||||
restart: unless-stopped
|
||||
deploy: *gpu
|
||||
@@ -50,8 +55,6 @@ services:
|
||||
ports:
|
||||
- "${PORT:-9222}:8000"
|
||||
environment: *vllm-env
|
||||
volumes:
|
||||
- ${CHANDRA_MODEL_DIR:?dat CHANDRA_MODEL_DIR trong .env}:/model:ro
|
||||
command:
|
||||
- --model=/model
|
||||
- --served-model-name=chandra
|
||||
@@ -69,7 +72,9 @@ services:
|
||||
healthcheck: *health
|
||||
|
||||
kie:
|
||||
image: ${KIE_IMAGE:-vllm/vllm-openai:v0.23.0}
|
||||
# Dùng runtime vLLM đã có trong image Chandra; mount Qwen đè lên /model.
|
||||
image: *vllm-image
|
||||
pull_policy: never
|
||||
container_name: qwen-kie
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
@@ -82,7 +87,12 @@ services:
|
||||
- "${KIE_PORT:-9224}:8000"
|
||||
environment: *vllm-env
|
||||
volumes:
|
||||
- ${KIE_MODEL_DIR:?dat KIE_MODEL_DIR trong .env}:/model:ro
|
||||
- type: bind
|
||||
source: ${KIE_MODEL_DIR:?dat KIE_MODEL_DIR trong .env}
|
||||
target: /model
|
||||
read_only: true
|
||||
bind:
|
||||
create_host_path: false
|
||||
command:
|
||||
- --model=/model
|
||||
- --served-model-name=qwen3.5-4b
|
||||
@@ -91,6 +101,7 @@ services:
|
||||
- --dtype=bfloat16
|
||||
- --max-model-len=32768
|
||||
- --max-num-seqs=16
|
||||
- --max-num-batched-tokens=8192
|
||||
- --gpu-memory-utilization=${KIE_GPU_UTIL:-0.3}
|
||||
- --enable-prefix-caching
|
||||
- --seed=42
|
||||
@@ -109,6 +120,12 @@ services:
|
||||
# Cùng đường dẫn trong và ngoài container; SQLite phải nằm trên đĩa local, không NFS.
|
||||
- ${IDP_DATA_DIR:-/data/idp-runtime}:${IDP_DATA_DIR:-/data/idp-runtime}
|
||||
command: ["uvicorn", "idp_service.api:app", "--host=${IDP_HOST:-0.0.0.0}", "--port=${IDP_PORT:-8001}"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:${IDP_PORT:-8001}/readyz', timeout=3)\""]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
worker:
|
||||
<<: *app
|
||||
@@ -126,5 +143,16 @@ services:
|
||||
HDFS_KEYTAB: /opt/native-hdfs/conf/searchengine.headless.keytab
|
||||
volumes:
|
||||
- ${IDP_DATA_DIR:-/data/idp-runtime}:${IDP_DATA_DIR:-/data/idp-runtime}
|
||||
- ${HDFS_NATIVE_DIR:-./native-hdfs}:/opt/native-hdfs:ro
|
||||
- type: bind
|
||||
source: ${HDFS_NATIVE_DIR:?dat HDFS_NATIVE_DIR trong .env}
|
||||
target: /opt/native-hdfs
|
||||
read_only: true
|
||||
bind:
|
||||
create_host_path: false
|
||||
command: ["python", "-m", "idp_service.worker"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "python -c \"import os, shutil, sqlite3; from idp_service.config import Settings; s=Settings(); db=sqlite3.connect(str(s.db_path), timeout=3); db.execute('SELECT 1'); db.close(); assert s.storage != 'hdfs_cli' or (shutil.which('hdfs') and os.access(os.environ.get('HDFS_KEYTAB', ''), os.R_OK))\""]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
Reference in New Issue
Block a user