Repository navigation
feat(data_plane): one intent round loop per clock; dependents triggered by the upstream's result - #901
Draft
zzylol wants to merge 5 commits into
Draft
feat(data_plane): one intent round loop per clock; dependents triggered by the upstream's result#901zzylol wants to merge 5 commits into
zzylol wants to merge 5 commits into
Conversation
Tests for running planned_rate = 1/k deterministically: a query runs in rounds r % k == 0 (from the first evaluation), is recorded not_triggered otherwise, downstream k must be a multiple of upstream k, when_condition is recorded not evaluated, and group latency covers the members that ran. Adds only the interface stubs the tests need; the 10 new tests fail until the loop implements them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (failing)" This reverts commit 53b670e. Superseded (user, 2026-12-03): the data plane never reads the trigger rate; a dependent query is triggered iff its bound input set is non-empty in that round, so there is no every-k-th-round schedule to test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d loop per clock (failing) Tests for: the loop never reads the trigger rate (a planning input); a dependent query with an empty binding, or below a not-triggered query, is not_triggered; a not-triggered member leaves its latency group complete; one schedule per intent_rounds entry (clock); round records name their clock; every clock covers the fastest clock's span; clocks run concurrently. The rate row of invalid_schedules_are_refused goes. Interface stubs only: QueryStatus::NotTriggered (unused), RoundRecord::round_interval_ms (0), per_clock_from_intent_plan (the first schedule only), rounds_per_clock (rounds for every clock), run_clocks (the first clock only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pstream's result The planner's intent output now has one intent_rounds entry per clock (an intent's queries on one interval). per_clock_from_intent_plan (replacing from_intent_plan) gives one schedule per entry, and run_clocks runs their round loops concurrently from one first evaluation time, each clock covering the fastest clock's span (--intent-rounds counts the fastest clock's rounds). Round records name their clock (round_interval_ms). The trigger rate is a planner cost input only: the loop no longer reads or refuses it. A dependent query is not_triggered (was skipped_empty_binding) when a binding is empty or an upstream was not triggered; such a member leaves its latency group complete, and a group with no triggered member has no record that round. Pins ASAPPlanner 61679203 (#1553 head: per-query intervals, one entry per clock). New e2e: an intent on two clocks planned jointly answers exactly on each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… exact SUM/MIN/MAX) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
EVERY; a dependent query runs on its upstream's clock), but the round loop ran one interval per intent and refused any trigger rate other than 1.IntentSchedule::per_clock_from_intent_plangives one schedule perintent_roundsentry (the planner now writes one entry per clock), andrun_clocksruns them concurrently. The trigger rate is a planner cost input only: the loop never reads it; a dependent query isnot_triggeredwhen its binding is empty (the upstream's WHERE/HAVING/LIMIT is the trigger).each_clock_runs_its_queries_exactly): an intent with q1 every 10 s (top 2 hosts), q2 dependent withWITH RATE 0.2, q3 every 20 s, planned jointly by ASAPPlanner#1553 (61679203), installs as one plan and runs as two loops (10 s: q1, q2; 20 s: q3); every answer equals the exact one. Before: the planner output for this intent did not exist (one interval per intent), and a rate != 1 was refused at load.Review guide
feat/intent-round-loop(feat(data_plane): intent round loop with parameter-slot binding: run a planned SIL intent round by round #900, draft); stacked on it. Draft. Pins ASAPPlanner#1553's head b9c7fdfa (unmerged; was 61679203: adds the binder column fix 98bb53b and Int64 exact SUM/MIN/MAX b9c7fdf).53b670ec+80b05f68: tests for running a rate as every k-th round, then their revert. Superseded by the user's decision that the data plane never uses the rate; kept for history (squash on merge).0bcd8cb0tests + interface stubs only (review first),data_plane/src/intent.rstests B1–B8. Every new test failed for the expected reason (e.g. B1: "rate 0.1 is not supported"; B5: one schedule instead of two).c30ebf69implementation, the pin bump, a two-clock e2e test, docs.fb773b89repin to b9c7fdfa (pin files only).run_clocks,rounds_per_clock,per_clock_from_intent_plan, and thenot_triggered/ group-completeness logic inIntentLoop::run_round.Cargo.toml/Cargo.lockpin, e2e tests callingper_clock_from_intent_plan(..).remove(0), the harness README.Behavior: before → after
The user writes (SIL; planned by ASAPPlanner
plan_intents):EVERYper intent)intent_rounds: [{triage, 10000, [q1, q2]}, {triage, 20000, [q3]}],rateon q2 for the recorddata_plane --intent … --intent-rounds 6rate!= 1 refused at loadskipped_empty_bindingnot_triggered(also for queries below it)complete: falsecomplete: true(a not-triggered member is not missing)rounds.jsonlline{round, evaluation_ms, …}{round_interval_ms, round, evaluation_ms, …}Serves the SIL eval: intents whose queries run at different rhythms, and the dependent queries' real trigger frequency (measured, not scheduled).
Interfaces
Files at c30ebf69.
data_plane/src/intent.rs/// One query of an intent (the type stays). pub struct IntentQuery { pub query_id: String, pub query: String, pub depends_on: Vec<Dependency>, pub bind_slots: Vec<BindSlot>, - /// Fraction of rounds it runs in; only 1 (every round) is supported. - pub rate: f64, pub skip_if_empty: bool, } /// What happened to one query in one round (the type stays). pub enum QueryStatus { Answered, - /// A binding it reads was empty: not run. - SkippedEmptyBinding, /// An upstream query failed or was skipped for a failure: not run. SkippedUpstream, Failed, + /// A binding it reads is empty, or an upstream was not triggered: the upstream's result did not trigger it. + NotTriggered, } /// One latency group in one round (the type stays). pub struct GroupRecord { pub query_ids: Vec<String>, pub max_latency_ms: f64, pub latency_ms: Option<f64>, - /// Whether every member ran. + /// Whether every member ran or was not triggered. pub complete: bool, pub met: bool, } /// One round (the type stays). pub struct RoundRecord { + /// The interval of the clock this round belongs to; `(round_interval_ms, round)` names a round. + pub round_interval_ms: u64, pub round: u64, pub evaluation_ms: i64, pub status: RoundStatus, pub start_lag_ms: f64, pub duration_ms: f64, pub overrun: bool, pub queries: Vec<QueryRecord>, pub groups: Vec<GroupRecord>, } /// One planned intent query, as the planner writes it (the type stays; `rate` is no longer read). pub struct PlannedIntentQuery { pub query_id: String, pub query_index: usize, pub depends_on: Vec<PlannedDependency>, pub bind_slots: Vec<PlannedBindSlot>, - pub rate: f64, pub skip_if_empty: bool, } impl IntentSchedule { - pub fn from_intent_plan(intent_plan: &IntentPlan, intent_name: &str) -> anyhow::Result<Self>; + /// One schedule per clock (`intent_rounds` entry) of the intent, in order; error when it has none. + pub fn per_clock_from_intent_plan(intent_plan: &IntentPlan, intent_name: &str) -> anyhow::Result<Vec<Self>>; } +/// The rounds each clock runs so that every clock covers `rounds` rounds of the fastest: ceil(rounds × min / interval). +pub fn rounds_per_clock(intervals_ms: &[u64], rounds: u64) -> Vec<u64>; +/// Runs every clock's rounds concurrently from one first evaluation time; `emit` gets every round of every clock. +pub async fn run_clocks<R: QueryRunner>(loops: &[IntentLoop], runner: &R, first_evaluation_ms: i64, rounds: u64, start: Instant, emit: impl FnMut(RoundRecord) + Send);Removed:
IntentQuery::rate/PlannedIntentQuery::rate(the loop never uses the rate; serde ignores the planner's field),from_intent_plan(an intent may have several clocks).data_planeCLI:--intentruns one loop per clock;--intent-roundscounts the fastest clock's rounds;rounds.jsonllines carryround_interval_ms; statusnot_triggeredreplacesskipped_empty_binding.Usage (as
each_clock_runs_its_queries_exactlyruns it):Algorithm changes
Triggering. Before: a dependent query with an empty binding was
skipped_empty_binding; a query below a skipped one wasskipped_upstream; groups with a skipped member were incomplete. After: (1) empty binding →not_triggered; (2) an upstreamnot_triggered→not_triggered(an upstream failure still →skipped_upstream); (3) a group is complete iff every member ran or was not triggered; (4) a group with no triggered member emits no record that round (no latency sample).Clocks.
run_clocksjoins onerun_roundsper clock (onefutures::join_allon the caller's task, so a slow clock delays only its own rounds' starts within the shared runtime; an overrun is per clock as before). Clock c runsceil(rounds × Δ_min / Δ_c)rounds; all clocks start at--intent-first-evaluation-ms.Decisions and open questions
skipped_empty_binding→not_triggered(rename, not a new status): an empty binding is the trigger saying no.met: false, which would bias met fractions).--intent-roundscounts the fastest clock; every clock covers the same span (alternative: an--intent-duration-ms).T_0; the harness should pass aT_0that is a multiple of every interval (phase 0 in the planner's sense). The loop does not check it.Verification
cargo test -p data_plane --libintent::, incl. B1–B8)cargo test -p data_plane --test intent_rounds --test intent_sil_modeseach_clock_runs_its_queries_exactly)cargo test -p data_plane --no-fail-fast(at fb773b8)ingest_shards::a_shard_running_ahead_does_not_close_windows_earlyfailed once in an earlier full run and passed 3 times since (timing flake, unrelated)cargo clippy -p data_plane --tests --bins -- -D warnings,cargo fmt --checkNew tests: B1 the loop loads and runs a schedule with rate 0.1 on every round with a non-empty binding; B2 empty binding →
not_triggered; B3 a query below a not-triggered query is not triggered; B4 a not-triggered member keeps its group complete; B5 two clocks → two schedules; B6 records name their clock; B7 rounds per clock cover one span; B8 two clocks run concurrently at their own evaluation times (paused time); e2e two clocks answer exactly.Follow-ups
round_interval_ms) and the measured trigger frequency per dependent query (to compare with the planner'srate).🤖 Generated with Claude Code