0bc734c020
Applies `ruff format` to the accumulated formatting debt on this branch. Formatting-only — no behavioral changes. Required for CI/lint's format gate (`nox -s format -- --check`), which the branch was failing on 288 tracked files that drifted from ruff's canonical style. In-progress WIP files are intentionally excluded so this commit stays a clean formatting-only diff. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
"""Controller DB layer.
|
|
|
|
SQLAlchemy 2.0 declarative schema for the workflows, attempts,
|
|
events, flake-history, and ci-observations tables. The same schema
|
|
serves SQLite (tests + local dev) and Postgres (production; multi-
|
|
machine workers per plan v5).
|
|
|
|
The DB connection is configured by ``CLEVERAGENTS_DB_URL``:
|
|
postgresql+psycopg2://user@host:5432/cleveragents
|
|
sqlite:///./controller.db
|
|
sqlite:///:memory: (tests)
|
|
|
|
The dequeue helper (``dequeue.py``) abstracts over the two dialects'
|
|
different concurrency primitives:
|
|
- Postgres: ``SELECT … FOR UPDATE SKIP LOCKED``
|
|
- SQLite: ``BEGIN IMMEDIATE`` + serialized UPDATE
|
|
"""
|
|
|
|
from .models import (
|
|
Base,
|
|
CIObservation,
|
|
ControllerEvent,
|
|
FlakeHistory,
|
|
Workflow,
|
|
WorkflowAttempt,
|
|
)
|
|
from .session import (
|
|
build_engine,
|
|
create_all,
|
|
session_scope,
|
|
)
|
|
from .dequeue import (
|
|
DequeueResult,
|
|
dequeue_one,
|
|
)
|
|
from .payload_guard import (
|
|
PayloadTooLargeError,
|
|
enforce_input_payload_size,
|
|
)
|
|
|
|
__all__ = [
|
|
# models
|
|
"Base",
|
|
"CIObservation",
|
|
"ControllerEvent",
|
|
"FlakeHistory",
|
|
"Workflow",
|
|
"WorkflowAttempt",
|
|
# session
|
|
"build_engine",
|
|
"create_all",
|
|
"session_scope",
|
|
# dequeue
|
|
"DequeueResult",
|
|
"dequeue_one",
|
|
# payload guard
|
|
"PayloadTooLargeError",
|
|
"enforce_input_payload_size",
|
|
]
|