# components The roles (master, webserver, worker, standalone), how they fit. Generated by `make records` from the decisions whose `topic` (or `also`) is this one; edit the decisions, not this page. ## Current ### Roles - **The federated UI is a separate schedr ui role** (D21): `schedr ui` is a separate role federating any mix of distributed deployments and SQLite or Postgres standalones through their JSON APIs. It can deploy alone from the chart; standalones can run with `--no-ui` and prove the UI’s calls through a shared token. Webservers continue serving the API. - **A recorded task finish wakes a scheduler round** (D42): A recorded worker `Finished` wakes the master’s loop to dispatch downstream tasks. Bursts coalesce into one wake, and a woken round starts at least 50 ms after the previous round ended. - **Task finishes and commands wake a scheduler round** (D43): Besides the regular tick, a worker's `Finished` and a command notification wake a scheduler round. A new worker’s registration waits for the next regular tick. - **A master that is not leading is unready and refuses streams** (D297): A paused or superseded master returns 503 from `/readyz` until it leads again. It refuses worker streams with the gRPC status unavailable (`Status::unavailable`), including registrations that waited for its lock while it paused. - **One leading master per deployment; scale by more deployments** (D382): A deployment has one leading master and standby masters ready to take over, as now. Scheduling is never sharded across leaders: more load means more deployments. - **A worker or standalone with no DAG directories warns at start** (D476): A worker (standalone's included) with neither DAG directories nor script roots configured logs a warning at start, "no DAG directories", naming `SCHEDR_DAG_PATH` and `[dags] path` (standalone's `--dag-path .` too): it still starts and serves, but has nothing to parse or run. Only `schedr worker` and `schedr standalone` warn: `dags check` and `dags test` build agent settings for a path outside the roots. Found on a first start of the published 1.0.0, which showed only an empty UI. Not chosen: refusing to start (a worker may be given its roots later by a redeploy, and the UI alone is useful). ### Other - **B48 is fixed by M4B's per-group memory snapshot** (D451): B48 (each worker message copying the dispatcher's whole memory) is fixed by M4B.3: a turn's group takes one memory snapshot, not one per message, and rollback stays as it is. Not chosen: a narrower snapshot per message now; waiting for stress to show it. - **A master that isn't leading names the leader** (D452): A master that isn't leading refuses a worker's stream with UNAVAILABLE naming the lease holder and when its lease expires, for operators reading the worker's log. Not chosen: as before, "not leading" alone. ### From other topics - Deploy schedr ui by default in the distributed chart (D37, `deployment`; built M3.6) - The Python image is schedr and the server image is schedr-server (D164, `development`; built R0.3) - A role starting waits for a database it can't reach yet (D496, `state`; built M5.1q) ## Replaced None. ## Where in code - `charts/schedr/values.yaml` (D37) - `crates/schedr-agent/src/jobs.rs` (D297) - `crates/schedr-db/src/backend.rs::database_place` (D496) - `crates/schedr-db/src/database.rs::is_transient` (D496) - `crates/schedr-db/src/lease.rs::lease_held` (D452) - `crates/schedr-master/src/service.rs::NOT_LEADING` (D297) - `crates/schedr-master/src/service.rs::ROUND_GAP` (D42, D43) - `crates/schedr-master/src/service.rs::Wake` (D43) - `crates/schedr-master/src/service.rs::not_leading` (D452) - `crates/schedr-ui/src/lib.rs::router` (D21) - `crates/schedr/src/ops.rs::readyz` (D297) - `crates/schedr/src/roles.rs::once_reached` (D496) - `crates/schedr/src/roles.rs::wait_for_schema` (D496) - `crates/schedr/src/roles.rs::warn_without_dag_roots` (D476) ## Open None. Details and edge cases, with the reasons; read them before changing this: - JOURNAL.md: D382, D445, D476 - archive/PROJECT.md: Cleanup and resources, Components and roles