ci: use zerto-docs's load-balanced Ollama GPU pool on the Gitea host
Match the OLLAMA_URLS pattern from zerto-docs-rag so every docs MCP build fans out across the same two GPU-pinned Ollama containers on 192.168.0.2 (:11435 Titan X, :11436 1080 Ti). The host's primary Ollama on :11434 is left alone for OpenWebUI. rag.embeddings now reads OLLAMA_URLS (plural CSV) preferentially with fallback to OLLAMA_URL, defaulting to http://192.168.0.2:11434 — same shape as zerto's embeddings.py. The OllamaEmbeddings class already round-robins per batch, so both GPUs run in parallel during the chroma rebuild. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+21
-4
@@ -3,8 +3,15 @@
|
||||
Swappable: implement the same `embedding_function()` interface returning
|
||||
a Chroma `EmbeddingFunction` and the rest of the pipeline doesn't care.
|
||||
|
||||
Defaults (override via env):
|
||||
OLLAMA_URL one or more comma-separated URLs (load-balanced)
|
||||
Env-configurable (matches the zerto-docs-rag pattern so the same Gitea
|
||||
runner + GPU-pinned Ollama containers can serve every docs MCP build):
|
||||
|
||||
OLLAMA_URLS comma-separated list, load-balanced round-robin per batch.
|
||||
Preferred — set in the CI workflow to fan out across two
|
||||
GPU-pinned Ollama containers on the Gitea host.
|
||||
OLLAMA_URL single endpoint, fallback when OLLAMA_URLS is unset.
|
||||
Default http://192.168.0.2:11434 (the host where the GPUs
|
||||
live in Justin's lab).
|
||||
EMBED_MODEL model name; default 'nomic-embed-text'
|
||||
EMBED_DIM expected embedding dim; default 768 (nomic-embed-text)
|
||||
"""
|
||||
@@ -19,8 +26,18 @@ from chromadb import EmbeddingFunction, Documents, Embeddings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
OLLAMA_URLS = [u.strip() for u in os.environ.get("OLLAMA_URL",
|
||||
"http://localhost:11434").split(",") if u.strip()]
|
||||
DEFAULT_OLLAMA_URL = "http://192.168.0.2:11434"
|
||||
|
||||
|
||||
def _resolve_urls() -> list[str]:
|
||||
raw = os.environ.get("OLLAMA_URLS", "").strip()
|
||||
if raw:
|
||||
return [u.strip().rstrip("/") for u in raw.split(",") if u.strip()]
|
||||
single = os.environ.get("OLLAMA_URL", DEFAULT_OLLAMA_URL).strip().rstrip("/")
|
||||
return [single]
|
||||
|
||||
|
||||
OLLAMA_URLS = _resolve_urls()
|
||||
EMBED_MODEL = os.environ.get("EMBED_MODEL", "nomic-embed-text")
|
||||
EMBED_DIM = int(os.environ.get("EMBED_DIM", "768"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user