Skip to main content

Backend.AI Kernel Runner based on GNU libc

Project description

backend.ai-krunner-static-gnu

Backend.AI Kernel Runner Package for glibc-based Kernels

Notice about source distribution

This 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 like static-gnu, static-musl, 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, static_musl)

Development

$ git clone https://github.com/lablup/backend.ai-krunner-{distro} krunner-{distro}
$ cd krunner-{distro}
$ pyenv virtualenv 3.11.1 venv-krunner  # you may share the same venv with other krunner projects
$ pyenv local venv-krunner
$ pip install -U pip setuptools
$ pip install -U click -e .

How to update

  1. Modify Dockerfile and/or other contents.
  • To update the Python version, update src/ai/backend/krunner/{distro_}/krunner-python.{distro}.txt and the dockerfiles (both python and wheels) accordingly, including the PYTHON_VERSION environment variable and the download URL of the statically built Python distribution.
  1. Increment the volume version number specified as a label ai.backend.krunner.version in src/ai/backend/krunner/{distro_}/krunner-env.{distro}.dockerfile
  2. Run scripts/build.py.
  3. Repeat the above steps for each distro version. (For static builds, there is only one.)
  4. Increment the package version number in src/ai/backend/krunner/{distro_}/__init__.py
  5. rm -r dist/* build/* (skip if these directories do not exist and or are empty)
  6. python setup.py sdist bdist_wheel
  7. twine upload dist/*

Note that src/ai/backend/krunner/{distro_}/krunner-version.{distro}.txt files are overwritten by the build script from the label.

Build custom ttyd binary

⚠️ Warning: Use a x86-64 host to build ttyd, because:

  • ttyd uses musl as their C stdlib, not glibc.
  • The musl toochain used by the build script is x86_64 binaries.

libwebsockets>=4.0.0 features auto ping/pong with 5 min default interval. (https://github.com/warmcat/libwebsockets#connection-validity-tracking) And, ws_ping_pong_interval of ttyd is not effective in libwebsockets>=4.0.0. This seems to be the reason why ttyd>=1.6.1 does not set ws_ping_pong_interval for libwebsockets>=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 of libwebsockets used by the ttyd build script manually.

# Prepare Ubuntu environment (possibly, through container) and dependencies.
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake curl file libtool

# Download ttyd source.
git clone https://github.com/tsl0922/ttyd.git
cd ttyd

Now let's modify ./scripts/cross-build.sh.
Add these two lines under pushd "${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.c 
sed -i 's/context->default_retry.secs_since_valid_hangup = 310/context->default_retry.secs_since_valid_hangup = 30/g' lib/core/context.c 

Finally, build the ttyd binary.

# Run build script.
./scripts/cross-build.sh

# Check ttyd binary version.
./build/ttyd --version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backend.ai-krunner-static-gnu-4.0.0rc0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file backend.ai-krunner-static-gnu-4.0.0rc0.tar.gz.

File metadata

File hashes

Hashes for backend.ai-krunner-static-gnu-4.0.0rc0.tar.gz
Algorithm Hash digest
SHA256 a5082ee8e0cc22625628e800fd80d19203a16cb8fc6590be5c22704266d68df1
MD5 45b2f6f9533034294d23cd0243cdba88
BLAKE2b-256 d5805903a736066801e6fbf6efb1c1627e8c8aa18dd015191359b8e8b2fca19e

See more details on using hashes here.

File details

Details for the file backend.ai_krunner_static_gnu-4.0.0rc0-py3-none-manylinux2014_x86_64.macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for backend.ai_krunner_static_gnu-4.0.0rc0-py3-none-manylinux2014_x86_64.macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a4e779777f56c40ef5c57c4e9872c3bd34a8d3020c95668106944a85743381f7
MD5 491e8b720119c1018e0ac2f23bde2bbc
BLAKE2b-256 4d09aa4558ae89460849df561f1f4c76b81679326975791e3881189d8727d412

See more details on using hashes here.

File details

Details for the file backend.ai_krunner_static_gnu-4.0.0rc0-py3-none-manylinux2014_aarch64.macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for backend.ai_krunner_static_gnu-4.0.0rc0-py3-none-manylinux2014_aarch64.macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 166f70881a2364e91489a1b7f3357ce862d2483e96902507d8e401e44f20971d
MD5 dfb654786e9d440438f022b5ac3fbd2d
BLAKE2b-256 f2a0c40882d916582cd0fd96c9f9a54fad7f2ff6dde96af3a6fea7c01f425063

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page