Repository navigation
Site limits: change a site's plan and memory/CPU overrides after create (db, agent, jobs, api, ui) - #40
Conversation
…apacity on effective memory Migration 0009 adds site_limits (memory_mb, cpu_percent overrides over the plan) and the limits_update job kind. Limits::change_with_job stores the plan and overrides and queues the job in one transaction, after locking the server and rechecking capacity with the site's own memory taken out. Site creation now sums effective memory (override, else plan). Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
… jobs write the effective limits Command::ApplyLimits -> helper apply-limits (systemctl set-property --runtime MemoryMax/CPUQuota, no restart). limits_update job: write_unit with the effective limits, then apply_limits when running (restart on an agent older than 0.1.8). build_spec takes the site's effective limits (plan + overrides), so provision, update and restore keep an override. agent_at_least moves to setu-proto. Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
… the sites that follow it Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
…; plan edit says how many sites follow Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
…tamp prefix Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com> # Conflicts: # docs/AGENT.md
Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
|
Diff review: changes requested (d9c775e) Reviewer: Opus (rev-f2). Scope: whole PR, merge-base 5816869 .. d9c775e. The security paths (the P1: clippy and test-arm fail on the head. P2: a stale P2: a plan edit skips following sites whose job is in progress, and they keep the old limits. Checked and fine: |
…rride to outlive a change); a plan edit waits for any following site's active job; db test reads its job Review of #40 (d9c775e): - P1: repos.rs bound an unused job; the test now asserts the 409 queued nothing. - P2: apply-limits wrote /run/systemd/system.control 50-*.conf overrides that beat the rewritten drop-in after a stop -> change -> start. write-unit's daemon-reload already applies MemoryMax/CPUQuota to a running unit, so the helper verb, the ApplyLimits command and the old-agent restart fallback are gone; limits_update is write_unit, finish. Test: stop -> change -> start runs on the last limits. - P2: update_plan's active-job 409 now covers every following site whatever its status (a provisioning/updating site's job already read the old plan); only running/stopped sites get a job. Test with the provisioning site. Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
|
c4caf51 diff review (full PR, security paths): changes requested
Nits (non-blocking): Fixed since the last round: no |
…nt plan edit waits and rechecks the moved site's server (Fable review P2) Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
|
f44d4a5 delta review (c4caf51..f44d4a5): Diff review passed (f44d4a5) Reviewer: Fable (rev-f2). Scope: the one fix commit against last round's P2.
Non-blocking nits from last round still open: Review file: krishiv-internal |
|
f44d4a5 delta review (d9c775e..f44d4a5, Opus): Diff review passed (f44d4a5) All three findings of the d9c775e review are fixed: the 409 test asserts its job, |
…concurrent plan raise waits and is counted; NewSite.plan_memory_mb removed (#40 review nit) Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
|
6b57bf1 delta review (f44d4a5..6b57bf1, security paths): Diff review passed (6b57bf1) Scope: the one commit. No findings. One nit, not blocking and older than this commit:
|
|
e0dae9f delta review (6b57bf1..e0dae9f, security paths, Fable): Diff review passed (e0dae9f) Scope: the one commit, test only (
Read only, nothing run here. CI on this head: fmt, clippy, deny, test-arm, e2e-arm green; Review file: krishiv-internal |
|
e0dae9f delta review (f44d4a5..e0dae9f, Opus): Diff review passed (e0dae9f)
Nits (non-blocking):
Review: ops/reviews/review-web-o1-setu-40-e0dae9f16.md (krishiv-internal) |
Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
Conflicts: agent postgres.rs, tests/postgres.rs, tests/restore_pg.rs, AGENT.md and OPERATIONS.md on main were earlier states of this branch (363518f, 0adf3f9), so this branch's versions are kept. CHANGELOG: the 0.1.9 section is main's as released; Unreleased gets main's site-limits entry and this branch's later entries (S-L11 moved out of 0.1.9, where the merge had placed it). The branch's migration 0009_agent_command_priority is now 0010 (main's 0009_site_limits came first); a test NewSite drops the plan_memory_mb field #40 removed. Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
Change a site's limits after it is created (queue-opus row "change-site-limits").
site_limits(per-site memory/CPU overrides; NULL follows the plan),limits_updatejob kind,update_plan; server capacity counts each site's effective memory.limits_updatejob rewrites the unit drop-in with the effective limits;write-unit'sdaemon-reloadgives a running unit the newMemoryMax/CPUQuotawithout a restart, and a stopped unit takes them on its next start. Every job that writes a unit writes the effective limits. (Noset-property --runtime: its50-*.confoverride would beat a later drop-in; review of d9c775e.)GET/PUT /sites/{id}/limits; a plan edit re-applies limits to the sites that follow it (409 while any of them has an active job);openapi.jsonregenerated.limits_update, api limits + openapi, uisite_limits.test.tsx. Also fixes a latent flake in 4 api test files:unique()used the ULID timestamp prefix, so names made within ~256 ms collided (409 on plan create).## Unreleasedentry; re-wraps the S-H1 upgrade note (review nit on release 0.1.9: version, changelog dated (0.1.8 was never tagged) #39).Verification:
cargo test --workspace --no-fail-fastall green (with Postgres), clippy-D warningsclean,SQLX_OFFLINEcheck clean, ui typecheck/lint clean, ui 104/104.