Package: backend.ai-krunner-static-gnu
backend.ai-krunner-static-gnuBackend.AI Kernel Runner Package for glibc-based KernelsThis package contains a statically built Python distribution and 3rd-party libraries required to runour krunner moduleinside containers whose images are provided by users.The krunner wheel itself can be installed into any Python environments (the content of this plugin
package is agnostic to platforms and architectures as it's a mere declaration of the plugin
interface), but we still apply the binary wheel platform tags so that setuptools could distinguish
the target CPU architecture as follows:Where is Backend.AI running?What is the user container's base image?The krunner wheel usedmanylinux (x86-64)manylinux (x86-64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmanylinux (x86-64)musllinux (x86-64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmanylinux (aarch64)manylinux (aarch64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlmanylinux (aarch64)musllinux (aarch64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlmusllinux (x86-64)manylinux (x86-64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmusllinux (x86-64)musllinux (x86-64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmusllinux (aarch64)manylinux (aarch64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlmusllinux (aarch64)musllinux (aarch64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlmacOS (x86-64)manylinux (x86-64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmacOS (x86-64)musllinux (x86-64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whlmacOS (aarch64)manylinux (aarch64)backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlmacOS (aarch64)musllinux (aarch64)backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whlWe named the krunner package based on musl 1.2 as "alpine" because practically Alpine linux is the
only distribution which actively uses musl and it is currently not possible to build static CPython
which can import 3rd-party dynamic modules on top of the musl ecosystem.Notice about source distributionThis package is to distribute prebuilt binaries, so the source distribution does not have prebuilt
binaries and does not work as intended.  Just refer this repository on how we build stuffs.How to read below{distro}is a string likestatic-gnu,alpine, etc. depending on which repository you are in.{distro_}is a string same to{distro}but with hyphens replaced with underscores for Python
package names and paths. (e.g.,static_gnu,alpine)Development$gitclonehttps://github.com/lablup/backend.ai-krunner-{distro}krunner-{distro}$cdkrunner-{distro}$pyenvvirtualenv3.11.2venv-krunner# you may share the same venv with other krunner projects$pyenvlocalvenv-krunner$pipinstall-Upipsetuptools$pipinstall-Uclick-e.How to updateModify Dockerfile and/or other contents.To update the Python version, updatesrc/ai/backend/krunner/{distro_}/krunner-python.{distro}.txtand the dockerfiles (both python and wheels) accordingly, including thePYTHON_VERSIONenvironment variable and the download URL of the
statically built Python distribution.Incrementthe volume version numberspecified as a labelai.backend.krunner.versioninsrc/ai/backend/krunner/{distro_}/krunner-env.{distro}.dockerfileRunscripts/build.py.Repeat the above steps for each distro version. (For static builds, there is only one.)Incrementthe package version numberinsrc/ai/backend/krunner/{distro_}/__init__.pyrm -r dist/* build/*(skip if these directories do not exist and or are empty)Commit.Create a signed annotated tag and push the tag to let GitHub Action build and publish wheels.Note thatsrc/ai/backend/krunner/{distro_}/krunner-version.{distro}.txtfiles are
overwritten by the build script from the label.WARNING: We should choosex86_64_v2binaries from the indygreg repositorywhen updating the Python runtime version for CPU compatibility with some of our
test setups and customer sites.Making a minimal glibc-based image compatibile with this krunner packageUse CentOS 7 or later and install this list of packages.Alsorefer the test script.Build custom ttyd binary⚠️ Warning: Use a x86-64 host to build ttyd, because:ttyd usesmuslas their C stdlib, notglibc.Themusltoochain used by the build script is x86_64 binaries.libwebsockets>=4.0.0features auto ping/pong with 5 min default interval.
(https://github.com/warmcat/libwebsockets#connection-validity-tracking) And,ws_ping_pong_intervalof ttyd is not effective inlibwebsockets>=4.0.0.
This seems to be the reason whyttyd>=1.6.1does not setws_ping_pong_intervalforlibwebsockets>=4.0.0.
(https://github.com/tsl0922/ttyd/blob/master/src/server.c#L456)To fix this issue, we modify and build the latest version oflibwebsocketsused by the ttyd build script manually.#PrepareUbuntuenvironment(possibly,throughcontainer)anddependencies.sudo apt-get updatesudo apt-get install -y autoconf automake build-essential cmake curl file libtool#Downloadttydsource.git clone https://github.com/tsl0922/ttyd.gitcd ttydNow let's modify./scripts/cross-build.sh.Add these two lines underpushd "${BUILD_DIR}/libwebsockets-${LIBWEBSOCKETS_VERSION}":sed-i's/context->default_retry.secs_since_valid_ping = 300/context->default_retry.secs_since_valid_ping = 20/g'lib/core/context.csed-i's/context->default_retry.secs_since_valid_hangup = 310/context->default_retry.secs_since_valid_hangup = 30/g'lib/core/context.cFinally, build thettydbinary.#Runbuildscript../scripts/cross-build.sh#Checkttydbinaryversion../build/ttyd --version