Skip to content

Commit 0e367c7

Browse files
committed
Share one portable, device-aware binary lookup between both preflight probes
1 parent 63483e8 commit 0e367c7

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

.github/scripts/preflight.sh

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,23 @@ fi
5656
# only does so on Phoenix -- and a stale binary compiled for a different
5757
# microarchitecture dies with SIGILL, which would be reported as a bad node and
5858
# get a perfectly healthy one excluded.
59-
newest_syscheck() {
60-
# ls -t rather than find -printf: -printf is GNU-only, and on a BSD find it
61-
# fails into 2>/dev/null, so discovery silently returns nothing and every
62-
# probe is skipped as "no syscheck binary".
63-
find "$@" -name syscheck -type f -exec ls -t {} + 2>/dev/null | head -1
59+
# ls -t rather than find -printf: -printf is GNU-only, and on a BSD find it
60+
# fails into 2>/dev/null, so discovery silently returns nothing and every probe
61+
# is skipped as "no binary".
62+
newest_install_binary() {
63+
name=$1
64+
shift
65+
find build/install "$@" -name "$name" -type f -exec ls -t {} + 2>/dev/null | head -1
6466
}
6567

66-
syscheck_bin=$(newest_syscheck build/install -path "*${device}*")
67-
if [ -z "$syscheck_bin" ]; then
68-
syscheck_bin=$(newest_syscheck build/install)
69-
fi
68+
# Prefer this job's device, fall back to any. Used for both probe binaries.
69+
newest_for_device() {
70+
found=$(newest_install_binary "$1" -path "*${device}*")
71+
[ -n "$found" ] || found=$(newest_install_binary "$1")
72+
printf '%s\n' "$found"
73+
}
74+
75+
syscheck_bin=$(newest_for_device syscheck)
7076

7177
if [ -z "$syscheck_bin" ]; then
7278
# Nothing to probe with. A missing binary is a build problem, not a bad
@@ -147,8 +153,7 @@ run_probe() {
147153
# exclude every healthy node in the cluster. 132 is 128+4, a child killed by
148154
# SIGILL; bash reports signals that way, and mpirun/srun forward it.
149155
isa_probe() {
150-
isa_bin=$(find build/install -name pre_process -type f -printf '%T@ %p\n' 2>/dev/null \
151-
| sort -rn | head -1 | cut -d' ' -f2-)
156+
isa_bin=$(newest_for_device pre_process)
152157
[ -n "$isa_bin" ] || return 0
153158

154159
isa_rc=0

0 commit comments

Comments
 (0)