Skip to content

Operations

Container ready

Worker deployment

Run the Python processor as a supervised, long-lived container that claims queued jobs through the web API.

Requirements

  • Network access to the web API and every configured model provider.
  • FFmpeg and Python 3.13+, or the included container image.
  • The same WORKER_API_TOKEN used by the web app.
  • A host that keeps the container running and restarts it after failure.
  • A persistent volume for downloaded transcription models.

Build the worker image

docker build -f docker/worker-hosted.Dockerfile -t opencontext-worker .
WORKER_API_URL=https://your-app.example
WORKER_API_TOKEN=<same secret as the web app>
WORKER_ID=oc-worker-prod-1
WORKER_CONCURRENCY=1
WORKER_SHUTDOWN_GRACE_SECONDS=120
WORKER_JOB_TIMEOUT_SECONDS=900
HF_HOME=/models

Mount a persistent volume at /models. Configure the host to restart the container on failure and give it at least 130 seconds to stop. The hosted image runs as UID 10001 and receives SIGTERM directly.

For a zero-cost public-repository fallback, the checked-in GitHub Actions relay keeps a scheduled worker alive for 15 minutes while the next five-minute run waits in a serialized concurrency group. It claims queued work within the worker's three-second idle poll and caches the Whisper model between runs. It remains subject to GitHub scheduling and acceptable-use limits and is not a replacement for dedicated-host restart evidence.

Shutdown behavior

On SIGTERM or SIGINT, the supervisor stops making new claims and waits up to the configured grace period for current work. If work exceeds that period, the host terminates the process and the job lease expires for a later retry.

The worker renews each claimed job's lease every minute. A process that disappears stops renewing; the queued job becomes available after the five-minute lease expires. Stage state and stored artifacts remain authoritative, and a resumed worker does not re-report completed stages. The current resume path can re-derive local stage inputs needed by downstream stages.

A job that exceeds WORKER_JOB_TIMEOUT_SECONDS (900 seconds by default) is failed with a specific timeout. Set the container host's CPU and memory quotas to match the provider configuration; those quotas remain host policy.

An idle worker reports a separate process heartbeat. The authenticated /api/ops/alerts check alerts when work is waiting without a recent worker, when the oldest queue entry or a running job crosses its threshold, and when a job recently ended as failed or partial. Set OPS_API_TOKEN on the web app and checker; set ALERT_WEBHOOK_URL and optional ALERT_WEBHOOK_SECRET on the checker host to send HMAC-SHA256 signed JSON webhook notifications without media, prompts, or credentials.

Input and runtime bounds

BoundValue
Video duration30 minutes
Video500 MB
Audio100 MB, 30 minutes
PDF50 MB, 30 pages
Image25 MB per image
Image-set job10 images
Provider 429 handlingModel cooldown + fallback, then queue deferral
Provider-limited queue budget40 bounded attempts
Worker shutdownWORKER_SHUTDOWN_GRACE_SECONDS
Worker CPU / memorySet by the host container policy

Provider configuration

TRANSCRIPTION_PROVIDER=faster_whisper
TRANSCRIPTION_MODEL=base
WORKER_DEVICE=auto
WHISPER_COMPUTE_TYPE=auto
VISION_PROVIDER=openai_compatible
VISION_MODEL=<vision-capable model>
FRAME_SAMPLING_MODE=hybrid
SCENE_CHANGE_THRESHOLD=0.25
CONTEXT_COMPRESSION_MODE=none
CONTEXT_MAX_TOKENS=0
OCR_PROVIDER=vision
TEXT_PROVIDER=template
OPENAI_BASE_URL=<OpenAI-compatible base URL>
OPENAI_API_KEY=<provider key>

For NVIDIA CUDA hosts, build docker/worker.gpu.Dockerfile and run with --gpus all (WORKER_DEVICE=cuda, WHISPER_COMPUTE_TYPE=float16). Enable CONTEXT_COMPRESSION_MODE=compact (or aggressive) and optional OPENCONTEXT_PLUGINS=module:Plugin to reduce token budgets or customize extracted frames and output. The worker supports Faster Whisper, OpenAI-compatible audio, and Ollama providers. Provider credentials stay on the worker host. See the deployment status for what is currently verified.