Skip to content

validate: audit Maestro scheduling against the pipeline forecast - #1541

Open
nuclearcat wants to merge 2 commits into
kernelci:mainfrom
nuclearcat:validate-forecast
Open

validate: audit Maestro scheduling against the pipeline forecast#1541
nuclearcat wants to merge 2 commits into
kernelci:mainfrom
nuclearcat:validate-forecast

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

kci config forecast (kernelci-core) predicts which kbuilds each tree/branch checkout should produce and which test jobs each kbuild should trigger, but nothing verified that Maestro actually scheduled them. Add a daily audit, following the same pattern as the dashboard validation (workflow + supplementary script in tests/):

  • tests/validate_forecast.py fetches checkout nodes old enough for their whole job tree to have settled (24h, over a 24h window), rebuilds the forecast graph with each checkout's real kernel revision, and compares expected vs actual kbuild children, then expected vs actual test jobs per (job, platform) for every kbuild that passed. A missing child is only a finding when its parent succeeded: a failed checkout produces no kbuilds and a failed kbuild triggers no test jobs, so those absences are expected.

    Nodes that exist but are not forecast are classified before being flagged: externally-owned jobs (e.g. owner=qualcomm scheduling on runtimes outside our config) and runner-created children (the per-suite kselftest build nodes kbuild.py attaches) are counted as informational instead of reported as drift.

  • .github/workflows/validate-forecast.yml runs it daily, rewinding config/ to its git state at the start of the validated window so jobs added to the config since the checkout ran are not falsely reported as missing. kernelci-core is checked out from the branch carrying the forecast graph support until it lands upstream.

A trial run against production caught a real gap noticed by @bhcopeland, missing pull lab jobs, while the same job ran on the same platforms two days earlier.

kci config forecast (kernelci-core) predicts which kbuilds each
tree/branch checkout should produce and which test jobs each kbuild
should trigger, but nothing verified that Maestro actually scheduled
them.  Add a daily audit, following the same pattern as the dashboard
validation (workflow + supplementary script in tests/):

  * tests/validate_forecast.py fetches checkout nodes old enough for
    their whole job tree to have settled (24h, over a 24h window),
    rebuilds the forecast graph with each checkout's real kernel
    revision, and compares expected vs actual kbuild children, then
    expected vs actual test jobs per (job, platform) for every kbuild
    that passed.  A missing child is only a finding when its parent
    succeeded: a failed checkout produces no kbuilds and a failed
    kbuild triggers no test jobs, so those absences are expected.

    Nodes that exist but are not forecast are classified before being
    flagged: externally-owned jobs (e.g. owner=qualcomm scheduling on
    runtimes outside our config) and runner-created children (the
    per-suite kselftest build nodes kbuild.py attaches) are counted as
    informational instead of reported as drift.

  * .github/workflows/validate-forecast.yml runs it daily, rewinding
    config/ to its git state at the start of the validated window so
    jobs added to the config since the checkout ran are not falsely
    reported as missing.  kernelci-core is checked out from the branch
    carrying the forecast graph support until it lands upstream.

A trial run against production caught a real gap noticed by @bhcopeland,
missing pull lab jobs, while the same job ran on the same platforms
two days earlier.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@bhcopeland
bhcopeland self-requested a review July 9, 2026 04:12
continue
if not node_ok(kbuild):
# A failed kbuild legitimately triggers nothing; only count it.
report["skipped_failed_kbuilds"].append(describe_node(kbuild))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we will surpress jobs that won't run, but will incomplete builds also be dropped? Might be worth a seperate counter for the other uses cases than just their children.

parent_ok=node_ok(checkout),
)

for kbuild in kbuilds:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will miss 3 levels down, as it will check only its children groups.

I.e.

  # Execute nipa-update on the blktests-ddp-x86 node
  # complete with the blktests-ddp-x86 event
  - job: nipa-update
    event:
      <<: *job-event
      name: blktests-ddp-x86
    runtime:
      type: shell

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nipa is a bit weird job btw, it must be deprecated as seems netdev changed things since long time

python -m pip install --upgrade pip
python -m pip install click requests cloudevents toml pyyaml jinja2

- name: Validate scheduled jobs against forecast

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a check here so MISSING_KBUILD does spam. I think for example gcc-15 changes, will cause this to be quite noisey until we get prod up-to-date. And in this setting its merged, but not yet deployed. We probably want to catch this differently, rather than noticing its a scheduler bug or something.

Comment thread tests/validate_forecast.py Outdated
self.session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
max_retries=requests.adapters.Retry(
total=3, backoff_factor=2, status_forcelist=[500, 502, 504]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add the other status codes here, 503, and 429.

ref=$(git rev-list -1 --before="${hours} hours ago" HEAD)
if [ -n "$ref" ]; then
echo "Using config from $ref ($(git log -1 --format='%ci %s' "$ref"))"
git checkout "$ref" -- config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to add rm -rf config before this. Also up in line 3 we have python3 commands going on, but setup python is down on like 65. I would put setup python at the top before these steps. (or we use some sort of awk command here.

Comment thread .github/workflows/validate-forecast.yml Outdated
# TODO: switch to kernelci/kernelci-core@main once the forecast
# graph support (evaluate_forecast_entry) lands upstream.
repository: nuclearcat/kernelci-core
ref: codex/forecast-missing-job-debug

@bhcopeland bhcopeland Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pin this to a commit sha, until it lands upstream, rathar than a outside repo

@bhcopeland

bhcopeland commented Jul 9, 2026

Copy link
Copy Markdown
Member

Thanks for putting this together @nuclearcat this is a good approach to catch this going forward. I wonder if we should add something around the if: failure() step (like create github issue, or some sort of of discord message)?

@nuclearcat

Copy link
Copy Markdown
Member Author

Thanks for putting this together @nuclearcat this is a good approach to catch this going forward. I wonder if we should add something around the if: failure() step (like create github issue, or some sort of of discord message)?

I am planning that after we make sure there is no unnecessary noise (as we already have too much from -status latency warnings, and it must be reduced).

@nuclearcat nuclearcat added the staging-skip Don't test automatically on staging.kernelci.org label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

staging-skip Don't test automatically on staging.kernelci.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants