Make builder nice to it's host

StarlingX build tools consume excessive cpu and io which can starve
non-build services, including kubernetes and calico. This results in
timeouts, restarts, and general instability of calico and kubernetes
which in turn can the build to fail. This affect is observed on the
main StarlingX build server.

The major build steps should employ 'nice' and 'ionice' to ensure
that critical services on the build host are not starved for cpu or io.

Depends-On: https://review.opendev.org/c/starlingx/tools/+/939799
Closes-bug: 2095512
Change-Id: Ib904fb28d403c958c10311d5940cc96c752728b4
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2025-01-21 22:06:09 -05:00
parent 9cbdd472fe
commit 7715e8bef2
6 changed files with 28 additions and 0 deletions

View File

@ -18,6 +18,10 @@ if [ -z "${MY_WORKSPACE}" -o -z "${MY_REPO}" ]; then
exit 1
fi
# make this process nice
renice -n 10 -p $$
ionice -c 3 -p $$
SUPPORTED_OS_ARGS=( 'debian' )
OS= # default: autodetect
OS_VERSION= # default: lookup "ARG RELEASE" in Dockerfile

View File

@ -17,6 +17,10 @@ fi
source ${MY_REPO}/build-tools/git-utils.sh
# make this process nice
renice -n 10 -p $$
ionice -c 3 -p $$
SUPPORTED_OS_ARGS=('centos' 'debian' 'distroless')
OS=
OS_LABEL=

View File

@ -17,6 +17,11 @@ if [ -z "${MY_WORKSPACE}" -o -z "${MY_REPO}" ]; then
exit 1
fi
# make this process nice
renice -n 10 -p $$
ionice -c 3 -p $$
SUPPORTED_OS_ARGS=( 'debian' )
OS=
OS_VERSION=

View File

@ -30,6 +30,11 @@ import time
import utils
import yaml
# make ourself nice
pid = os.getpid()
os.setpriority(os.PRIO_PROCESS, 0, 15)
subprocess.run(['ionice', '-c', '3', '-p', str(pid)])
STX_DEFAULT_DISTRO = discovery.STX_DEFAULT_DISTRO
ALL_LAYERS = discovery.get_all_layers(distro=STX_DEFAULT_DISTRO)
ALL_BUILD_TYPES = discovery.get_all_build_types(distro=STX_DEFAULT_DISTRO)

View File

@ -38,6 +38,10 @@ import time
import utils
import yaml
# make ourself nice
pid = os.getpid()
os.setpriority(os.PRIO_PROCESS, 0, 15)
subprocess.run(['ionice', '-c', '3', '-p', str(pid)])
BUILDER_URL = os.environ.get('BUILDER_URL')
REPOMGR_URL = os.environ.get('REPOMGR_URL')

View File

@ -26,9 +26,15 @@ import pathlib
import repo_manage
import shutil
import signal
import subprocess
import sys
import utils
# make ourself nice
pid = os.getpid()
os.setpriority(os.PRIO_PROCESS, 0, 15)
subprocess.run(['ionice', '-c', '3', '-p', str(pid)])
DEFAULT_ARCH = 'amd64'
REPO_BIN = 'deb-local-binary'
mirror_root = os.environ.get('STX_MIRROR')