-
Notifications
You must be signed in to change notification settings - Fork 74
feat(devx): local dev setup for control plane and full end-to-end flow (MLI-6681) #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a9453f5
0212a9c
59e8a2f
2679726
df1f000
957f573
0c42fc8
f649274
63c513f
89336be
f15a827
dd8e8c0
f781623
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| .PHONY: install dev-up dev-down dev-migrate dev-server test \ | ||
| kind-up kind-down kind-image \ | ||
| dev-service-builder dev-k8s-cacher dev-server-full | ||
|
|
||
| MODEL_ENGINE_DIR := $(abspath .) | ||
| DB_URL := postgresql://postgres:password@localhost:5432/llm_engine | ||
| KIND_CLUSTER := llm-engine | ||
| KUBE_CONTEXT := kind-$(KIND_CLUSTER) | ||
|
|
||
| # ── Control-plane-only (no k8s, fake queue/docker) ────────────────────────── | ||
| LOCAL_ENV := \ | ||
| LOCAL=true \ | ||
| GIT_TAG=local \ | ||
| ML_INFRA_DATABASE_URL=$(DB_URL) \ | ||
| DEPLOY_SERVICE_CONFIG_PATH=$(MODEL_ENGINE_DIR)/service_configs/service_config_local.yaml \ | ||
| ML_INFRA_SERVICES_CONFIG_PATH=$(MODEL_ENGINE_DIR)/model_engine_server/core/configs/default.yaml | ||
|
|
||
| # ── Full end-to-end (real k8s via kind, real Redis queue, fake docker) ─────── | ||
| FULL_LOCAL_ENV := \ | ||
| LOCAL=true \ | ||
| GIT_TAG=local \ | ||
| ML_INFRA_DATABASE_URL=$(DB_URL) \ | ||
| DEPLOY_SERVICE_CONFIG_PATH=$(MODEL_ENGINE_DIR)/service_configs/service_config_local.yaml \ | ||
| ML_INFRA_SERVICES_CONFIG_PATH=$(MODEL_ENGINE_DIR)/model_engine_server/core/configs/local-full.yaml \ | ||
| REDIS_HOST=localhost \ | ||
| REDIS_PORT=6379 | ||
|
|
||
| # ── One-time setup ─────────────────────────────────────────────────────────── | ||
| install: | ||
| pip install -r requirements.txt -r requirements-test.txt -r requirements_override.txt | ||
| pip install -e . | ||
|
|
||
| # ── Backing services (Postgres + Redis) ───────────────────────────────────── | ||
| dev-up: | ||
| docker compose -f docker-compose.local.yml up -d --wait | ||
|
|
||
| dev-down: | ||
| docker compose -f docker-compose.local.yml down | ||
|
|
||
| dev-migrate: | ||
| $(LOCAL_ENV) bash model_engine_server/db/migrations/run_database_migration.sh | ||
|
|
||
| # ── Control-plane-only server ──────────────────────────────────────────────── | ||
| dev-server: | ||
| $(LOCAL_ENV) start-fastapi-server --port 5000 --num-workers 1 --debug | ||
|
|
||
| # ── kind cluster (for full end-to-end flow) ────────────────────────────────── | ||
| kind-up: | ||
| kind create cluster --name $(KIND_CLUSTER) | ||
| kubectl --context $(KUBE_CONTEXT) create namespace model-engine --dry-run=client -o yaml | kubectl --context $(KUBE_CONTEXT) apply -f - | ||
|
|
||
| kind-down: | ||
| kind delete cluster --name $(KIND_CLUSTER) | ||
|
|
||
| kind-image: | ||
| docker build -t model-engine:local .. | ||
| kind load docker-image model-engine:local --name $(KIND_CLUSTER) | ||
|
|
||
| # ── Full end-to-end processes (run each in a separate terminal) ─────────────── | ||
| dev-server-full: | ||
| $(FULL_LOCAL_ENV) start-fastapi-server --port 5000 --num-workers 1 --debug | ||
|
|
||
| dev-service-builder: | ||
| $(FULL_LOCAL_ENV) celery -A model_engine_server.service_builder.celery worker --loglevel=info --concurrency=2 | ||
|
|
||
| dev-k8s-cacher: | ||
| $(FULL_LOCAL_ENV) python model_engine_server/entrypoints/k8s_cache.py --sleep-interval-seconds 5 | ||
|
|
||
| # ── Tests ───────────────────────────────────────────────────────────────────── | ||
| test: | ||
| pytest tests/unit/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| services: | ||
| postgres: | ||
| image: postgres:15 | ||
| environment: | ||
| POSTGRES_PASSWORD: password | ||
| POSTGRES_DB: llm_engine | ||
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| redis: | ||
| image: redis:7 | ||
| ports: | ||
| - "6379:6379" | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "ping"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| volumes: | ||
| postgres_data: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,9 @@ | |
| try: | ||
| from opentelemetry import trace | ||
| from opentelemetry.context import Context | ||
| from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import ( # noqa: F401 | ||
| OTLPMetricExporter, | ||
| ) | ||
|
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: model-engine/model_engine_server/common/startup_tracing/correlation.py
Line: 15-17
Comment:
**OTLP exporter import tightens OTel availability requirement silently**
`OTLPMetricExporter` is placed in the same `try/except ImportError` block as the core SDK availability check. This means any environment that has `opentelemetry-api` + `opentelemetry-sdk` installed but NOT `opentelemetry-exporter-otlp-proto-grpc` will now get `OTEL_AVAILABLE = False` and all trace correlation will silently be skipped. The exporter is only listed in vllm-specific requirements (`inference/vllm/requirements.txt`), not in the main `requirements.txt`, making this a fragile dependency for a shared utility. The import should be in its own nested `try/except` or removed entirely if `OTLPMetricExporter` isn't actually instantiated in this file.
How can I resolve this? If you propose a fix, please make it concise. |
||
| from opentelemetry.sdk.trace import TracerProvider # noqa: F401 - SDK availability check | ||
| from opentelemetry.trace import NonRecordingSpan, SpanContext, TraceFlags | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cloud_provider: onprem | ||
| env: local | ||
| k8s_cluster_name: kind-llm-engine | ||
| dns_host_domain: localhost | ||
| default_region: us-east-1 | ||
| ml_account_id: local | ||
| docker_repo_prefix: "localhost" | ||
| s3_bucket: local-bucket | ||
| redis_host: localhost | ||
| redis_port: 6379 | ||
| celery_broker_type_redis: true | ||
| db_engine_pool_size: 5 | ||
| db_engine_max_overflow: 5 | ||
| db_engine_echo: false | ||
| db_engine_echo_pool: false | ||
| db_engine_disconnect_strategy: pessimistic |
Uh oh!
There was an error while loading. Please reload this page.