feat: beta deploys all services with pipeline toggle defaulting to OFF

- pipelineEnabled: true in beta so all pods run (Kargo happy)
- PIPELINE_DEFAULT_OFF=true in beta config — scheduler initializes
  the Redis toggle to OFF on first boot
- Shared Ollama (10.1.1.12:2701) between beta and paper
- Flip pipeline ON from the UI when testing, OFF when done
- Optimistic UI update for the toggle button
This commit is contained in:
Celes Renata
2026-04-21 03:54:00 +00:00
parent 66e8caa10f
commit 5d0635a291
3 changed files with 24 additions and 4 deletions
+7 -1
View File
@@ -537,7 +537,13 @@ export function usePipelineToggle() {
const qc = useQueryClient(); const qc = useQueryClient();
return useMutation({ return useMutation({
mutationFn: (enabled: boolean) => apiPost<{ pipeline_enabled: boolean }>('query', '/api/ops/pipeline/toggle', { enabled }), mutationFn: (enabled: boolean) => apiPost<{ pipeline_enabled: boolean }>('query', '/api/ops/pipeline/toggle', { enabled }),
onSuccess: () => qc.invalidateQueries({ queryKey: ['pipeline-health'] }), onMutate: async (enabled) => {
await qc.cancelQueries({ queryKey: ['pipeline-health'] });
qc.setQueriesData<Record<string, unknown>>({ queryKey: ['pipeline-health'] }, (old) =>
old ? { ...old, pipeline_enabled: enabled } : old,
);
},
onSettled: () => qc.invalidateQueries({ queryKey: ['pipeline-health'] }),
}); });
} }
+8 -3
View File
@@ -6,10 +6,12 @@
image: image:
tag: latest tag: latest
## Pipeline OFF by default — beta is for API testing only ## Pipeline ON — all services deployed so Kargo sees them as healthy.
pipelineEnabled: false ## The Redis-based pipeline toggle defaults to OFF so the scheduler
## won't enqueue jobs unless you flip it on from the UI.
pipelineEnabled: true
## Single replica for API services ## Single replica for all services in beta
services: services:
queryApi: queryApi:
replicas: 1 replicas: 1
@@ -34,6 +36,9 @@ config:
MINIO_ENDPOINT: "minio.minio-service.svc.cluster.local:80" MINIO_ENDPOINT: "minio.minio-service.svc.cluster.local:80"
MINIO_SECURE: "false" MINIO_SECURE: "false"
BROKER_MODE: "paper" BROKER_MODE: "paper"
OLLAMA_BASE_URL: "http://10.1.1.12:2701"
MARKET_DATA_BASE_URL: "https://api.polygon.io"
PIPELINE_DEFAULT_OFF: "true"
## Blank out all secrets so beta never talks to external APIs ## Blank out all secrets so beta never talks to external APIs
secrets: secrets:
+9
View File
@@ -9,6 +9,7 @@ Requirements: 2.1, 2.2, 2.3, 2.4, 2.5
import asyncio import asyncio
import json import json
import logging import logging
import os
from datetime import datetime, timezone from datetime import datetime, timezone
from typing import Any, Optional from typing import Any, Optional
@@ -501,6 +502,14 @@ async def main() -> None:
logger.info("Scheduler started (tick=%ds)", SCHEDULER_TICK) logger.info("Scheduler started (tick=%ds)", SCHEDULER_TICK)
pipeline_key = f"{PREFIX}:pipeline:enabled" pipeline_key = f"{PREFIX}:pipeline:enabled"
# If PIPELINE_DEFAULT_OFF is set, initialize the toggle to OFF on first boot
# (only if the key doesn't already exist — preserves manual overrides)
if os.getenv("PIPELINE_DEFAULT_OFF", "").lower() in ("1", "true", "yes"):
created = await rds.set(pipeline_key, "0", nx=True)
if created:
logger.info("Pipeline toggle initialized to OFF (PIPELINE_DEFAULT_OFF=true)")
recovery_counter = 0 recovery_counter = 0
retry_counter = 0 retry_counter = 0
cleanup_counter = 0 cleanup_counter = 0