Repository navigation
M1 jobs and scheduling: steps 2–6 (fake executor, scheduler core, job wrapper, K3s executor, job API) - #131
Draft
BrandonwLii wants to merge 5 commits into
Draft
BrandonwLii wants to merge 5 commits into
BrandonwLii wants to merge 5 commits into
Conversation
clock.Fake fires timers and AfterFunc callbacks synchronously in time order during Advance, so executor and scheduler tests are deterministic. executor/fake runs scripted jobs on any clock and injects the failures real executors must survive: lost and late create responses, OOM, launch errors and timeouts, the executor backstop, SIGTERM vs SIGKILL, lost and recovered nodes, failed cleanup and observation outages. Its durable receipts are separate from an event stream that tests can hold, drop, duplicate, reorder or lose on restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…step 3) Scheduler tables (partitions, qos, limits, jobs, job_specs, job_events, allocations, nodes, op_intents, consumed_events) with the proposed M1 defaults. The cycle refreshes nodes, applies durable revocations, reconciles List against the database, enforces walltime from started_at and launch deadlines, admits FIFO-within-QoS with user/team/partition limits and partition caps, then dispatches committed intents. Allocations are released only on a cleanup receipt; lost executions keep them quarantined. A leader epoch fences writes from a deposed scheduler. A never-sent launch intent proves nothing exists, so cancelling it frees capacity at once; sent ones are resent with the same ExecutionID. Tests run against Postgres with the fake executor and fake clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-job wrapper: umask 0027, symlink-safe private dot-folders, output opened with openat2(RESOLVE_BENEATH) under the team root, header and footer, output copied to the file and stdout, SIGTERM forwarding to the job's process group, a local deadline timer with SIGKILL after grace, OOM detection from the cgroup's memory.events, and a structured termination message. Setup failures exit 125 without running the work. Process tests re-execute the test binary as the wrapper; the OOM test runs inside a 64 MiB systemd user scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pod builder (pure, golden-tested) for plain Pods and immutable ConfigMaps: Mist's nodeName, strict supplemental groups, no service-account token, read-only root, requests = limits, per-job passwd/group, NFS or hostPath team mounts, dnsPolicy None. Executor on client-go informers and a work queue, with durable receipts in k3s_executions: repeat-safe Launch that adopts ambiguous creates and never recreates a recorded Pod, Terminate by shortening activeDeadlineSeconds so the final status survives, results that prefer kubelet observations (OOMKilled, eviction, deadline) over the wrapper, log tail saved before deletion, Lost on outside deletion or 2 min NotReady, and Exited only on a matching node cleanup receipt. k3d testing found that NetworkPolicy is programmed about a second after containers start; every job Pod now waits in a network-gate init container until the node's kubelet is unreachable. Also: deploy/k3s namespace, NetworkPolicy and RBAC, mistd cleanup-report, scripts/k3d-test.sh, and evidence in docs/agents/evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/api serves submit (database defaults, validation, required Idempotency-Key), list, get, cancel, log (tail and WebSocket follow), the anonymised queue and partitions, plus the host-token authenticated cleanup receipt endpoint. mistd cleanup-report -post delivers receipts. Production builds fail closed until Identity's authenticators land, and reject the development user header; -dev-fixture exists only with -tags mistdev. M1-09 is covered by unit tests on the fixture and by a k3d test that runs submit-to-COMPLETED through the API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #130. This is a draft until M1 is finished. It implements steps 2–6 of docs/agents/plans/jobs-and-scheduling.md, one commit per step. The plan has a status entry for each step.
Steps
internal/clock,internal/executor/fake). The fake executor can inject faults: lost create responses, outages, held, dropped or duplicated events, lost nodes and failed cleanup.internal/scheduler).mist-job-entry.internal/executor/k3s,deploy/k3s/).executors.md.internal/api).Idempotency-Key.Testing
go test ./...andgo test -tags mistdev ./internal/api ./cmd/...pass. The database tests use embedded Postgres.scripts/k3d-test.shpasses all 9 tests on k3s v1.36.5 with containerd 2.3.4, running as mistd's own service account. The tests cover:docs/agents/evidence/m1-step5-k3d.mdand the plan's status entries.Needs review from
internal/identity/identity.gocontract. Also how the session and relay authenticators plug intoapi.Server.Accounts(api.md#implementation-notes-m1). Until they do,mistd apifails closed. Host-token issuing also belongs to Identity.Not yet done (steps 7–9)
Real-cluster deployment, GPUs, NFS, the host firewall, TLS on the direct link, running the cleanup reporter on nodes, and conformance tests on the real hardware.
🤖 Generated with Claude Code