gpu4agents 0.13.0__tar.gz → 0.14.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.claude-plugin/plugin.json +1 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.cursor-plugin/plugin.json +1 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/workflows/ci.yml +9 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/CHANGELOG.md +19 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/INSTALL.md +1 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/PKG-INFO +12 -1
- gpu4agents-0.14.0/QUEUE.md +217 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/README.md +5 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/ACCEPTANCE.md +14 -4
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/CONFIG.md +29 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/INTEGRATION.md +16 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/LIFECYCLE.md +6 -0
- gpu4agents-0.14.0/docs/QUEUE_BACKENDS.md +74 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/USAGE.md +12 -0
- gpu4agents-0.14.0/docs/handoff/2026-11-12-queue-mode-field-run.md +35 -0
- gpu4agents-0.14.0/docs/superpowers/plans/2026-11-12-queue-mode.md +489 -0
- gpu4agents-0.14.0/docs/superpowers/specs/2026-11-12-queue-mode-design.md +257 -0
- gpu4agents-0.14.0/examples/queue-smoke/.env.example +5 -0
- gpu4agents-0.14.0/examples/queue-smoke/.gitignore +3 -0
- gpu4agents-0.14.0/examples/queue-smoke/gpu.yaml +43 -0
- gpu4agents-0.14.0/examples/queue-smoke/job/gpujob.yaml +3 -0
- gpu4agents-0.14.0/examples/queue-smoke/job/matmul.py +26 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu.example.yaml +25 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/__init__.py +1 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/agent/mcp.py +109 -0
- {gpu4agents-0.13.0/skills/gpu4agents → gpu4agents-0.14.0/gpu4agents/agent/skill}/SKILL.md +9 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/_common.py +7 -2
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/account.py +8 -3
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/main.py +5 -1
- gpu4agents-0.14.0/gpu4agents/cli/queue.py +408 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/timer.py +126 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/beacon.py +3 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/config.py +102 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/engine.py +29 -4
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/events.py +30 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/job.py +29 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/policy.py +10 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/sweep.py +141 -3
- gpu4agents-0.14.0/gpu4agents/queue/__init__.py +1 -0
- gpu4agents-0.14.0/gpu4agents/queue/api.py +520 -0
- gpu4agents-0.14.0/gpu4agents/queue/audit.py +487 -0
- gpu4agents-0.14.0/gpu4agents/queue/backend.py +120 -0
- gpu4agents-0.14.0/gpu4agents/queue/backends/__init__.py +1 -0
- gpu4agents-0.14.0/gpu4agents/queue/backends/local.py +336 -0
- gpu4agents-0.14.0/gpu4agents/queue/backends/redis.py +500 -0
- gpu4agents-0.14.0/gpu4agents/queue/coordinator.py +1860 -0
- gpu4agents-0.14.0/gpu4agents/queue/models.py +121 -0
- gpu4agents-0.14.0/gpu4agents/queue/observe.py +129 -0
- gpu4agents-0.14.0/gpu4agents/queue/outputs.py +428 -0
- gpu4agents-0.14.0/gpu4agents/queue/pool.py +1013 -0
- gpu4agents-0.14.0/gpu4agents/queue/pool_types.py +40 -0
- gpu4agents-0.14.0/gpu4agents/queue/preflight.py +121 -0
- gpu4agents-0.14.0/gpu4agents/queue/scaler.py +85 -0
- gpu4agents-0.14.0/gpu4agents/queue/spend.py +94 -0
- gpu4agents-0.14.0/gpu4agents/queue/testing.py +270 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/agent_body.py +24 -14
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/builder.py +2 -5
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/jobs_ext.py +101 -4
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/install.sh +2 -2
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/pyproject.toml +4 -2
- {gpu4agents-0.13.0/gpu4agents/agent/skill → gpu4agents-0.14.0/skills/gpu4agents}/SKILL.md +9 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/conftest.py +30 -0
- gpu4agents-0.14.0/tests/queue_fakes.py +414 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_agent.py +1 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_config.py +44 -0
- gpu4agents-0.14.0/tests/test_docs.py +88 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_engine.py +55 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_job_outputs.py +5 -5
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_jobs.py +91 -27
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_policy.py +26 -0
- gpu4agents-0.14.0/tests/test_queue_audit.py +491 -0
- gpu4agents-0.14.0/tests/test_queue_backend_local.py +78 -0
- gpu4agents-0.14.0/tests/test_queue_backend_redis.py +169 -0
- gpu4agents-0.14.0/tests/test_queue_backend_redis_config.py +80 -0
- gpu4agents-0.14.0/tests/test_queue_cli.py +673 -0
- gpu4agents-0.14.0/tests/test_queue_coordinator.py +1410 -0
- gpu4agents-0.14.0/tests/test_queue_models.py +49 -0
- gpu4agents-0.14.0/tests/test_queue_observe.py +49 -0
- gpu4agents-0.14.0/tests/test_queue_outputs.py +394 -0
- gpu4agents-0.14.0/tests/test_queue_pool.py +669 -0
- gpu4agents-0.14.0/tests/test_queue_preflight.py +108 -0
- gpu4agents-0.14.0/tests/test_queue_scaler.py +86 -0
- gpu4agents-0.14.0/tests/test_queue_spend.py +63 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_serve.py +3 -1
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_sweep.py +161 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_watchdog.py +45 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.claude-plugin/marketplace.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.env.example +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/dependabot.yml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/pull_request_template.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.github/workflows/release.yml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/.gitignore +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/CODE_OF_CONDUCT.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/CONTRIBUTING.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/JOBS.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/LICENSE +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/PROVIDERS.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/SECURITY.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/SERVING.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/ADDING_A_PROVIDER.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/AGENTS.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/CHOOSING_A_MODEL.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/assets/banner.png +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/assets/jambu-logo.jpg +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/docs/handoff/2026-11-11-video-validation-fixes.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/experiment.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/gpu.yaml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/README.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/package-lock.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/package.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/agent.ts +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/index.ts +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/tools/weather-tool.ts +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/mastra-agent/tsconfig.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/README.md +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/package-lock.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/package.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/src/gpu.ts +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/src/index.ts +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/examples/typescript-client/tsconfig.json +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu.models.yaml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu.yaml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/__main__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/agent/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/agent/install.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/agent/jobs.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/agent.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/inspect.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/job.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/lifecycle.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/providers.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/run.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/setup.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/status.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/cli/validate.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/credentials.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/durations.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/errors.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/execution.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/health.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/hosts.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/model_inspect.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/models.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/paths.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/state.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/core/tool_parsers.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/base.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/gpus.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/http.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/client.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/config.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/mapper.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/provider.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/registry.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/client.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/config.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/mapper.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/provider.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/scaffold.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/client.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/config.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/mapper.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/provider.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/runtime/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/runtime/base.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/runtime/service.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/runtime/vllm.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/install.sh +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/server.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/gpujob.yaml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/server.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/jambu_gpu/__init__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/jambu_gpu/__main__.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/skills/gpu4agents/agents/openai.yaml +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/fakes.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_cli.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_engine_sessions.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_field_run.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_integration.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_lambda_provider.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_model_inspect.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_paths.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_runpod_provider.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_runtime_vllm.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_state.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_vast_mapper.py +0 -0
- {gpu4agents-0.13.0 → gpu4agents-0.14.0}/tests/test_vast_provider.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gpu4agents",
|
|
3
3
|
"description": "Your agent rents the GPU it needs, serves a model on it and runs the experiment. You pay only while it works.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Gabriel Lima",
|
|
7
7
|
"url": "https://www.linkedin.com/in/joaogabriellima"
|
|
@@ -15,13 +15,21 @@ jobs:
|
|
|
15
15
|
fail-fast: false
|
|
16
16
|
matrix:
|
|
17
17
|
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
services:
|
|
19
|
+
redis:
|
|
20
|
+
image: redis:7
|
|
21
|
+
ports: ["6379:6379"]
|
|
22
|
+
options: >-
|
|
23
|
+
--health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10
|
|
24
|
+
env:
|
|
25
|
+
GPU_TEST_REDIS_URL: redis://localhost:6379/15
|
|
18
26
|
steps:
|
|
19
27
|
- uses: actions/checkout@v4
|
|
20
28
|
- uses: actions/setup-python@v5
|
|
21
29
|
with:
|
|
22
30
|
python-version: ${{ matrix.python }}
|
|
23
31
|
cache: pip
|
|
24
|
-
- run: pip install -e ".[dev]"
|
|
32
|
+
- run: pip install -e ".[dev,queue-redis]"
|
|
25
33
|
- run: python -m pytest -q
|
|
26
34
|
|
|
27
35
|
build:
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.14.0] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Queue mode** for applications that send jobs over the day. A `queue:` section in `gpu.yaml` turns it on; a project without one behaves exactly as 0.13.0. Full guide: [QUEUE.md](QUEUE.md).
|
|
9
|
+
- `gpu queue submit | status | ls | cancel | retry | pull | pause | resume | drain | audit | stats | run | install-service`, a Python API (`gpu4agents.queue.api`) and the MCP tools `gpu_queue_submit`, `gpu_queue_status`, `gpu_queue_cancel`, `gpu_queue_pull` and `gpu_queue_control`. Every control action is recorded with who did it.
|
|
10
|
+
- A **coordinator** (`gpu queue run`) opens machines when the oldest queued job has waited `scale_up_after`, within `max_machines` and `max_usd_per_hour`, checks each machine's health, runs jobs back to back on a warm machine, and retires machines that have nothing to do. A second coordinator waits as a standby.
|
|
11
|
+
- **Retries**: a job whose machine vanished, went silent or failed its health check runs again on another machine, up to `max_attempts`, then fails with every attempt's reason. A retried attempt finds the earlier attempt's outputs in `$JAMBU_PREVIOUS_OUTPUT_DIR`.
|
|
12
|
+
- **Deadlines instead of lifetimes**: the coordinator moves each machine's deadline in its own watchdog (`POST /deadline`) to cover the job it took. With the coordinator dead, the pool drains to zero by itself.
|
|
13
|
+
- **Preflight** per job (`timeout`, and the new optional `max_cost_usd` and `min_vram_gb` in `gpujob.yaml`), or your own `module:function`.
|
|
14
|
+
- **Backends**: `local` (SQLite) and `redis` (Redis 5 or newer, one node), and outputs to a local directory or S3, each checked against a sha256 manifest. Others plug in through [the contract](docs/QUEUE_BACKENDS.md); `QueueBackendContract` is the suite a backend runs. Addresses and keys come from `GPU_QUEUE_URL`, `GPU_OUTPUTS_URL` and `AWS_*` in the environment or `~/.gpu/credentials`, never `gpu.yaml`. `redis` and `boto3` are optional extras (`queue-redis`, `queue-s3`).
|
|
15
|
+
- **An auditor** (`gpu queue audit`) checks eight invariants (I1 to I8) and repairs what is safe; events, metrics and alert thresholds are in QUEUE.md.
|
|
16
|
+
- `gpu sweep` and the sweep timer cover pool machines, so a dead coordinator still ends in a destroy with finished jobs' outputs saved, and a pool machine is never taken for an orphan.
|
|
17
|
+
- Acceptance guarantees 24 to 31, one for each thing queue mode must never do (docs/ACCEPTANCE.md).
|
|
18
|
+
|
|
19
|
+
### Notes
|
|
20
|
+
- Set `queue.namespace` when you use Redis: without it the keyspace follows the config fingerprint and changes when the runtime part of `gpu.yaml` changes.
|
|
21
|
+
- After a takeover by a coordinator whose pool is different, a job on a machine it cannot see waits until that attempt's deadline plus a grace before it runs again.
|
|
22
|
+
- Redis Cluster is not supported.
|
|
23
|
+
|
|
5
24
|
## [0.13.0] - 2026-11-11
|
|
6
25
|
|
|
7
26
|
The first real, filmed use of 0.12.0 (an agent making images with SDXL and running a CUDA benchmark) found these. Each is fixed and tested.
|
|
@@ -20,7 +20,7 @@ curl -fsSL https://raw.githubusercontent.com/jambuai/gpu4agents/main/install.sh
|
|
|
20
20
|
|
|
21
21
|
The script needs only `curl` (Linux or macOS; on Windows, run it inside WSL). It installs [uv](https://docs.astral.sh/uv/) if missing, uses it to install the `gpu4agents` package with a Python it downloads by itself, and then installs the skill and registers the `gpu` MCP server for your runtime. It does not ask for or read any key.
|
|
22
22
|
|
|
23
|
-
Check: `~/.local/bin/gpu --version` prints 0.
|
|
23
|
+
Check: `~/.local/bin/gpu --version` prints 0.13.0 or later.
|
|
24
24
|
|
|
25
25
|
For the rest of this session, call the command by its full path, `~/.local/bin/gpu`. Your shell may define `gpu` as an alias: Oh My Zsh's git plugin, on by default, makes `gpu` mean `git push upstream`, and an alias wins over the command, so plain `gpu setup` could run git instead. The installer removes that alias for new shells and says so; tell the user if it did. The same command is also installed as `gpu4agents`.
|
|
26
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: gpu4agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.14.0
|
|
4
4
|
Summary: GPU for Agents: your coding agent rents the GPU it needs, on its own. You pay only while it works.
|
|
5
5
|
Project-URL: Homepage, https://gpu4agents.jambu.ai
|
|
6
6
|
Project-URL: Documentation, https://github.com/jambuai/gpu4agents/tree/main/docs
|
|
@@ -34,9 +34,15 @@ Requires-Dist: pyyaml>=6.0.1
|
|
|
34
34
|
Requires-Dist: rich>=13.7.0
|
|
35
35
|
Requires-Dist: typer>=0.12.0
|
|
36
36
|
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: fakeredis[lua]>=2.23; extra == 'dev'
|
|
38
|
+
Requires-Dist: moto[s3]>=5; extra == 'dev'
|
|
37
39
|
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
38
40
|
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
39
41
|
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
42
|
+
Provides-Extra: queue-redis
|
|
43
|
+
Requires-Dist: redis>=5; extra == 'queue-redis'
|
|
44
|
+
Provides-Extra: queue-s3
|
|
45
|
+
Requires-Dist: boto3>=1.34; extra == 'queue-s3'
|
|
40
46
|
Description-Content-Type: text/markdown
|
|
41
47
|
|
|
42
48
|
<p align="center">
|
|
@@ -149,6 +155,10 @@ Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai
|
|
|
149
155
|
|
|
150
156
|
[JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
|
|
151
157
|
|
|
158
|
+
## Queue mode
|
|
159
|
+
|
|
160
|
+
For an application that sends jobs over the day, `gpu queue submit` puts a job directory in a queue and a coordinator (`gpu queue run`) opens and closes machines for it, retries a job on another machine when one dies, and keeps its verified outputs, within the machine and hourly-spend caps you set. It works with any provider, and the queue can be a local file or Redis. See [QUEUE.md](QUEUE.md).
|
|
161
|
+
|
|
152
162
|
## Serve any model
|
|
153
163
|
|
|
154
164
|
Give `gpu` a Hugging Face model id and it serves it behind the OpenAI API shapes, whatever the model does. It reads the model card: chat and vision-language models run on vLLM; image, voice, transcription, embedding and other pipeline models run on gpu's own server. Any OpenAI client then works unchanged.
|
|
@@ -218,6 +228,7 @@ A full example is [`gpu.example.yaml`](gpu.example.yaml). `gpu ls` shows every m
|
|
|
218
228
|
- [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
|
|
219
229
|
- [Integrating into an application (any language)](docs/INTEGRATION.md)
|
|
220
230
|
- [Running your own code as a job](JOBS.md)
|
|
231
|
+
- [Queue mode: jobs on a pool of GPUs](QUEUE.md)
|
|
221
232
|
- [Commands, workloads, and agents](docs/USAGE.md)
|
|
222
233
|
- [Every config field](docs/CONFIG.md)
|
|
223
234
|
- [Choosing a model](docs/CHOOSING_A_MODEL.md)
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Queue mode: jobs on a pool of GPUs
|
|
2
|
+
|
|
3
|
+
Agent mode rents one machine for one conversation. Queue mode is for an application that sends jobs over the day: you submit a job directory, a coordinator opens and closes machines as the queue grows and empties, runs the job on one of them, runs it again somewhere else if the machine dies, and keeps the outputs. Any GPU provider works; the pool is rented from the same `gpu.yaml`, through the same provider contract.
|
|
4
|
+
|
|
5
|
+
A project without a `queue:` section behaves exactly as before. Writing a job is unchanged: it is a directory with `gpujob.yaml`, as [jobs.md](https://gpu4agents.jambu.ai/jobs.md) describes. It gains two optional fields, `max_cost_usd` and `min_vram_gb`.
|
|
6
|
+
|
|
7
|
+
Two guarantees from agent mode carry over. A machine with nothing to do for `idle_timeout` (15 minutes) ends, by the same rule as today. And the coordinator is allowed to die: every machine keeps its own watchdog and a hard deadline, so a pool with no coordinator drains to zero by itself.
|
|
8
|
+
|
|
9
|
+
## Contents
|
|
10
|
+
|
|
11
|
+
- [Quickstart](#quickstart)
|
|
12
|
+
- [The pieces](#the-pieces)
|
|
13
|
+
- [Configuration](#configuration)
|
|
14
|
+
- [Credentials](#credentials)
|
|
15
|
+
- [Submitting and following jobs](#submitting-and-following-jobs)
|
|
16
|
+
- [How a job runs](#how-a-job-runs)
|
|
17
|
+
- [Controls: pause, resume, drain](#controls-pause-resume-drain)
|
|
18
|
+
- [Running the coordinator](#running-the-coordinator)
|
|
19
|
+
- [Observing it: events, metrics, the auditor](#observing-it)
|
|
20
|
+
- [Alerts](#alerts)
|
|
21
|
+
- [What can go wrong](#what-can-go-wrong)
|
|
22
|
+
- [Limits of this version](#limits-of-this-version)
|
|
23
|
+
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
One machine, one host, nothing to install beyond gpu4agents. The local queue is a SQLite file in the project, and outputs land in `gpu-outputs/`.
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
# gpu.yaml
|
|
30
|
+
gpu_runtime:
|
|
31
|
+
version: 1
|
|
32
|
+
model: {id: Qwen/Qwen2.5-7B-Instruct} # or any model; jobs may use the server over loopback
|
|
33
|
+
compute: {gpu: {min_vram_gb: 24}}
|
|
34
|
+
queue:
|
|
35
|
+
max_machines: 2
|
|
36
|
+
max_usd_per_hour: 2.00
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
gpu queue submit ./my-job # prints the job id at once; nothing is rented yet
|
|
41
|
+
gpu queue run # the coordinator: opens machines, runs jobs (leave it running)
|
|
42
|
+
gpu queue status # queue counts, pool machines and what they cost per hour
|
|
43
|
+
gpu queue status JOB_ID
|
|
44
|
+
gpu queue pull JOB_ID # verified outputs into gpu-outputs/JOB_ID/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Starting `gpu queue run` rents GPUs and spends money. Decide the caps first (`max_machines`, `max_usd_per_hour`, and each job's `timeout` and `max_cost_usd`).
|
|
48
|
+
|
|
49
|
+
## The pieces
|
|
50
|
+
|
|
51
|
+
| Piece | What it is |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| Queue | Where jobs wait. Behind a backend contract. Built in: `local` (SQLite, one host) and `redis` (several hosts share it). Any other queue plugs in through [the contract](https://github.com/jambuai/gpu4agents/blob/main/docs/QUEUE_BACKENDS.md). |
|
|
54
|
+
| Output store | Where job bundles and results live. Built in: `local` (a directory) and `s3` (any S3-compatible bucket). Plugs in the same way. |
|
|
55
|
+
| Coordinator | `gpu queue run`. One process per queue holds a lease; a second one waits as a standby and takes over when the lease expires. Any number of processes may submit. |
|
|
56
|
+
| Pool | The machines, one per slot, labeled `jambu-<name>-<slot>-<fp6>`. They grow when jobs wait and shrink when machines have nothing to do. |
|
|
57
|
+
| Preflight | Runs when a job is claimed. Sets the job's limits (time, cost) and refuses a job that cannot run, with the reason. |
|
|
58
|
+
| Auditor | Checks the queue's guarantees (invariants I1 to I8) and repairs what it safely can. |
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
`gpu_runtime.queue` turns queue mode on. Every field and its default is in [docs/CONFIG.md](https://github.com/jambuai/gpu4agents/blob/main/docs/CONFIG.md#queue). The ones to decide first:
|
|
63
|
+
|
|
64
|
+
| Field | Default | What it controls |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `backend` | `local` | `local`, `redis`, or `module:factory` for your own |
|
|
67
|
+
| `outputs` | `local` | `local`, `s3`, or `module:factory` |
|
|
68
|
+
| `namespace` | none | The name of the keyspace on a shared backend |
|
|
69
|
+
| `min_machines` | `0` | Machines kept on with an empty queue (they still time out when idle, see [Controls](#controls-pause-resume-drain)) |
|
|
70
|
+
| `max_machines` | `1` | The most machines at once |
|
|
71
|
+
| `max_usd_per_hour` | none | Cap on what the whole pool bills per hour; blocks opening new machines |
|
|
72
|
+
| `scale_up_after` | `30s` | A machine is opened when the oldest queued job has waited this long |
|
|
73
|
+
| `jobs_per_machine` | `1` | Jobs a machine runs at once |
|
|
74
|
+
| `max_attempts` | `3` | Runs per job before it is failed with every attempt's reason |
|
|
75
|
+
| `unresponsive_after` | `5m` | How long a silent machine is waited for before it is destroyed and its jobs requeued |
|
|
76
|
+
| `max_machine_lifetime` | none | Optional hard ceiling on a machine's age (a warm machine is otherwise never replaced just for being old) |
|
|
77
|
+
| `health_check` | built in | Checked before a machine's first job and between jobs |
|
|
78
|
+
| `defaults` | `timeout: 1h` | Limits for a job that sets none |
|
|
79
|
+
|
|
80
|
+
Set `queue.namespace` when you use Redis. Without it the keyspace is named after the config fingerprint, so it changes when the runtime part of `gpu.yaml` changes, and the new coordinator would look at an empty queue. A name you chose (or the `GPU_QUEUE_NAMESPACE` environment variable) keeps the same keyspace across edits. It is not a secret.
|
|
81
|
+
|
|
82
|
+
The health check is the GPU being visible and a small CUDA operation succeeding. A project may set its own `health_check.command`. That command must not write job outputs: anything it writes under the job outputs counts as activity and holds the idle shutdown.
|
|
83
|
+
|
|
84
|
+
## Credentials
|
|
85
|
+
|
|
86
|
+
Addresses and keys never go in `gpu.yaml` (a URL there is a config error). They come from the environment or `~/.gpu/credentials`, like provider keys:
|
|
87
|
+
|
|
88
|
+
| Name | Used for |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `GPU_QUEUE_URL` | the Redis queue (`redis://` or `rediss://`); logged with the password removed |
|
|
91
|
+
| `GPU_OUTPUTS_URL` | the S3 store, `s3://bucket/prefix` |
|
|
92
|
+
| `AWS_*` | the S3 store's keys and endpoint (`AWS_ENDPOINT_URL` for a non-AWS store), the standard boto3 names |
|
|
93
|
+
| `GPU_QUEUE_NAMESPACE` | optional namespace when `queue.namespace` is not set |
|
|
94
|
+
| `GPU_QUEUE_SUBMITTER` | who is recorded as having submitted or controlled (default `user@host`) |
|
|
95
|
+
|
|
96
|
+
The provider's key never reaches a job, the queue, an output store, an event or a metric. A service started by systemd or launchd does not get your shell's environment, so put the credentials in `~/.gpu/credentials` for it.
|
|
97
|
+
|
|
98
|
+
The Redis and S3 clients are optional extras: `pip install "gpu4agents[queue-redis]"` and `"gpu4agents[queue-s3]"`. Importing gpu4agents without them works.
|
|
99
|
+
|
|
100
|
+
## Submitting and following jobs
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
gpu queue submit DIR [--key KEY] [--env NAME=VALUE ...]
|
|
104
|
+
gpu queue status [JOB]
|
|
105
|
+
gpu queue ls [--state STATE]
|
|
106
|
+
gpu queue cancel JOB
|
|
107
|
+
gpu queue retry JOB
|
|
108
|
+
gpu queue pull JOB [--to DIR]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- `submit` packs DIR (honouring `exclude`), stores the bundle and returns the job id at once. A bad job (no `run`, a bundle over 2 GB, a `timeout` that does not parse) is rejected before anything is stored. A paused queue still takes the job and says so.
|
|
112
|
+
- `--key` makes a submit idempotent: the same key never queues twice, however many replicas retry it.
|
|
113
|
+
- Job ids are at most 60 characters. `--env` values reach the job but are redacted (shown as `***`) in every status output and never written to the audit trail or the events.
|
|
114
|
+
- Job states: `queued`, `claimed`, `running`, `delivering`, `succeeded`, `failed`, `cancelled`. The last three are final. A job always ends in one of them, with the reason; never "unknown".
|
|
115
|
+
- `cancel` is immediate for a queued job. For a running one the coordinator stops it on its machine and keeps the outputs written so far.
|
|
116
|
+
- `retry` queues a failed job again; it keeps its attempts.
|
|
117
|
+
- `pull` verifies the outputs against their sha256 manifest before it hands them over.
|
|
118
|
+
|
|
119
|
+
From Python, an application does not need to shell out:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from gpu4agents.queue import api
|
|
123
|
+
job_id = api.submit("train/", key="train-2026-11-12") # idempotent on the key
|
|
124
|
+
info = api.wait(job_id, timeout_s=3600)
|
|
125
|
+
path = api.outputs(job_id)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Agents use the MCP tools `gpu_queue_submit`, `gpu_queue_status`, `gpu_queue_cancel`, `gpu_queue_pull` and `gpu_queue_control`. They never start the coordinator: that rents GPUs and is the user's decision.
|
|
129
|
+
|
|
130
|
+
## How a job runs
|
|
131
|
+
|
|
132
|
+
1. The coordinator claims the oldest queued job. The claim is a lease: nobody else sees the job until it expires or the job is settled.
|
|
133
|
+
2. The preflight decides the job's limits: its `timeout`, its `max_cost_usd` and `min_vram_gb`, with the project's `queue.defaults` filling what it leaves out. A job that cannot run (it needs more VRAM than the pool's card, or its cost limit is below what its timeout costs at the pool's price) fails at once with the reason and rents nothing. A project can name its own preflight (`queue.preflight: module:function`) to decide per job.
|
|
134
|
+
3. A machine that passed the health check takes the job. The coordinator moves that machine's deadline in its watchdog to cover the job's timeout plus a margin. While work keeps arriving the deadline keeps moving, and a warm machine runs job after job without being set up again. If the coordinator dies nobody moves it: the machine finishes what it has and ends at its deadline at the latest, or after `idle_timeout` with nothing running, whichever comes first.
|
|
135
|
+
4. When the job ends, the coordinator fetches its outputs, stores them in the output store with a sha256 manifest, verifies them, and only then settles the job as `succeeded`. Nothing on the machine is deleted before that.
|
|
136
|
+
|
|
137
|
+
When a machine disappears, stops answering for `unresponsive_after`, or fails the health check right after a job, the job goes back to the queue and runs on another machine, up to `max_attempts`. A job that exits non-zero while the machine is healthy is the job's fault and is not retried automatically (`gpu queue retry` does it by hand). Every attempt's outcome is recorded: `succeeded`, `job_failed`, `timeout`, `machine_lost`, `unhealthy`, `unresponsive`, `preflight_rejected`, `cancelled`, `delivery_failed`, `drained`, `not_started`.
|
|
138
|
+
|
|
139
|
+
A retried attempt starts from scratch, but its `run` is prefixed with `export JAMBU_PREVIOUS_OUTPUT_DIR=...`: the verified outputs of the earlier attempt are there, so a job that writes checkpoints can resume. The job decides whether to use them. The same directory is described in [jobs.md](https://gpu4agents.jambu.ai/jobs.md).
|
|
140
|
+
|
|
141
|
+
Outputs that could not be stored (the store was down) stay under `<state_dir>/queue/work/` on the coordinator's host and are retried; the auditor reports any that are an hour old (I8). A store outage never retires machines: outputs the machine still holds are kept, not given up on.
|
|
142
|
+
|
|
143
|
+
## Controls: pause, resume, drain
|
|
144
|
+
|
|
145
|
+
| Command | What it does |
|
|
146
|
+
| --- | --- |
|
|
147
|
+
| `gpu queue pause` | Stops new claims. Running jobs go on. Idle machines, `min_machines` included, time out by the normal idle rule, so a paused queue lets the pool fall to zero |
|
|
148
|
+
| `gpu queue resume` | Starts jobs again, and drops a drain that was requested |
|
|
149
|
+
| `gpu queue drain` | Pauses, and lets the machines idle out and stop |
|
|
150
|
+
| `gpu queue drain --now` | Also sends running jobs back to the queue and retires every machine at once, pulling outputs first. Those jobs are requeued, not failed, and a drained attempt does not count toward `max_attempts` |
|
|
151
|
+
|
|
152
|
+
`drain --now` through MCP needs `confirm=true` and the user's yes. Every control action is recorded in the audit trail with who did it, and a coordinator that holds the lease does the work itself; without one, the command does it directly.
|
|
153
|
+
|
|
154
|
+
## Running the coordinator
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
gpu queue run [--once] [--metrics-port PORT]
|
|
158
|
+
gpu queue install-service [--uninstall]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`run` stops on Ctrl-C or SIGTERM; machines keep their deadlines. `--once` runs one tick and exits. `--metrics-port` serves `/metrics` on `127.0.0.1` only. `install-service` writes a user service (systemd on Linux, launchd on macOS) for this project and prints the command that enables it; it does not enable it. A systemd timer and a service do not inherit `devrun` or your shell: put credentials in `~/.gpu/credentials`.
|
|
162
|
+
|
|
163
|
+
The coordinator renews its lease from a heartbeat thread, so a long upload does not lose it. Leases use the backend's clock, never the caller's. The coordinator lease is 15 s at the default tick (3 ticks, never less); a job's lease is 60 s (12 ticks, never less).
|
|
164
|
+
|
|
165
|
+
A coordinator that takes over (after a crash or an expired lease) looks for every job its predecessor left in flight. A run its machine lists is adopted, never started twice. When the predecessor died after it recorded an attempt but before the machine got the job, the new coordinator asks that machine's job runner: if the runner has no record of the run, no upload in progress and no code waiting for a start, the run never started. Before the job goes back to the queue, the coordinator fences that remote id on the machine: the runner records it as refused and deletes any code it holds for it, so an upload or a start that the old coordinator still sends late gets a 409 and never runs (an old coordinator that sees the refusal drops the job). If the run did start in the meantime, the runner says so and the run is adopted instead. Once the fence is acknowledged, the job goes back to the queue at once with the outcome `not_started`. Like a drained attempt, it does not count toward `max_attempts`, and the next attempt gets a new remote id; a job whose runs fail to start more than twice `max_attempts` times fails with every reason listed. If the machine lists its jobs but the fence does not get through, nothing is requeued early: the job waits as long as an upload could take, as before. If code for the run is still arriving, the coordinator waits for it. While it waits it sends the machine a keepalive every tick, so the machine does not reach `idle_timeout` with that run still undecided.
|
|
166
|
+
|
|
167
|
+
After a takeover by a host whose pool is different (another computer, a new state directory), a job running on a machine the new coordinator cannot see waits until that attempt's deadline plus a grace before it runs again, because destroying or reaching the machine is the only way to be sure the first run is over.
|
|
168
|
+
|
|
169
|
+
`gpu sweep` and the sweep timer know about pool machines: with a dead coordinator, a stopped machine still ends in a destroy, with finished jobs' outputs saved first, and a pool machine is never treated as an orphan.
|
|
170
|
+
|
|
171
|
+
## Observing it
|
|
172
|
+
|
|
173
|
+
Every decision is an event in `.gpu/logs/events.jsonl`; metrics are in `.gpu/queue/metrics.prom` and on `/metrics`; the auditor checks the guarantees. `gpu queue stats` shows the metrics as of the coordinator's last tick; `gpu queue audit [--repair]` runs the auditor (exit 1 while a violation remains).
|
|
174
|
+
|
|
175
|
+
| Concern | Events | Metrics | Invariant or alert |
|
|
176
|
+
| --- | --- | --- | --- |
|
|
177
|
+
| Coordinator | `coordinator_started`, `coordinator_lease_acquired`, `coordinator_lease_lost`, `coordinator_stopped` | `gpu_queue_coordinator_heartbeat_age_seconds`, `gpu_queue_lease_renew_failures_total` | I7 lease fresh |
|
|
178
|
+
| Machines | `pool_machine_requested`, `_ready`, `_unhealthy`, `_unresponsive`, `_gone`, `_retired` | `gpu_pool_machines{state}`, `gpu_pool_cold_start_seconds`, `gpu_pool_health_failures_total` | I4 no orphan machine |
|
|
179
|
+
| Deadlines | `pool_deadline_extended`, `instance_destroyed reason=deadline` | `gpu_pool_deadline_remaining_seconds{slot}` | remaining below 0 with a job running |
|
|
180
|
+
| Retries | `queue_job_retried`, `queue_job_dead` | `gpu_queue_attempts_total{outcome}`, `gpu_queue_retries_total{cause}` | retry rate |
|
|
181
|
+
| Ownership | `queue_job_claimed`, `queue_lease_expired`, `queue_stale_write_refused` | `gpu_queue_stale_writes_total` | I1 every running job is on a live machine; I2 no job on two machines |
|
|
182
|
+
| State | `queue_invariant_violated` | `gpu_queue_invariant_violations_total{code}` | any violation |
|
|
183
|
+
| Outputs | `queue_outputs_stored`, `queue_outputs_delivery_failed`, `queue_outputs_lost` | `gpu_queue_outputs_pending`, `gpu_queue_outputs_oldest_pending_seconds`, `gpu_queue_outputs_bytes_total` | I3 manifests verify; I8 outputs stored |
|
|
184
|
+
| Latency | `queue_job_submitted`, `queue_job_started`, `queue_job_succeeded`, `queue_job_failed` | `gpu_queue_depth`, `gpu_queue_oldest_queued_seconds`, `gpu_queue_job_wait_seconds`, `gpu_queue_job_run_seconds` | I6 no job past its deadline plus grace |
|
|
185
|
+
| Money | `pool_scale_decision`, `pool_cap_blocked`, `queue_preflight_rejected` | `gpu_pool_usd_per_hour`, `gpu_pool_spend_usd_total`, `gpu_queue_job_cost_usd` | I5 spend within `max_usd_per_hour` |
|
|
186
|
+
| Who and what | `queue_job_submitted` (submitted_by), `queue_control` (action, actor) | `gpu_queue_jobs_total{final_state}` | the audit trail is append-only |
|
|
187
|
+
| Control | `queue_control` | `gpu_queue_paused` | pause honored within one tick |
|
|
188
|
+
|
|
189
|
+
The invariants: I1 running job without a machine, I2 duplicate execution, I3 outputs unverified, I4 orphan machine, I5 spend over the cap, I6 job past its deadline, I7 stale coordinator, I8 outputs not stored.
|
|
190
|
+
|
|
191
|
+
## Alerts
|
|
192
|
+
|
|
193
|
+
Page someone when any of these holds:
|
|
194
|
+
|
|
195
|
+
- the coordinator heartbeat age is more than 3 ticks;
|
|
196
|
+
- any invariant violation (`gpu_queue_invariant_violations_total` rises, or `gpu queue audit` exits 1);
|
|
197
|
+
- the oldest pending output delivery is older than 10 minutes;
|
|
198
|
+
- the retry rate is above 20% over 1 hour (`gpu_queue_retries_total` leaves out attempts sent back by `drain --now` and runs that never started, which are not failures);
|
|
199
|
+
- the pool's spend is at or above 90% of `max_usd_per_hour`;
|
|
200
|
+
- the oldest queued job is older than 2 × `scale_up_after` plus the cold start p50 while `blocked_by` is set (the last `pool_scale_decision` says which cap: `max_machines`, `max_usd_per_hour`, `no_offer` or `backoff`).
|
|
201
|
+
|
|
202
|
+
## What can go wrong
|
|
203
|
+
|
|
204
|
+
| Symptom | What it means |
|
|
205
|
+
| --- | --- |
|
|
206
|
+
| Jobs stay queued and `blocked_by` is `no_offer` or `backoff` | The provider has no matching capacity. Jobs wait, they do not fail, and the opening of machines backs off up to 5 minutes |
|
|
207
|
+
| A job is `delivering` for a long time | The output store is unreachable or the manifest does not verify. Nothing is marked delivered; it retries. The machine's outputs are held |
|
|
208
|
+
| The queue looks empty after a `gpu.yaml` edit | The Redis keyspace followed the config fingerprint. Set `queue.namespace` |
|
|
209
|
+
| `gpu queue status` says no coordinator holds the lease | Start `gpu queue run` (or enable the service). Machines already running end by their deadlines |
|
|
210
|
+
| Exit 4 from a `gpu queue` command | The queue or its output store is unreachable; the message names it, without the password |
|
|
211
|
+
|
|
212
|
+
## Limits of this version
|
|
213
|
+
|
|
214
|
+
- Redis must be 5 or newer and a single node. Redis Cluster is not supported (its atomic steps are Lua scripts over several keys).
|
|
215
|
+
- One pool per project: one `gpu.yaml`, one provider, one kind of card. No priorities, schedules or job dependencies.
|
|
216
|
+
- It is for batch work, not for autoscaling a live model endpoint.
|
|
217
|
+
- There is no Jambu server. The queue and the store are ones you run or rent.
|
|
@@ -108,6 +108,10 @@ Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai
|
|
|
108
108
|
|
|
109
109
|
[JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
|
|
110
110
|
|
|
111
|
+
## Queue mode
|
|
112
|
+
|
|
113
|
+
For an application that sends jobs over the day, `gpu queue submit` puts a job directory in a queue and a coordinator (`gpu queue run`) opens and closes machines for it, retries a job on another machine when one dies, and keeps its verified outputs, within the machine and hourly-spend caps you set. It works with any provider, and the queue can be a local file or Redis. See [QUEUE.md](QUEUE.md).
|
|
114
|
+
|
|
111
115
|
## Serve any model
|
|
112
116
|
|
|
113
117
|
Give `gpu` a Hugging Face model id and it serves it behind the OpenAI API shapes, whatever the model does. It reads the model card: chat and vision-language models run on vLLM; image, voice, transcription, embedding and other pipeline models run on gpu's own server. Any OpenAI client then works unchanged.
|
|
@@ -177,6 +181,7 @@ A full example is [`gpu.example.yaml`](gpu.example.yaml). `gpu ls` shows every m
|
|
|
177
181
|
- [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
|
|
178
182
|
- [Integrating into an application (any language)](docs/INTEGRATION.md)
|
|
179
183
|
- [Running your own code as a job](JOBS.md)
|
|
184
|
+
- [Queue mode: jobs on a pool of GPUs](QUEUE.md)
|
|
180
185
|
- [Commands, workloads, and agents](docs/USAGE.md)
|
|
181
186
|
- [Every config field](docs/CONFIG.md)
|
|
182
187
|
- [Choosing a model](docs/CHOOSING_A_MODEL.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Acceptance criteria: where each one is implemented and tested
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Thirty-one guarantees, mapped to the code and the test that holds each one.
|
|
4
4
|
|
|
5
5
|
| # | Guarantee | Implementation | Test |
|
|
6
6
|
| --- | --- | --- | --- |
|
|
@@ -27,6 +27,14 @@ Twenty-three guarantees, mapped to the code and the test that holds each one.
|
|
|
27
27
|
| 21 | The card the user approved is the card rented, at no more than the price quoted | `gpu offers` remembers its offers in `.gpu/offers.json`; `gpu setup --offer ID` pins the card's name and caps the price at the quote, host retries included, and rents nothing if it is gone; every setup reports `rented`, `quoted` and `matches_quote` | `test_field_run.py::test_a_pinned_setup_never_falls_back_to_another_card`, `::test_a_pinned_setup_never_pays_more_than_the_quote`, `::test_a_pinned_host_retry_stays_on_the_quoted_card`, `::test_an_unpinned_setup_says_when_it_rented_something_else` |
|
|
28
28
|
| 22 | A machine that vanished leaves a reason | `Engine._why_missing` replays this project's rules on what was last known; when they called for a destroy, the reconcile records `instance_destroyed reason=<rule> by=watchdog inferred=true`, else `likely_reason: unknown`; setup brings the watchdog's own events home as soon as the machine is ready | `test_field_run.py::test_a_machine_gone_after_its_idle_timeout_is_recorded_as_the_watchdogs_doing`, `::test_a_machine_gone_while_in_use_is_not_blamed_on_the_watchdog`, `::test_setup_brings_the_watchdogs_own_events_home` |
|
|
29
29
|
| 23 | The GPU is sized for the peak and offers can be compared per job | `model_inspect.known_vram_floor` (SDXL 16/24 GB, FLUX 24/32 GB) raises `gpu init`'s default and makes `validate` warn; `gpu offers --for <minutes on an RTX 4090>` ranks by estimated job cost (`providers/gpus.py::relative_speed`) | `test_field_run.py::test_validate_warns_when_the_card_is_sized_for_the_weights_not_the_peak`, `::test_init_sizes_a_known_image_model_for_its_peak`, `::test_offers_for_a_job_rank_by_the_cost_of_the_whole_job` |
|
|
30
|
+
| 24 | Queue mode never leaves a GPU billing idle: the watchdog's idle rule is unchanged, a paused queue lets idle machines (`min_machines` too) time out, and a dead coordinator still ends in a destroy | `core/policy.py` (idle rule untouched, queued work counts as activity); `queue/pool.py` retires through the same engine; `core/sweep.py::guard_projects` guards pool slots and pulls finished jobs' outputs before a destroy | `test_policy.py::test_queued_workload_counts_as_activity`, `test_sweep.py::test_sweep_guards_pool_slots_of_a_registered_project`, `::test_sweep_pulls_a_pool_job_s_outputs_before_destroying`, `::test_stopped_billing_warning_counts_pool_machines`, `test_queue_coordinator.py::test_pause_stops_claims_but_not_running_jobs`, `::test_a_paused_queue_passes_no_min_machines_to_the_scaler` |
|
|
31
|
+
| 25 | A coordinator crash leaves no machine running: each machine has a hard deadline in its own watchdog that only the coordinator moves | `policy.REASON_DEADLINE`, `watchdog/agent_body.py` `/deadline`, `Pool.extend_deadline`; a restarted pool resets its deadlines | `test_policy.py::test_deadline_ends_a_machine_even_with_work_running`, `::test_a_lock_does_not_override_the_deadline`, `test_watchdog.py::test_deadline_route_refuses_moving_backwards`, `test_queue_pool.py::test_extend_deadline_reaches_the_watchdog`, `::test_a_restarted_pool_reloads_its_machines_and_resets_their_deadline`, `test_queue_coordinator.py::test_the_deadline_moves_with_each_job` |
|
|
32
|
+
| 26 | A warm, healthy machine is not replaced to reset a counter: jobs run back to back, the deadline moves with the work, and only `max_machine_lifetime` (off by default) caps age | `queue/coordinator.py` dispatch and deadline extension; `queue/scaler.py` | `test_queue_coordinator.py::test_jobs_run_back_to_back_on_one_warm_machine`, `::test_the_deadline_moves_with_each_job`, `test_engine.py::test_queue_mode_policy_drops_lifetime_and_session_budget` (a pool machine's only age cap is `max_machine_lifetime`; the project's `max_lifetime` and session budget do not apply), `test_config.py::test_queue_defaults_match_the_spec` (off by default) |
|
|
33
|
+
| 27 | No job is lost silently: every job ends `succeeded`, `failed` (with every attempt's reason) or `cancelled`, a lost machine requeues its job, and a run that never started goes back at once without using an attempt (up to twice `max_attempts` times) | `queue/coordinator.py` outcomes, `max_attempts`, recover (`start_pending`); `watchdog/jobs_ext.py` uploads in `GET /jobs`; `queue/audit.py` I1, I6, I7 | `test_queue_coordinator.py::test_a_lost_machine_requeues_the_job_on_another`, `::test_max_attempts_ends_in_failed_with_every_reason`, `::test_a_job_lost_with_its_coordinator_and_machine_is_requeued`, `::test_a_run_that_never_reached_its_machine_goes_back_at_once_without_using_an_attempt`, `::test_a_job_whose_runs_keep_not_starting_gives_up`, `test_jobs.py::test_the_job_list_says_which_uploads_never_started`, `test_queue_audit.py::test_i1_a_running_job_whose_machine_is_gone_is_requeued_machine_lost`, `::test_i6_a_job_running_past_its_deadline_is_cancelled_and_requeued_timeout` |
|
|
34
|
+
| 28 | A job never runs on two machines at once: claims are leases with fencing tokens, an already-started remote run is adopted, a run that never started is fenced on its machine (refused: a late upload or start gets a 409) before it is requeued, a dispatch checks it still holds the job between the upload and the start, and the auditor cancels a duplicate | `queue/backend.py` claim, renew and settle with a token; `queue/coordinator.py` adoption and `_fence`; `watchdog/jobs_ext.py` `POST /jobs/<id>/refuse`; `queue/audit.py` I2 | `test_queue_coordinator.py::test_crash_after_dispatch_adopts_the_running_job_instead_of_starting_it_twice`, `::test_a_stale_lease_write_is_dropped_not_retried`, `::test_a_dispatch_that_outlives_its_lease_cancels_its_run`, `::test_an_upload_that_outlives_its_lease_never_starts_the_run`, `::test_an_upload_still_arriving_is_waited_for_with_its_machine_kept_awake`, `::test_a_late_start_from_the_coordinator_that_lost_the_job_is_refused_and_never_runs`, `::test_a_fence_that_does_not_get_through_falls_back_to_the_timing_rules`, `::test_a_refused_record_is_never_adopted`, `test_jobs.py::test_a_refused_job_never_runs_and_a_started_one_is_returned`, `test_queue_pool.py::test_a_fenced_run_is_refused_on_dispatch_and_hidden_from_the_listing`, `test_queue_audit.py::test_i2_a_remote_run_the_queue_does_not_place_there_is_cancelled`, `test_queue_pool.py::test_dispatch_twice_returns_already_running` |
|
|
35
|
+
| 29 | Outputs are never deleted before they are verified and stored: a success is settled only after the sha256 manifest verifies, a failed store keeps the files, and a machine is not retired for a store outage | `queue/outputs.py` manifest and `verify`; `queue/coordinator.py` delivery and `queue/work/`; `queue/audit.py` I3, I8 | `test_queue_outputs.py::test_a_truncated_upload_fails_verification`, `test_queue_coordinator.py::test_delivery_failure_keeps_the_job_delivering_and_retries`, `::test_a_store_that_does_not_verify_keeps_the_job_delivering`, `::test_fetched_outputs_survive_a_crash_and_are_delivered`, `::test_a_store_outage_does_not_blame_the_machine`, `test_queue_audit.py::test_i8_fetched_outputs_not_stored_for_an_hour` |
|
|
36
|
+
| 30 | Spend stays within the caps the user set, even catching up on a long queue: the scaler counts everything the pool bills, `max_usd_per_hour` blocks opening, a job's cost limit is checked at preflight | `queue/scaler.py`, `queue/spend.py`, `queue/preflight.py`; `queue/audit.py` I5 | `test_queue_scaler.py::test_stops_at_the_spend_cap`, `::test_stops_at_max_machines`, `test_queue_spend.py::test_stopped_machines_count_their_disk`, `::test_held_machines_count_full_rate`, `test_queue_preflight.py::test_rejects_a_cost_limit_its_timeout_cannot_meet`, `test_queue_audit.py::test_i5_spend_over_the_cap_is_an_alert` |
|
|
37
|
+
| 31 | The queue contract is neither too narrow nor too loose: both built-in backends pass one conformance suite, and so does any third-party backend | `queue/testing.py::QueueBackendContract`; [QUEUE_BACKENDS.md](QUEUE_BACKENDS.md) | `test_queue_backend_local.py::TestLocalBackend` and `test_queue_backend_redis.py::TestRedisBackend` (both subclass the suite), `test_queue_backend_redis.py::test_lease_expiry_uses_the_server_clock` |
|
|
30
38
|
|
|
31
39
|
## Validated on real hardware
|
|
32
40
|
|
|
@@ -105,6 +113,8 @@ vLLM runtime, `setup`, `run`, `status`, `stop`, `destroy`, `lock`/`unlock`, idle
|
|
|
105
113
|
timeout, max lifetime, remote watchdog and structured logs are all present. On top
|
|
106
114
|
of that, `ls` and `sweep` handle orphan control across the account.
|
|
107
115
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
Added since the MVP: job queues and a machine pool (queue mode, 0.14.0, guarantees 24 to 31).
|
|
117
|
+
|
|
118
|
+
Deliberately not implemented: multi-GPU orchestration, Kubernetes, distributed
|
|
119
|
+
inference, provider optimization, automatic provider selection, web dashboard, sharing
|
|
120
|
+
one pool between projects, job priorities, schedules and dependencies.
|
|
@@ -255,6 +255,35 @@ Override once with `gpu setup --allow-cost-override`.
|
|
|
255
255
|
| `env` | `{}` | Extra environment variables for the workload. |
|
|
256
256
|
| `workdir` | project dir | Working directory for the command. |
|
|
257
257
|
|
|
258
|
+
## `queue`
|
|
259
|
+
|
|
260
|
+
Present means queue mode: a coordinator runs jobs on a pool of machines rented from this same file. Absent, the project behaves exactly as before. The full guide is [QUEUE.md](../QUEUE.md). Nothing here holds an address or a key: `GPU_QUEUE_URL`, `GPU_OUTPUTS_URL` and the `AWS_*` variables come from the environment or `~/.gpu/credentials`, and a URL in this section is a config error.
|
|
261
|
+
|
|
262
|
+
| Field | Default | Meaning |
|
|
263
|
+
| --- | --- | --- |
|
|
264
|
+
| `backend` | `local` | `local` (SQLite in the project), `redis` (Redis 5 or newer, one node, not Cluster) or `module:factory` ([QUEUE_BACKENDS.md](QUEUE_BACKENDS.md)). |
|
|
265
|
+
| `outputs` | `local` | Where bundles and results live: `local` (`gpu-outputs/`), `s3` or `module:factory`. |
|
|
266
|
+
| `namespace` | none | Keyspace name on a shared backend (`[A-Za-z0-9_.-]`, up to 64). Set it for Redis: without it the keyspace follows the config fingerprint and changes when the runtime part of the file changes. `GPU_QUEUE_NAMESPACE` is the fallback. |
|
|
267
|
+
| `min_machines` | `0` | Machines kept on with an empty queue. They still time out by `idle_timeout` while the queue is paused. |
|
|
268
|
+
| `max_machines` | `1` | The most machines at once. Not below `min_machines`. |
|
|
269
|
+
| `max_usd_per_hour` | none | Cap on the whole pool's bill per hour (running machines, stopped ones that still bill their disk, machines held for outputs). It blocks opening machines; it never stops one with a job on it. |
|
|
270
|
+
| `scale_up_after` | `30s` | Open a machine when the oldest queued job has waited this long. |
|
|
271
|
+
| `jobs_per_machine` | `1` | Jobs one machine runs at once. |
|
|
272
|
+
| `max_attempts` | `3` | Runs per job before it is failed with every attempt's reason. Drained attempts do not count. |
|
|
273
|
+
| `unresponsive_after` | `5m` | How long a silent machine is waited for before it is destroyed and its jobs requeued. |
|
|
274
|
+
| `max_machine_lifetime` | none | Optional hard ceiling on a machine's age. Off: a warm machine is never replaced for being old. |
|
|
275
|
+
| `tick` | `5s` | The coordinator's loop period. Leases are 3 ticks (at least 15 s) for the coordinator and 12 ticks (at least 60 s) for a job. |
|
|
276
|
+
| `preflight` | built in | `module:function` that returns a `PreflightResult` with the job's limits, or a reason to refuse. |
|
|
277
|
+
| `health_check.command` | built in | Replaces the built-in check (GPU visible, a small CUDA operation). It must not write job outputs: they would count as activity and hold the idle shutdown. |
|
|
278
|
+
| `health_check.min_free_vram_gb` | none | Free memory threshold. Off by default: a machine serving a model holds most of it. |
|
|
279
|
+
| `health_check.timeout` | `2m` | Time allowed for one check. |
|
|
280
|
+
| `health_check.between_jobs` | `true` | Check again between jobs. |
|
|
281
|
+
| `defaults.timeout` | `1h` | A job's timeout when its `gpujob.yaml` has none. |
|
|
282
|
+
| `defaults.max_cost_usd` | none | A job's cost limit when it has none. |
|
|
283
|
+
| `defaults.deadline_margin` | `10m` | Added to a job's timeout when the machine's deadline is moved. |
|
|
284
|
+
|
|
285
|
+
A job's `gpujob.yaml` gains two optional fields: `max_cost_usd` and `min_vram_gb`.
|
|
286
|
+
|
|
258
287
|
## Safety invariant
|
|
259
288
|
|
|
260
289
|
An instance may remain billable only while useful work is running, useful work is
|
|
@@ -103,7 +103,7 @@ gpu env --format dotenv > .env.gpu
|
|
|
103
103
|
| 1 | unexpected error | log stderr, retry later |
|
|
104
104
|
| 2 | config error (`gpu.yaml` invalid, or changed since setup) | fix the config; `setup --recreate` replaces a machine built from the old one |
|
|
105
105
|
| 3 | no instance / no endpoint (from `env`, `endpoint`) | call `setup` |
|
|
106
|
-
| 4 | provider API error | retry with backoff |
|
|
106
|
+
| 4 | provider API error, or the queue or its output store is unreachable (queue commands) | retry with backoff |
|
|
107
107
|
| 5 | provider authentication failed | fix `VAST_API_KEY` |
|
|
108
108
|
| 6 | no capacity matches the config | retry later, or relax `compute.gpu` / the budget |
|
|
109
109
|
| 7 | provisioning failed | retry; the failed machine was already destroyed |
|
|
@@ -202,6 +202,21 @@ def ask(prompt):
|
|
|
202
202
|
conn = ensure_gpu() # stopped while idle: restart it, then retry
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
+
### Python: queue mode
|
|
206
|
+
|
|
207
|
+
For jobs that arrive over the day, not one machine per conversation, `gpu4agents.queue.api` submits to the queue and follows a job without shelling out. It needs `queue:` in `gpu.yaml`; a coordinator (`gpu queue run`, a service you run) does the renting. See [QUEUE.md](../QUEUE.md).
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
from gpu4agents.queue import api
|
|
211
|
+
|
|
212
|
+
job_id = api.submit("train/", key="order-1234") # idempotent on the key
|
|
213
|
+
info = api.wait(job_id, timeout_s=3600) # a dict; "timed_out": true if still running
|
|
214
|
+
if info["state"] == "succeeded":
|
|
215
|
+
path = api.outputs(job_id) # verified outputs, gpu-outputs/<job>/
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`api.status`, `listing`, `cancel`, `retry`, `pause`, `resume`, `drain`, `audit_queue`, `stats` and `summary` match the `gpu queue` commands. Credentials (`GPU_QUEUE_URL`, `GPU_OUTPUTS_URL`, `AWS_*`) come from the environment or `~/.gpu/credentials`. An unreachable queue or store raises; handle it like exit code 4.
|
|
219
|
+
|
|
205
220
|
### Shell / curl
|
|
206
221
|
|
|
207
222
|
```bash
|
|
@@ -81,6 +81,12 @@ On the machine, the job runner marks a job's outputs saved once `GET /jobs/<id>/
|
|
|
81
81
|
|
|
82
82
|
On this computer, `gpu guard` and `gpu sweep` download the results of finished jobs into `gpu-outputs/<job id>/` while the machine runs, and before any automatic destroy. A stopped machine that still holds results, on a provider where a stopped machine bills and without `keep_disk`, is started, emptied and destroyed (reason `job_outputs_saved`); a failed attempt is retried after an hour and recorded as `job_outputs_kept`. `gpu job pull` starts a stopped machine too, and puts it back afterwards. `gpu destroy` downloads first and refuses when it cannot, unless `--discard-outputs`. `gpu status` lists the jobs whose results are only on the machine (`job_outputs_unsaved`).
|
|
83
83
|
|
|
84
|
+
## Queue mode: a deadline, not a lifetime
|
|
85
|
+
|
|
86
|
+
A pool machine has no fixed age. The coordinator gives its watchdog a **deadline** (`POST /deadline`, never moved backwards) that covers the job it just took, that job's `timeout` plus `queue.defaults.deadline_margin`, and moves it again with each job. The watchdog ends the machine at the deadline even with work running (reason `deadline`, which a lock does not override), or after `idle_timeout` with nothing running, whichever comes first. So a machine whose coordinator died finishes what it was given and goes; a warm machine with work keeps going. The deadline applies only when the coordinator sets one: a project without `queue:` has none.
|
|
87
|
+
|
|
88
|
+
When a machine ends, the same rule as for single jobs applies: outputs not yet downloaded are fetched first, or kept on a stopped disk, and `gpu sweep` saves them before any automatic destroy. See [QUEUE.md](../QUEUE.md).
|
|
89
|
+
|
|
84
90
|
## A second path
|
|
85
91
|
|
|
86
92
|
Run the same rule from anywhere that has API access:
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Writing a queue backend or an output store
|
|
2
|
+
|
|
3
|
+
Queue mode ([QUEUE.md](../QUEUE.md)) holds jobs in a queue and files in an output store. Both are contracts, so a company broker, a database you already run or another bucket can stand in for the built-ins (`local` SQLite and `redis`; `local` directory and `s3`). A backend is supported when it passes the same suite the built-ins pass.
|
|
4
|
+
|
|
5
|
+
Name yours in `gpu.yaml` as `module:factory`. The factory receives the project's `RuntimeConfig` and returns the object:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
gpu_runtime:
|
|
9
|
+
queue:
|
|
10
|
+
backend: acme_queue:create # def create(config) -> QueueBackend
|
|
11
|
+
outputs: acme_store:create # def create(config) -> OutputStore
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Addresses and keys do not go in `gpu.yaml`. Read them from the environment or through `gpu4agents.core.credentials.CredentialResolver`, and never print them.
|
|
15
|
+
|
|
16
|
+
## The queue backend
|
|
17
|
+
|
|
18
|
+
Subclass `gpu4agents.queue.backend.QueueBackend` (`queue/backend.py` has the signatures and the docstrings that are the specification). The shape:
|
|
19
|
+
|
|
20
|
+
| Group | Methods | The rule |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| Time | `now()` | Every lease and age uses this clock, never the caller's. Hosts with skewed clocks share one queue |
|
|
23
|
+
| Submit | `submit(job)` | Idempotent on `job.key`: a known key returns the existing job. A new job is stamped `submitted_at = now()`. Job ids are at most 60 characters |
|
|
24
|
+
| Claim | `claim(worker, lease_s, job_id=None)` | Atomic: oldest `QUEUED` job, invisible to other claims until its lease expires or it is settled. Returns nothing while paused. With `job_id`, claims exactly that job if it is queued, even while paused: a coordinator taking back a run already on a machine is not new work |
|
|
25
|
+
| Lease | `renew`, `update`, `requeue`, `settle` | A stale or expired token raises `LeaseLost` and writes nothing. `settle` is final. An expired claim goes back to `QUEUED`, or to `CANCELLED` when a cancel was requested |
|
|
26
|
+
| Control | `request_cancel`, `retry`, `set_paused`, `paused`, `request_drain`, `drain_requested`, `clear_drain` | Cancel of a queued job is immediate. `retry` takes a `FAILED` job back to `QUEUED`, keeping attempts. Each action is recorded with its actor, append-only |
|
|
27
|
+
| Read | `get`, `list(states, limit)`, `stats()` | `stats` gives counts by state and the age of the oldest queued job, which the scaler needs |
|
|
28
|
+
| Coordinator | `acquire_coordinator`, `renew_coordinator`, `release_coordinator`, `coordinator()` | One lease per queue. A second coordinator waits and takes over when it expires |
|
|
29
|
+
|
|
30
|
+
The job payload stays small: the bundle (the packed job directory) lives in the output store, and the job holds a reference (`bundle_ref`).
|
|
31
|
+
|
|
32
|
+
Redis notes for the built-in: Redis 5 or newer, a single node (replicas for failover are fine, Cluster is not: the atomic steps are Lua scripts over several keys). Replication in Redis is asynchronous, so a failover can lose a write the old primary had already acknowledged, such as a claim, a lease renewal or the record of a dispatch. The effect is a duplicate claim: the job is claimed again with the same attempt number, so its remote id is the same. If that dispatch reaches the machine that already has the run, the machine answers 409 and the run is adopted, not started twice. If the run never started there, the fence refuses it before the job goes back to the queue. If the second dispatch goes to another machine, both copies run until the auditor's next pass (I2, every 12 ticks) cancels the copy the queue does not place there. Without replicas or failover none of this happens. If you use them, keep failovers rare and expect a `queue_stale_write_refused` event or an I2 violation after one. The keyspace is `gpu4agents:<namespace>`, where the namespace is `queue.namespace`, else `GPU_QUEUE_NAMESPACE`, else a name from the config fingerprint (which changes when `gpu.yaml`'s runtime changes: set `queue.namespace`).
|
|
33
|
+
|
|
34
|
+
### Run the contract suite
|
|
35
|
+
|
|
36
|
+
`gpu4agents.queue.testing.QueueBackendContract` is the conformance suite. Subclass it in a test module and provide two fixtures: `backend`, and `clock`, an object whose `advance(seconds)` moves `backend.now()`. A backend therefore needs an injectable clock or offset for tests (the Redis backend adds an offset to the server's `TIME`).
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import pytest
|
|
40
|
+
from gpu4agents.queue.testing import QueueBackendContract, make_job
|
|
41
|
+
|
|
42
|
+
class FakeClock:
|
|
43
|
+
def __init__(self): self.t = 1000.0
|
|
44
|
+
def now(self): return self.t
|
|
45
|
+
def advance(self, s): self.t += s
|
|
46
|
+
|
|
47
|
+
@pytest.fixture
|
|
48
|
+
def clock(): return FakeClock()
|
|
49
|
+
|
|
50
|
+
@pytest.fixture
|
|
51
|
+
def backend(clock): return AcmeBackend(clock=clock.now)
|
|
52
|
+
|
|
53
|
+
class TestAcmeBackend(QueueBackendContract):
|
|
54
|
+
pass
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
It covers no double claim, lease expiry, stale tokens refused, idempotent submit, final states, cancel and retry, claiming a specific job. Both built-ins subclass it (`tests/test_queue_backend_local.py`, `tests/test_queue_backend_redis.py`).
|
|
58
|
+
|
|
59
|
+
## The output store
|
|
60
|
+
|
|
61
|
+
Subclass `gpu4agents.queue.outputs.OutputStore`:
|
|
62
|
+
|
|
63
|
+
| Method | What it does |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| `put_bundle(job_id, path) -> ref` | Store the packed job; return the reference the queue keeps |
|
|
66
|
+
| `get_bundle(ref, dest)` | Put it back for the machine |
|
|
67
|
+
| `delete_bundle(ref)` | Remove it (after a failed submit, or when the job is final). Must be safe to call twice |
|
|
68
|
+
| `put_outputs(job_id, attempt, src_dir, success=True) -> OutputRef` | Store a directory and a sha256 manifest of its files (`path`, `bytes`, `sha256`). Re-putting an attempt leaves no stale keys, and a failed put leaves no manifest |
|
|
69
|
+
| `verify(ref) -> list[str]` | Problems found (missing, extra, wrong size or hash); empty means verified. A job is marked `succeeded` only after this is empty |
|
|
70
|
+
| `fetch_previous(ref, dest)` | Copy an earlier attempt's verified files into `dest`, for `$JAMBU_PREVIOUS_OUTPUT_DIR` |
|
|
71
|
+
|
|
72
|
+
Paths that escape the store (`..`, absolute) are refused. A store that is unreachable raises: the coordinator then keeps the fetched files under `<state_dir>/queue/work/`, retries, and never retires a machine for it.
|
|
73
|
+
|
|
74
|
+
`tests/test_queue_outputs.py` shows the checks the built-in stores pass (round trip, truncated upload fails verification, re-put, escaping paths).
|
|
@@ -31,6 +31,18 @@ Operator reference. The project front page is the [README](../README.md). Field-
|
|
|
31
31
|
| `gpu agent install` | Give Claude Code (`-t claude`), Cursor (`-t cursor`) or Claude Desktop (`-t desktop`) the gpu skill and MCP server ([AGENTS.md](AGENTS.md)) |
|
|
32
32
|
| `gpu agent skill` | Print the bundled `SKILL.md` |
|
|
33
33
|
| `gpu mcp` | The local MCP server on stdio, started by the agent's client |
|
|
34
|
+
| `gpu queue submit DIR` | Queue a job directory and print its id at once (`--key` makes it idempotent, `--env NAME=VALUE`). Needs `queue:` in gpu.yaml. See [QUEUE.md](../QUEUE.md) |
|
|
35
|
+
| `gpu queue status [JOB]` | One job's state and attempts, or the queue: counts, pool machines and their cost per hour, the coordinator, paused |
|
|
36
|
+
| `gpu queue ls` | List jobs, oldest first (`--state`) |
|
|
37
|
+
| `gpu queue cancel JOB` | Cancel at once when queued; a running job is stopped on its machine and keeps the outputs written so far |
|
|
38
|
+
| `gpu queue retry JOB` | Queue a failed job again, keeping its attempts |
|
|
39
|
+
| `gpu queue pull JOB` | Verified outputs into `gpu-outputs/<job>/` (`--to DIR`) |
|
|
40
|
+
| `gpu queue pause` / `gpu queue resume` | Stop or restart new claims. Running jobs go on; idle machines (`min_machines` included) time out |
|
|
41
|
+
| `gpu queue drain` | Pause and let the machines idle out. `--now` also sends running jobs back to the queue (requeued, not failed, and not counted toward `max_attempts`) and retires every machine, pulling outputs first |
|
|
42
|
+
| `gpu queue audit` | Check the queue's guarantees I1 to I8; `--repair` fixes what is safe. Exits 1 while a violation remains |
|
|
43
|
+
| `gpu queue stats` | The coordinator's metrics as of its last tick, and the queue's counts |
|
|
44
|
+
| `gpu queue run` | The coordinator: opens machines, runs jobs, delivers outputs (`--once`, `--metrics-port`). It rents GPUs: start it only with the caps decided |
|
|
45
|
+
| `gpu queue install-service` | Write a user service that keeps `gpu queue run` running (`--uninstall`); prints the command that enables it |
|
|
34
46
|
|
|
35
47
|
Every command accepts `--json` and `--config PATH`. To call `gpu` from an application in any language, see [INTEGRATION.md](INTEGRATION.md).
|
|
36
48
|
|