WIP: quiet image build attempt (test branch)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
08c98bb32c
commit
467f296b66
@ -329,9 +329,8 @@ get_quantcore_image() { # force(0|1)
|
||||
say " present: virtualenv $QC_VENV (no-build fallback; reinstall: $0 build)"; return 0
|
||||
fi
|
||||
build_sif || {
|
||||
say ""
|
||||
say " The image build is not possible on this Spark without root. Falling back to the no-build"
|
||||
say " setup: a plain Python image plus a virtualenv in $QC_VENV (same libraries, same results)."
|
||||
say " -> using the no-build setup instead: a plain Python image plus a virtualenv in $QC_VENV"
|
||||
say " (same libraries, same results)"
|
||||
build_venv
|
||||
} ;;
|
||||
venv)
|
||||
@ -348,15 +347,18 @@ get_quantcore_image() { # force(0|1)
|
||||
}
|
||||
|
||||
build_sif() { # build quantcore.sif from the definition; non-zero when this Apptainer cannot build
|
||||
local dst="$QC_IMAGES/quantcore.sif"
|
||||
local dst="$QC_IMAGES/quantcore.sif" log="$QC_HOME/build.log" reason
|
||||
mkdir -p "$QC_IMAGES"
|
||||
say " building $dst from $REPO_DIR (a few minutes)"
|
||||
say " building $dst from $REPO_DIR (a few minutes; log: $log)"
|
||||
prepare_apptainer_dirs
|
||||
rm -f "$dst.part"
|
||||
# %files paths in the definition are relative to the repository root. Without root Apptainer
|
||||
# builds through --fakeroot (user namespaces); a Spark may not allow that.
|
||||
if ! (cd "$REPO_DIR" && "$APPTAINER" build "$dst.part" deploy/apptainer/quantcore.def); then
|
||||
# builds through --fakeroot (user namespaces); many Sparks do not allow that. The output goes to a
|
||||
# log: on such a Spark Apptainer's red ERROR line is expected, and the caller falls back.
|
||||
if ! (cd "$REPO_DIR" && "$APPTAINER" build "$dst.part" deploy/apptainer/quantcore.def) >"$log" 2>&1; then
|
||||
rm -f "$dst.part"
|
||||
reason="$(grep -E 'FATAL|ERROR' "$log" | tail -n 1 | sed -e 's/\x1b\[[0-9;]*m//g' -e 's/^[A-Z]* *: *//')"
|
||||
say " no image build on this machine${reason:+ ($reason)}"
|
||||
return 1
|
||||
fi
|
||||
mv -f "$dst.part" "$dst"
|
||||
@ -391,8 +393,8 @@ cmd_build() { # rebuild after a code change, in the mode in use
|
||||
if [[ "$mode" == venv ]]; then
|
||||
build_venv
|
||||
elif [[ "$QC_IMAGE" == build ]]; then
|
||||
build_sif || die "the image build failed (see above). Without root it needs Apptainer's --fakeroot. Use the
|
||||
no-build fallback instead: set QC_IMAGE=venv in $CONFIG and run: $0 build"
|
||||
build_sif || die "the image build failed (log: $QC_HOME/build.log). Without root it needs Apptainer's
|
||||
--fakeroot. Use the no-build setup instead: set QC_IMAGE=venv in $CONFIG and run: $0 build"
|
||||
else
|
||||
die "QC_IMAGE=$QC_IMAGE is a prebuilt image; nothing to build"
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user