-
Notifications
You must be signed in to change notification settings - Fork 171
ci: fail fast on bad nodes and cluster outages #1797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sbryngelson
wants to merge
10
commits into
master
Choose a base branch
from
ci/fail-fast-preflight
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,366
−40
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
525fd16
ci: fail fast on bad nodes and cluster outages
sbryngelson 3f48eb8
ci: address review findings on the fail-fast preflight
sbryngelson ca5d52d
ci: preflight refuses to judge a node outside a SLURM allocation
sbryngelson a46e55f
ci: probe the node on the benchmark and case-optimization paths too
sbryngelson 082e01e
ci: make the case-optimization pre-build probe actually run
sbryngelson e7aa42c
ci: do not probe the node in the case-optimization pre-build
sbryngelson a47cf56
ci: tighten the node-fault blast radius and speed up the monitor tests
sbryngelson e20de7c
test: measure retry rescues, and stop retrying through an abort (#1798)
sbryngelson 2f94ead
test: make retry value harvestable, not just recorded (#1798)
sbryngelson dfc71f8
Revert the retry-stats harvester; it answered a 6% question
sbryngelson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| #!/bin/bash | ||
| # Per-cluster circuit breaker for environment-wide outages. | ||
| # | ||
| # Some failures are not the node's fault and not the code's fault: pypi.org | ||
| # unreachable from a login node, a module tree mid-upgrade, a full project | ||
| # filesystem. Requeuing elsewhere cannot help, and every job that starts pays | ||
| # the same discovery cost -- on 2026-08-28, 17 Frontier jobs each spent ~33 | ||
| # minutes learning that PyPI was down. | ||
| # | ||
| # The first job to notice records a marker on the shared filesystem (every | ||
| # self-hosted runner for a cluster shares $HOME); later jobs check it and exit | ||
| # immediately instead of submitting a SLURM job that is going to fail. | ||
| # | ||
| # The breaker is deliberately self-healing. A marker expires after | ||
| # MFC_CI_OUTAGE_TTL_SECONDS, and a marker that cannot be parsed is ignored, so | ||
| # neither a stale file nor a truncated write can wedge CI. Only jobs that | ||
| # actually observe the outage re-mark it, so once the outage clears the breaker | ||
| # closes on its own. | ||
| # | ||
| # Usage: | ||
| # ci-outage.sh mark <cluster> <reason> record an outage | ||
| # ci-outage.sh check <cluster> exit 0 = clear, 1 = outage active | ||
| # ci-outage.sh clear <cluster> reset the breaker | ||
| # | ||
| # Env: | ||
| # MFC_CI_STATE_DIR where markers live (default ~/.mfc-ci-state) | ||
| # MFC_CI_OUTAGE_TTL_SECONDS marker lifetime in seconds (default 1200) | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| STATE_DIR="${MFC_CI_STATE_DIR:-$HOME/.mfc-ci-state}" | ||
| TTL="${MFC_CI_OUTAGE_TTL_SECONDS:-1200}" | ||
|
|
||
| # A non-numeric TTL would make the age comparison below emit "integer expression | ||
| # expected" and exit with a code the caller reads as neither clear nor tripped. | ||
| # Fall back to the default rather than letting a typo gate CI. | ||
| case "$TTL" in | ||
| ''|*[!0-9]*) | ||
| echo "Ignoring non-numeric MFC_CI_OUTAGE_TTL_SECONDS='$TTL'; using 1200." >&2 | ||
| TTL=1200 | ||
| ;; | ||
| esac | ||
|
|
||
| EXIT_CLEAR=0 | ||
| EXIT_TRIPPED=1 | ||
| EXIT_USAGE=2 | ||
|
|
||
| usage() { | ||
| echo "Usage: $0 {mark <cluster> <reason>|check <cluster>|clear <cluster>}" >&2 | ||
| } | ||
|
|
||
| # Keep the marker name filesystem-safe regardless of what the caller passes. | ||
| marker_for() { | ||
| local cluster | ||
| cluster=$(printf '%s' "$1" | tr -c 'A-Za-z0-9_.-' '_') | ||
| printf '%s/outage-%s' "$STATE_DIR" "$cluster" | ||
| } | ||
|
|
||
| cmd="${1:-}" | ||
| cluster="${2:-}" | ||
|
|
||
| if [ -z "$cmd" ] || [ -z "$cluster" ]; then | ||
| usage | ||
| exit $EXIT_USAGE | ||
| fi | ||
|
|
||
| marker=$(marker_for "$cluster") | ||
|
|
||
| case "$cmd" in | ||
| mark) | ||
| reason="${3:-unspecified}" | ||
| mkdir -p "$STATE_DIR" || exit $EXIT_USAGE | ||
| # Write to a temporary file and rename so a concurrent `check` never | ||
| # observes a half-written marker. | ||
| tmp="${marker}.$$.tmp" | ||
| { | ||
| date +%s | ||
| printf '%s\n' "$reason" | ||
| } > "$tmp" && mv -f "$tmp" "$marker" | ||
| echo "Recorded $cluster outage: $reason" | ||
| echo " marker: $marker (expires after ${TTL}s)" | ||
| ;; | ||
|
|
||
| check) | ||
| [ -f "$marker" ] || exit $EXIT_CLEAR | ||
|
|
||
| stamp=$(head -n1 "$marker" 2>/dev/null) | ||
| reason=$(tail -n +2 "$marker" 2>/dev/null) | ||
|
|
||
| # A marker we cannot parse is treated as absent: an unreadable breaker | ||
| # must never be an un-clearable one. | ||
| case "$stamp" in | ||
| ''|*[!0-9]*) | ||
| echo "Ignoring unparseable outage marker $marker" | ||
| exit $EXIT_CLEAR | ||
| ;; | ||
| esac | ||
|
|
||
| age=$(( $(date +%s) - stamp )) | ||
| if [ "$age" -ge "$TTL" ] || [ "$age" -lt 0 ]; then | ||
| exit $EXIT_CLEAR | ||
| fi | ||
|
sbryngelson marked this conversation as resolved.
|
||
|
|
||
| echo "::warning::Skipping: known $cluster outage recorded ${age}s ago: ${reason:-unspecified}" | ||
| echo "Clear it early by deleting $marker" | ||
| exit $EXIT_TRIPPED | ||
| ;; | ||
|
|
||
| clear) | ||
| rm -f "$marker" | ||
| echo "Cleared any $cluster outage marker ($marker)" | ||
| ;; | ||
|
|
||
| *) | ||
| usage | ||
| exit $EXIT_USAGE | ||
| ;; | ||
| esac | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/bin/bash | ||
| # Decide whether a failed build was a cluster-wide dependency outage. | ||
| # | ||
| # MFC bootstraps its Python toolchain into build/venv on the first ./mfc.sh call | ||
| # of a job, pulling from pypi.org. On Phoenix clean_build has just moved build/ | ||
| # aside, so that happens every time; on Frontier it happens in the login-node | ||
| # "Fetch Dependencies" step. When the index is unreachable the build fails for a | ||
| # reason no other node improves on, so it is worth recording once and skipping | ||
| # the rest of the matrix rather than having each job spend ~33 minutes | ||
| # rediscovering it (17 Frontier jobs did exactly that on 2026-08-28). | ||
| # | ||
| # Usage: classify-build-failure.sh <logfile> <cluster> | ||
| # | ||
| # Exit codes: | ||
| # 78 cluster-wide dependency outage; it has been recorded | ||
| # 0 ordinary build failure, caller should keep its own exit code | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| log="${1:-}" | ||
| cluster="${2:-}" | ||
|
|
||
| if [ -z "$log" ] || [ -z "$cluster" ]; then | ||
| echo "Usage: $0 <logfile> <cluster>" >&2 | ||
| exit 0 | ||
| fi | ||
|
|
||
| # No log means nothing to classify. Never claim an outage on absent evidence. | ||
| [ -f "$log" ] || exit 0 | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
|
||
| # The URL may or may not be wrapped (uv quotes it in backticks, plain pip does | ||
| # not), so do not require a character between the colon and the scheme. | ||
| if grep -qE "Failed to fetch:[^h]*https?://pypi|uv install failed|\(venv\) Installation failed" "$log"; then | ||
| bash "$SCRIPT_DIR/ci-outage.sh" mark "$cluster" \ | ||
| "PyPI/uv dependency install failed during build" | ||
| exit 78 | ||
| fi | ||
|
|
||
| exit 0 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/bin/bash | ||
| # Bookkeeping for the sbatch --exclude list used when a node fails preflight. | ||
| # | ||
| # The in-allocation preflight prints "MFC_FAULT_NODE=<name>" into the job's | ||
| # output file when it finds the node unusable (dead GPU, SIGILL from a binary | ||
| # built for another microarchitecture). The submit wrapper reads that back, adds | ||
| # the node to --exclude and resubmits, so the retry lands elsewhere. | ||
| # | ||
| # Bad nodes are concentrated rather than scattered -- over 2026-08-18..31 one | ||
| # Phoenix node accounted for 25 of 29 ECC failures -- which is why excluding the | ||
| # offender is worth doing and why it was previously a hand-edited constant. | ||
| # | ||
| # Usage: | ||
| # node-exclude.sh node-from <output-file> print the faulted node, if any | ||
| # node-exclude.sh merge <csv> <node> print <csv> with <node> added once | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| usage() { | ||
| echo "Usage: $0 {node-from <output-file>|merge <csv> <node>}" >&2 | ||
| } | ||
|
|
||
| case "${1:-}" in | ||
| node-from) | ||
| file="${2:-}" | ||
| [ -f "$file" ] || exit 0 | ||
| # Last marker wins: one output path is reused across resubmits, so an | ||
| # earlier attempt's marker can still be sitting above the current one. | ||
| sed -n 's/.*MFC_FAULT_NODE=\([A-Za-z0-9._-]\{1,\}\).*/\1/p' "$file" | tail -n1 | ||
| ;; | ||
|
|
||
| merge) | ||
| csv="${2-}" | ||
| node="${3-}" | ||
| if [ -z "$node" ]; then | ||
| printf '%s\n' "$csv" | ||
| exit 0 | ||
| fi | ||
| if [ -z "$csv" ]; then | ||
| printf '%s\n' "$node" | ||
| exit 0 | ||
| fi | ||
| # Wrapping both sides in commas compares whole fields, so a shorter name | ||
| # that happens to be a prefix of the new one is not mistaken for a match. | ||
| case ",$csv," in | ||
| *",$node,"*) printf '%s\n' "$csv" ;; | ||
| *) printf '%s,%s\n' "$csv" "$node" ;; | ||
| esac | ||
| ;; | ||
|
|
||
| *) | ||
| usage | ||
| exit 2 | ||
| ;; | ||
| esac |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.