Skip to main content

Crate schedr_api

Crate schedr_api 

Source
Expand description

The schedr webserver: REST API and web UI.

So far the REST API subset the CLI needs (/api/v1: DAGs, runs, tasks, attempts and their logs, commands, workers), with version headers, a generated OpenAPI description and Swagger UI over it at /api/v1/docs (see archive/PROJECT.md, Web UI and CLI). Reads come straight from the database; actions are command rows the master applies.

Re-exports§

pub use error::ApiError;
pub use state::ApiState;

Modules§

attempt_memory
A task’s peak memory over its attempts (M5.1k, decision 467): the task panel’s chart of its last attempts, and the DAG page’s p95 peak of each task against its limit.
auth
Who the user is (M3.5; see archive/PROJECT.md, Authentication: as little as possible in schedr). The name is recorded on commands, never used to allow or deny anything; there are no roles.
docs
The API’s description and Swagger UI over it (see archive/PROJECT.md, Web UI and CLI: Swagger UI).
error
Errors of the REST API, answered as JSON ({"error": "..."}).
events
GET /api/v1/changes: what changed, as server-sent events, for the UI’s live pages (see archive/PROJECT.md, Web UI: 34A). Only what changed, never the new state: a client reads that from the other endpoints.
logs
Task logs, read from the worker that ran the attempt (see archive/PROJECT.md, Task logs): the webserver proxies them, so clients never reach workers.
metrics
The webserver’s metrics (see archive/PROJECT.md, Observability), registered in the process’s registry and served on the ops port: requests by route template (never a raw path, which holds IDs) and status, and why the log proxy couldn’t serve a log.
named_events
POST /api/v1/events and GET /api/v1/events (decision 354): events posted by outside systems, which EventNamed triggers and waiting steps act on. Posting needs what triggering a run needs: a signed-in user or token (schedr has no permissions of its own).
routes
The /api/v1 endpoints: reads straight from the database, actions as command rows.
series
The samples of each process over a range, in buckets (M5.1j; decisions 464, 465): the Metrics page’s charts and the Deployments page’s sparkline.
state
What every request handler shares.
task_flow
GET /api/v1/metrics/tasks: the Metrics page’s throughput and start latency (decision 494), from the attempts table. A range’s final buckets are kept between requests, as the samples’ are (decision 492): each request reads only the buckets since the last final one.
version
Versions between clients and the server (see archive/PROJECT.md, Web UI and CLI: compatibility).
views
The JSON shapes of the REST API: what it returns and what it accepts.

Structs§

ApiDoc
The OpenAPI description of /api/v1, generated from the handlers and views.

Constants§

DOCS_PATH
Where Swagger UI is served (always: it shows only what openapi.json already does).
OPENAPI_PATH
Where the OpenAPI description is served.

Functions§

openapi_json
The OpenAPI description as committed under schema/ (pretty JSON).
router
The API’s routes over state.