Skip to content

Commit ff18b55

Browse files
sbryngelsonclaude
andcommitted
ci: use rename trick to handle stale NFS file handles on build cleanup
Replace 'rm -rf build || true' with 'mv build build.stale.$$' followed by a background best-effort delete. mv is a metadata-only operation that succeeds even when files have stale NFS handles, guaranteeing build/ is gone before the fresh build starts. Old stale trees are cleaned up opportunistically in the background. This also simplifies test.sh and bench.sh: since mv reliably removes build/, the Phoenix-specific override in the build condition is no longer needed — the plain '[ ! -d build ]' check is sufficient again. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e864803 commit ff18b55

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

.github/scripts/prebuild-case-optimization.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ case "$cluster" in
2222
*) echo "ERROR: Unknown cluster '$cluster'"; exit 1 ;;
2323
esac
2424

25-
rm -rf build 2>/dev/null || true
25+
mv build build.stale.$$ 2>/dev/null || true
26+
rm -rf build.stale.* 2>/dev/null & disown
2627

2728
. ./mfc.sh load -c "$flag" -m g
2829

.github/workflows/common/bench.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ fi
2525
# Phoenix builds inside SLURM; Frontier pre-builds via build.sh on the login node.
2626
# Phoenix: always nuke stale builds (heterogeneous compute nodes → ISA mismatch risk).
2727
if [ "$job_cluster" = "phoenix" ]; then
28-
# Suppress stale NFS file handle errors — those files are inaccessible anyway.
29-
rm -rf build 2>/dev/null || true
28+
# Rename instead of rm: mv is a metadata-only op that succeeds even with stale
29+
# NFS file handles. Delete the old tree in the background (best-effort).
30+
mv build build.stale.$$ 2>/dev/null || true
31+
rm -rf build.stale.* 2>/dev/null & disown
3032
fi
3133

32-
if [ "$job_cluster" = "phoenix" ] || [ ! -d "build" ]; then
34+
if [ ! -d "build" ]; then
3335
source .github/scripts/retry-build.sh
3436
retry_build ./mfc.sh build -j $n_jobs $build_opts || exit 1
3537
fi

.github/workflows/common/test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ build_opts="$gpu_opts"
1313
# Phoenix builds inside SLURM on heterogeneous compute nodes — always start fresh
1414
# to avoid SIGILL from stale binaries compiled on a different microarchitecture.
1515
if [ "$job_cluster" = "phoenix" ]; then
16-
# Suppress stale NFS file handle errors — those files are inaccessible anyway.
17-
rm -rf build 2>/dev/null || true
16+
# Rename instead of rm: mv is a metadata-only op that succeeds even with stale
17+
# NFS file handles. Delete the old tree in the background (best-effort).
18+
mv build build.stale.$$ 2>/dev/null || true
19+
rm -rf build.stale.* 2>/dev/null & disown
1820
fi
1921

20-
# Phoenix must always rebuild (heterogeneous compute nodes → ISA mismatch risk),
21-
# even if rm above left a partial build/ directory behind.
22-
if [ "$job_cluster" = "phoenix" ] || [ ! -d "build" ]; then
22+
if [ ! -d "build" ]; then
2323
source .github/scripts/retry-build.sh
2424

2525
# Phoenix: smoke-test the syscheck binary to catch architecture mismatches

.github/workflows/frontier/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ build_opts="$gpu_opts"
2020

2121
. ./mfc.sh load -c $compiler_flag -m $([ "$job_device" = "gpu" ] && echo "g" || echo "c")
2222

23-
# Suppress stale NFS file handle errors — those files are inaccessible anyway.
24-
rm -rf build 2>/dev/null || true
23+
mv build build.stale.$$ 2>/dev/null || true
24+
rm -rf build.stale.* 2>/dev/null & disown
2525

2626
source .github/scripts/retry-build.sh
2727
if [ "$run_bench" == "bench" ]; then

0 commit comments

Comments
 (0)