### Install Dependencies and Start Development Servers Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/README.md Installs project dependencies, builds shared packages, and starts the backend and frontend development servers. ```bash # Install dependencies npm install # Build shared packages npm run build -w packages/types npm run build -w packages/utils # Start development servers (backend:3000, frontend:5173) npm run dev ``` -------------------------------- ### Start Development Server Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Starts the development server, which automatically creates a Python virtual environment and installs dependencies on the first run. ```bash # Start development (auto-creates Python venv on first run) npm run dev ``` -------------------------------- ### Production Multi-GPU Setup Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/kvcached/configuration.md Example YAML configuration for a production multi-GPU setup using sardeenz with vLLM. This demonstrates how to configure multiple model instances across different GPUs. ```yaml kvcached: gpu_memory_utilization: 0.95 preallocate_pages: true log_level: WARNING router: enabled: true host: '0.0.0.0' port: 8080 timeout: 600 sleep_manager: enabled: true idle_threshold_seconds: 600 # 10 minutes auto_sleep_enabled: true min_sleep_duration_seconds: 120 check_interval_seconds: 120 instances: - name: 'llama-70b-gpu0-1' model: 'meta-llama/Llama-2-70b-hf' engine: 'vllm' port: 12346 env: ENABLE_KVCACHED: 'true' KVCACHED_AUTOPATCH: '1' CUDA_VISIBLE_DEVICES: '0,1' engine_args: disable_log_requests: true enable_prefix_caching: false tensor_parallel_size: 2 # Use 2 GPUs - name: 'codellama-34b-gpu2' model: 'codellama/CodeLlama-34b-hf' engine: 'vllm' port: 12347 env: ENABLE_KVCACHED: 'true' KVCACHED_AUTOPATCH: '1' CUDA_VISIBLE_DEVISES: '2' engine_args: disable_log_requests: true enable_prefix_caching: false tensor_parallel_size: 1 ``` -------------------------------- ### Start Multi-Pod Cluster Backend Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/quickstart.md Configure and start two backend pods for a multi-pod cluster setup. Ensure that CLUSTER_PEERS and CLUSTER_SECRET are consistent across all pods. Each pod simulates 2 GPUs with 24 GB memory. ```bash # Terminal 1: Pod A PORT=3001 \ INFERENCE_BACKEND=inference-sim \ DEV_VIRTUAL_GPU_COUNT=2 \ SIM_GPU_MEMORY_GB=24 \ CLUSTER_PEERS=localhost:3001,localhost:3002 \ CLUSTER_SECRET=$(openssl rand -hex 32) \ npm run dev -w apps/backend # Terminal 2: Pod B (same CLUSTER_SECRET) PORT=3002 \ INFERENCE_BACKEND=inference-sim \ DEV_VIRTUAL_GPU_COUNT=2 \ SIM_GPU_MEMORY_GB=24 \ CLUSTER_PEERS=localhost:3001,localhost:3002 \ CLUSTER_SECRET= \ npm run dev -w apps/backend ``` -------------------------------- ### Manual Python Environment Setup and Activation Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Manually sets up the Python virtual environment, installs all dependencies including the dev group, and activates the environment. This is an alternative to the automated setup. ```bash cd apps/backend # Create venv and install all dependencies (including dev group) uv sync --locked --group dev # Activate the environment source .venv/bin/activate ``` -------------------------------- ### Start Development Server Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/apps/backend/CLAUDE.md Starts the backend development server on port 3000. Use this for local development. ```bash npm run dev -w apps/backend ``` -------------------------------- ### Install Inference-Sim Binary Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/testing.md Clone the repository, build the binary, and copy it to the system's PATH. Verify the installation by checking the help message. ```bash git clone https://github.com/llm-d/llm-d-inference-sim.git cd llm-d-inference-sim make build sudo cp bin/llm-d-inference-sim /usr/local/bin/ llm-d-inference-sim --help # verify ``` -------------------------------- ### Complete Model Instance Configuration Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/kvcached/configuration.md A comprehensive example showing the configuration for a model instance, including environment variables and vLLM engine arguments. ```yaml instances: - name: 'llama-3.2-1b-main' model: 'meta-llama/Llama-3.2-1B' engine: 'vllm' port: 12346 venv: '~/vllm-env' env: ENABLE_KVCACHED: 'true' KVCACHED_AUTOPATCH: '1' CUDA_VISIBLE_DEVICES: '0' engine_args: disable_log_requests: true enable_prefix_caching: false tensor_parallel_size: 1 gpu_memory_utilization: 0.9 max_model_len: 4096 dtype: 'auto' ``` -------------------------------- ### Start Development Servers Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/CLAUDE.md Starts the backend and frontend development servers for local development. Ensure prerequisites like Node.js and GPU drivers are met. ```bash npm run dev ``` -------------------------------- ### Start Single Pod Backend in Inference-Sim Mode Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/quickstart.md Launch the backend in inference-sim mode for a single pod setup. This configuration creates a simulated GPU with 24 GB of memory and does not require actual GPU hardware. ```bash cd apps/backend INFERENCE_BACKEND=inference-sim npm run dev ``` -------------------------------- ### Local Multi-Pod Development Setup Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/004-school-orchestration/quickstart.md Use these commands to simulate a multi-pod environment locally. Ensure you have Node.js 22 and npm workspaces installed. Run each command in a separate terminal. ```bash # Terminal 1: Pod A (will become leader) PORT=3000 CLUSTER_PEERS=localhost:3000,localhost:3001 \ CLUSTER_SECRET=dev-secret-change-me \ DEV_VIRTUAL_GPU_COUNT=2 \ npm run dev -w apps/backend # Terminal 2: Pod B PORT=3001 CLUSTER_PEERS=localhost:3000,localhost:3001 \ CLUSTER_SECRET=dev-secret-change-me \ DEV_VIRTUAL_GPU_COUNT=2 \ npm run dev -w apps/backend # Terminal 3: Frontend (connects to leader) npm run dev -w apps/frontend ``` -------------------------------- ### Start Individual Workspaces Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/README.md Starts development servers for specific workspaces, such as the backend or frontend. ```bash # Start individual workspaces npm run dev -w apps/backend npm run dev -w apps/frontend ``` -------------------------------- ### Install and Serve Controller API with Swagger UI Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/contracts/README.md Install the swagger-ui-watcher tool globally and then use it to serve the controller API specification locally. ```bash npm install -g swagger-ui-watcher swagger-ui-watcher controller-api.yaml ``` -------------------------------- ### Install React Data View Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/components/data-display/README.md Install the @patternfly/react-data-view package using npm. ```bash npm install @patternfly/react-data-view ``` -------------------------------- ### Verify Inference Simulator Installation Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Check if the inference simulator has been installed correctly by running its help command. ```bash llm-d-inference-sim --help ``` -------------------------------- ### Install and Serve Proxy API with Swagger UI Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/contracts/README.md Install the swagger-ui-watcher tool globally and then use it to serve the proxy API specification locally. ```bash npm install -g swagger-ui-watcher swagger-ui-watcher proxy-api.yaml ``` -------------------------------- ### Start Backend with Virtual GPUs Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Use this command to start the backend with a specified number of virtual GPUs. This is useful for testing multi-GPU features when you only have a single physical GPU. ```bash # Start backend with 2 virtual GPUs DEV_VIRTUAL_GPU_COUNT=2 npm run dev -w apps/backend # In another terminal npm run dev -w apps/frontend ``` -------------------------------- ### Sardeenz Configuration File Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/deployment.md Example configuration for the Sardeenz application, covering server, authentication, GPU, model, logging, and metrics settings. ```yaml server: port: 3000 # Unified API port routingOverheadTarget: 50 # ms (p95) for proxy routing auth: enabled: true provider: oauth issuerUrl: https://oauth-openshift.apps.your-cluster.com k8sApiUrl: https://api.your-cluster.com:6443 clientId: sardeenz gpu: memoryReserve: 2.0 # GB maxModels: 5 models: path: /models preloadOnStartup: [] # Model IDs to preload logging: level: info format: json metrics: enabled: true port: 9090 ``` -------------------------------- ### PatternFly React Repository Structure Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/resources/external-links.md Illustrates the directory structure within the patternfly-react repository, highlighting locations for component examples and specialized packages. Useful for locating source code and usage examples. ```bash patternfly-react/ ├── packages/react-core/src/components/ │ ├── Button/examples/ │ ├── Table/examples/ │ ├── Dropdown/examples/ │ └── [ComponentName]/examples/ ├── packages/react-table/src/components/ └── packages/react-charts/src/components/ ``` -------------------------------- ### Install PatternFly Component Groups Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/component-groups/README.md Install the @patternfly/react-component-groups package using npm. ```bash npm install @patternfly/react-component-groups ``` -------------------------------- ### Install All Workspace Dependencies Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/quickstart.md Install all project dependencies for the root workspace and its sub-workspaces (backend, frontend). ```bash npm install ``` -------------------------------- ### Start Single-Pod Backend Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/testing.md Run the backend in single-pod mode using npm. This command starts the development server for the backend application. ```bash INFERENCE_BACKEND=inference-sim npm run dev -w apps/backend ``` -------------------------------- ### Check Node.js and npm Installation Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/troubleshooting/common-issues.md Verify if Node.js and npm are installed and accessible in your system's PATH. ```bash # Check if Node.js is installed node --version npm --version ``` -------------------------------- ### Start Multi-Pod Cluster Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/testing.md Set up and start a multi-pod cluster for the inference backend. This involves setting environment variables for port, GPU count, memory, and cluster peers. ```bash export SECRET=$(openssl rand -hex 32) # Terminal 1 PORT=3001 INFERENCE_BACKEND=inference-sim DEV_VIRTUAL_GPU_COUNT=2 \ SIM_GPU_MEMORY_GB=24 CLUSTER_PEERS=localhost:3001,localhost:3002 \ CLUSTER_SECRET=$SECRET npm run dev -w apps/backend # Terminal 2 PORT=3002 INFERENCE_BACKEND=inference-sim DEV_VIRTUAL_GPU_COUNT=2 \ SIM_GPU_MEMORY_GB=24 CLUSTER_PEERS=localhost:3001,localhost:3002 \ CLUSTER_SECRET=$SECRET npm run dev -w apps/backend ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/setup/quick-start.md Install all project dependencies or only those for the frontend. This includes PatternFly 6, React, Vite, TypeScript, and ESLint. ```bash # From project root, install all dependencies npm install # Or install only frontend dependencies cd frontend && npm install ``` -------------------------------- ### Start Frontend-Only Development Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Starts the frontend development server when only the frontend is needed, without any backend services. ```bash npm run dev -w apps/frontend ``` -------------------------------- ### Start Frontend Development Server Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/setup/development-environment.md Use these commands to start the Vite development server. You can run them from the project root or navigate to the frontend directory first. ```bash # Start frontend development server npm run dev:frontend # Or from frontend directory cd frontend && npm run dev # Stop server Ctrl+C ``` -------------------------------- ### Install PatternFly Packages Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/troubleshooting/common-issues.md Install necessary PatternFly React packages in your frontend project. Navigate to the 'frontend' directory before running this command. ```bash cd frontend npm install @patternfly/react-core @patternfly/react-table @patternfly/react-icons ``` -------------------------------- ### Get Benchmark Details Response Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md Example JSON response for a successful GET request to retrieve benchmark details. ```json { "benchmark": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "SmolLM Performance Test", "status": "completed", "mode": "isolated", "kvcached_enabled": true, "created_at": "2025-11-29T12:00:00Z", "completed_at": "2025-11-29T12:02:30Z", "total_requests": 20, "successful_requests": 20, "failed_requests": 0, "duration_seconds": 149.5, "scenarios": [ { "id": "scenario-uuid", "instance_id": "smollm2-135m-abc123", "routing_mode": "direct", "model_path": "HuggingFaceTB/SmolLM2-135M-Instruct", "model_name": "SmolLM2-135M-Instruct", "input_tokens": 100, "output_tokens": 50, "concurrency": 4, "status": "completed", "metrics": { "ttft_avg": 45.2, "ttft_p50": 42.1, "ttft_p90": 68.3, "ttft_p95": 78.5, "ttft_p99": 95.2, "tps_avg": 156.8, "tps_p50": 158.2, "tps_p90": 142.3, "tps_p95": 138.5, "e2e_avg": 320.5, "e2e_p50": 315.2, "e2e_p90": 385.3, "e2e_p95": 412.1, "e2e_p99": 478.5, "goodput_count": 18, "goodput_percent": 90.0, "requests_per_second": 12.5, "tokens_per_second_total": 1960.0, "total_requests": 20, "successful_requests": 20, "failed_requests": 0 } } ] } } ``` -------------------------------- ### Install Kubernetes Client Node Dependency Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/004-school-orchestration/tasks.md Installs the @kubernetes/client-node package for the backend application. This is a setup task for cluster support. ```bash npm install @kubernetes/client-node -w apps/backend ``` -------------------------------- ### Parallel Package and Plugin Tasks (Foundational Phase) Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/tasks.md Demonstrates how multiple package initialization tasks and backend plugin creation tasks can be executed concurrently during the foundational phase. ```bash # All shared package tasks can run together: Task T008: "Initialize packages/types workspace" Task T009: "Initialize packages/utils workspace" Task T010: "Initialize packages/contracts workspace" # All backend plugins can run together: Task T029: "Create OAuth 2.0 plugin in apps/backend/src/plugins/auth.ts" Task T030: "Create Swagger plugin in apps/backend/src/plugins/swagger.ts" Task T031: "Create Prometheus metrics plugin in apps/backend/src/plugins/metrics.ts" ``` -------------------------------- ### Install Node.js Dependencies and Build Packages Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Installs Node.js dependencies and builds specific packages within the project. This is part of the initial setup for the development environment. ```bash # Install Node.js dependencies npm install npm run build -w packages/types && npm run build -w packages/utils ``` -------------------------------- ### Get Model Details Request Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md Example cURL command to fetch details for a specific model instance. ```bash curl -H "Authorization: Bearer $TOKEN" \ http://localhost:3000/api/v1/models/llama-3-2-1b-abc123 ``` -------------------------------- ### Run Development with Custom Simulator Configuration Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Start the development server with custom inference simulator settings, such as specifying the number of GPUs and their memory. ```bash # Single GPU with 48 GB INFERENCE_BACKEND=inference-sim DEV_VIRTUAL_GPU_COUNT=1 SIM_GPU_MEMORY_GB=48 npm run dev ``` -------------------------------- ### List Memory Profiles Response Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md Example JSON response for a successful GET request to list memory profiles. ```json { "profiles": [ { "id": "profile-uuid", "profile_name": "SmolLM2-135M @ 2048 tokens", "model_path": "HuggingFaceTB/SmolLM2-135M-Instruct", "max_tokens": 2048, "total_gpu_memory_gib": 1.22, "weights_memory_gib": 0.27, "cuda_graphs_gib": 0.55, "overhead_memory_gib": 0.4, "kv_cache_available_gib": 5.7, "gpu_name": "NVIDIA GeForce RTX 4090", "gpu_total_memory_gib": 24.0, "created_at": "2025-11-29T12:00:00Z" } ], "total": 1 } ``` -------------------------------- ### Complete kvctl Session Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/kvcached/cli-tools.md Demonstrates a typical session using kvctl, including launching the tool, listing IPC segments, setting memory limits, verifying limits, and exiting. ```bash # Launch kvctl $ kvctl # List current IPC segments kvctl> list IPC Name Total Used Free Limit Usage ───────────────────────────────────────────────────────────────── VLLM_MODEL_1 8.0 GB 0.0 GB 8.0 GB None 0% VLLM_MODEL_2 6.0 GB 0.0 GB 6.0 GB None 0% # Set memory limits kvctl> limit VLLM_MODEL_1 6G Memory limit for VLLM_MODEL_1 set to 6.0 GB kvctl> limit-percent VLLM_MODEL_2 25 Memory limit for VLLM_MODEL_2 set to 25% (6.0 GB of 24 GB total) # Verify limits kvctl> list IPC Name Total Used Free Limit Usage ───────────────────────────────────────────────────────────────── VLLM_MODEL_1 8.0 GB 0.0 GB 8.0 GB 6.0 GB 0% VLLM_MODEL_2 6.0 GB 0.0 GB 6.0 GB 6.0 GB 0% # Watch memory usage in real-time kvctl> watch -n 2 (Refreshes every 2 seconds...) # Exit kvctl> exit ``` -------------------------------- ### Build Inference Simulator from Source Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Build the inference simulator binary from source if you have Go 1.22+ installed. This binary mimics vLLM without requiring GPU hardware. ```bash git clone https://github.com/llm-d/llm-d-inference-sim.git cd llm-d-inference-sim make build sudo cp bin/llm-d-inference-sim /usr/local/bin/ ``` -------------------------------- ### Get Model Instance Logs Request Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md Example cURL command to fetch the last 50 log lines for a model instance. ```bash curl -H "Authorization: Bearer $TOKEN" \ "http://localhost:3000/api/v1/models/instances/abc123/logs?lines=50" ``` -------------------------------- ### Start Backend in Production Mode Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/quickstart.md Run the backend application in production mode. ```bash # Start backend in production mode npm run start -w apps/backend ``` -------------------------------- ### vLLM Health Check Endpoint Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/architecture.md Basic HTTP GET request to check the health status of a vLLM instance. Assumes a local setup. ```bash GET http://localhost:{port}/health ``` -------------------------------- ### Get System Metrics Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md Retrieve system-wide metrics in Prometheus format, including the total number of active, starting, stopping, and failed model instances. ```prometheus # HELP sardeenz_models_total Total number of model instances # TYPE sardeenz_models_total gauge sardeenz_models_total{status="active"} 2 sardeenz_models_total{status="starting"} 0 sardeenz_models_total{status="stopping"} 0 sardeenz_models_total{status="failed"} 0 # HELP sardeenz_gpu_memory_used_bytes GPU memory used by all models ``` -------------------------------- ### Get Memory Usage Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/testing.md Retrieve the current memory usage of the inference backend. Two endpoints are available: one for general usage and another for multi-GPU setups. ```bash curl http://localhost:3000/api/memory/usage ``` ```bash curl http://localhost:3000/api/memory/usage/multi-gpu ``` -------------------------------- ### Fetch Memory Usage with curl Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md This command-line example shows how to make a GET request to the memory usage endpoint using curl. Ensure you replace $TOKEN with your actual authentication token. ```bash curl -H "Authorization: Bearer $TOKEN" \ http://localhost:3000/api/memory/usage ``` -------------------------------- ### Deploy to Production Environment Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/deployment/README.md Apply the Kustomize configuration for the production environment to deploy the Sardeenz application. ```bash oc apply -k deployment/overlays/prod/ ``` -------------------------------- ### Set Up DndContext and Drag Overlay Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/003-model-move/plan.md Wrap the application content with `DndContext` to enable drag-and-drop functionality. Use `DragOverlay` to render a visual representation of the item being dragged. This snippet shows the basic setup and event handlers for drag start and end. ```typescript import { DndContext, DragOverlay, pointerWithin } from '@dnd-kit/core' // Wrap content in DndContext {/* GPU groups */} {activeDragModel && } // Handle drop function handleDragEnd(event: DragEndEvent) { const { active, over } = event if (!over) return const model = active.data.current?.model const targetGpuIds = over.data.current?.gpuIds if (model && targetGpuIds) { // Open move dialog with preselected target setMoveDialogModel(model) setPreselectedGpuIds(targetGpuIds) setIsMoveDialogOpen(true) } } ``` -------------------------------- ### Pod Initialization and Configuration Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/architecture-visualizer.html Details the initial startup of a Sardeenz pod, including environment variables for pod name and cluster configuration. ```text POD_NAME=sardeenz-0 CLUSTER_SECRET=<32+ char secret> CLUSTER_EXPECTED_PODS=2 ``` -------------------------------- ### Complete Workflow Example in TypeScript Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/api-guide.md This TypeScript code demonstrates a full workflow using the Controller and Proxy APIs. It covers loading a model, waiting for it to become ready, making an inference request, and finally unloading the model. Ensure you have axios installed and the AUTH_TOKEN environment variable set. ```typescript import axios from 'axios' const CONTROLLER_URL = 'http://localhost:3000/api/v1' const PROXY_URL = 'http://localhost:8000/v1' const AUTH_TOKEN = process.env.AUTH_TOKEN async function completeWorkflow() { // 1. Load a model console.log('Loading model...') const loadResponse = await axios.post( `${CONTROLLER_URL}/models/load`, { modelPath: '/models/meta-llama/Llama-3.2-1B', displayName: 'Llama 3.2 1B', gpuMemoryLimit: 4.0, port: 5001, }, { headers: { Authorization: `Bearer ${AUTH_TOKEN}` }, } ) const modelId = loadResponse.data.id const instanceId = loadResponse.data.instance_id console.log(`Model loading started: ${instanceId}`) // 2. Wait for model to be ready // Option A: Polling (shown below) // Option B: Subscribe to SSE at /api/v1/models/instances/{instance_id}/events console.log('Waiting for model to be ready...') let status = 'starting' while (status === 'starting') { await new Promise((resolve) => setTimeout(resolve, 5000)) const statusResponse = await axios.get(`${CONTROLLER_URL}/models/${modelId}`, { headers: { Authorization: `Bearer ${AUTH_TOKEN}` }, }) status = statusResponse.data.status console.log(`Status: ${status}`) } if (status !== 'active') { throw new Error(`Model failed to start: ${status}`) } // 3. Make inference request console.log('Making inference request...') const inferenceResponse = await axios.post(`${PROXY_URL}/chat/completions`, { model: modelId, messages: [{ role: 'user', content: 'What is 2+2?' }], }) console.log('Response:', inferenceResponse.data.choices[0].message.content) // 4. Unload model console.log('Unloading model...') await axios.post( `${CONTROLLER_URL}/models/${modelId}/unload`, {}, { headers: { Authorization: `Bearer ${AUTH_TOKEN}` } } ) console.log('Workflow complete!') } completeWorkflow().catch(console.error) ``` -------------------------------- ### Install PatternFly Codemods Globally Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/guidelines/migration-codemods.md Installs the `@patternfly/pf-codemods` package globally after clearing the npm cache to ensure a clean installation. ```bash # Clear npm cache npm cache clean --force # Install globally npm install -g @patternfly/pf-codemods ``` -------------------------------- ### Parallel Tasks Example: Phase 1 Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/tasks.md Illustrates tasks that can run in parallel after foundational configuration is complete. These tasks involve creating utility files and their corresponding unit tests. ```bash # After T001 (config) completes, launch all 4 tasks in parallel: Task T002: "Create ModelMemoryEstimator in apps/backend/src/utils/model-memory-estimator.ts" Task T003: "Create SimGpuTracker in apps/backend/src/utils/sim-gpu-tracker.ts" Task T004: "Unit tests for ModelMemoryEstimator in apps/backend/tests/unit/model-memory-estimator.test.ts" Task T005: "Unit tests for SimGpuTracker in apps/backend/tests/unit/sim-gpu-tracker.test.ts" ``` -------------------------------- ### Install uv package manager Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/dev-setup.md Installs the uv package manager using a script. Ensure to source your bashrc or restart your terminal after installation. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh source ~/.bashrc # or restart terminal ``` -------------------------------- ### kvtop Display Layout Example Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/kvcached/cli-tools.md Illustrates the typical display layout of the kvtop tool, showing overall GPU memory usage and individual IPC segment details with memory bars. ```text ┌─────────────────────────────────────────────────────────────────┐ │ kvcached Memory Monitor │ │ Refresh: 1.0s | Press q to quit │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ GPU Memory: 24.0 GB Total | 15.2 GB Used | 8.8 GB Free (63%) │ │ ████████████████████████████████████░░░░░░░░░░░░░░░░░░ │ │ │ ├─────────────────────────────────────────────────────────────────┤ │ IPC Segment: VLLM_MODEL_1 │ │ Memory: 8.0 GB Total | 4.5 GB Used | 3.5 GB Free (56%) │ │ Limit: 6.0 GB │ │ ████████████████████████████████████░░░░░░░░░░░░░░░ │ │ │ │ IPC Segment: VLLM_MODEL_2 │ │ Memory: 6.0 GB Total | 2.1 GB Used | 3.9 GB Free (35%) │ │ Limit: 6.0 GB │ │ ████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ │ │ │ IPC Segment: VLLM_MODEL_3 │ │ Memory: 4.0 GB Total | 0.8 GB Used | 3.2 GB Free (20%) │ │ Limit: None │ │ ████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ │ │ └─────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Install PatternFly Charts Dependencies Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/pf6-guide/troubleshooting/common-issues.md Install the necessary dependencies for using PatternFly charts. This command installs both the core charts library and the Victory charting engine. ```bash npm install @patternfly/react-charts victory ``` -------------------------------- ### Configure Backend Environment Variables Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/quickstart.md Create the .env file for the backend service, setting essential configurations for the server, OAuth, vLLM, and logging. ```bash # Create environment file for backend cat > apps/backend/.env < ) ``` -------------------------------- ### ModelInstance State Transitions Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/001-multi-model-platform/data-model.md Illustrates the lifecycle state transitions for a ModelInstance, from starting to active, stopping, and potential failure. ```text ┌─────────┐ │ starting│──┐ └─────────┘ │ │ Health check succeeds ▼ ┌────────┐ │ active │ └────────┘ │ │ Unload requested ▼ ┌──────────┐ │ stopping │ └──────────┘ │ │ Process exits ▼ (deleted) ┌─────────┐ │ starting│ └─────────┘ │ │ Health check fails or process crashes ▼ ┌────────┐ │ failed │ └────────┘ ``` -------------------------------- ### Metrics API: Get All Metrics Function Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/frontend-api-client.md Retrieves resource metrics for all models by sending a GET request to the '/metrics' endpoint. ```tsx getAllMetrics: () => apiClient.get('/metrics'), ``` -------------------------------- ### Metrics API: Get System Metrics Function Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/docs/development/frontend-api-client.md Retrieves system-wide metrics by sending a GET request to the '/metrics/system' endpoint. ```tsx getSystemMetrics: () => apiClient.get('/metrics/system'), ``` -------------------------------- ### Project Structure: Documentation Source: https://github.com/rh-aiservices-bu/sardeenz/blob/main/specs/006-inference-sim-backend/plan.md Overview of the documentation files for the inference simulator backend feature. ```text specs/006-inference-sim-backend/ ├── plan.md # This file ├── research.md # Phase 0 output ├── data-model.md # Phase 1 output ├── quickstart.md # Phase 1 output └── tasks.md # Phase 2 output (via /speckit.tasks) ```