backend.ai-krunner-static-gnu


Namebackend.ai-krunner-static-gnu JSON
Version 4.2.0 PyPI version JSON
download
home_pagehttps://backend.ai
SummaryBackend.AI Kernel Runner based on GNU libc
upload_time2024-04-04 12:13:01
maintainerNone
docs_urlNone
authorLablup Inc.
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # backend.ai-krunner-static-gnu
Backend.AI Kernel Runner Package for glibc-based Kernels

This package contains a statically built Python distribution and 3rd-party libraries required to run
[our krunner module](https://github.com/lablup/backend.ai/tree/main/src/ai/backend/kernel)
inside 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 used |
|------------------------------|------------------------------------------|------------------------|
| manylinux (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.whl` |
| manylinux (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.whl` |
| manylinux (aarch64)          | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |
| manylinux (aarch64)          | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |
| musllinux (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.whl` |
| musllinux (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.whl` |
| musllinux (aarch64)          | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |
| musllinux (aarch64)          | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |
| macOS (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.whl` |
| macOS (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.whl` |
| macOS (aarch64)              | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |
| macOS (aarch64)              | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |

We 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 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`, `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

```console
$ git clone https://github.com/lablup/backend.ai-krunner-{distro} krunner-{distro}
$ cd krunner-{distro}
$ pyenv virtualenv 3.12.2 venv-krunner  # you may share the same venv with other krunner projects
$ pyenv local venv-krunner
$ pip install -U pip setuptools
$ pip install -U -r build/requirements.txt
$ pip install -U -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.
2. Increment *the volume version number* specified as a label `ai.backend.krunner.version`
   in `src/ai/backend/krunner/{distro_}/krunner-env.{distro}.dockerfile`
3. Run `scripts/build.py`.
4. Repeat the above steps for each distro version. (For static builds, there is only one.)
5. Increment *the package version number* in `src/ai/backend/krunner/{distro_}/__init__.py`
6. `rm -r dist/* build/*` (skip if these directories do not exist and or are empty)
7. Commit.
8. Create a signed annotated tag and push the tag to let GitHub Action build and publish wheels.

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

WARNING: We should choose [`x86_64_v2` binaries from the indygreg repository](https://gregoryszorc.com/docs/python-build-standalone/main/running.html)
when 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 package

[Use CentOS 7 or later and install this list of packages.](https://github.com/lablup/backend.ai-krunner-static-gnu/blob/master/compat-test.Dockerfile)
Also [refer the test script](https://github.com/lablup/backend.ai-krunner-static-gnu/blob/main/scripts/test.sh).

## 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.

```console
# 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}"`:
```sh
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.   
```console
# Run build script.
./scripts/cross-build.sh

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://backend.ai",
    "name": "backend.ai-krunner-static-gnu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Lablup Inc.",
    "author_email": "devops@lablup.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/7e/564dbe5383b57992c0a17521caa38f7e189d894c51458070b11755f739b0/backend.ai-krunner-static-gnu-4.2.0.tar.gz",
    "platform": null,
    "description": "# backend.ai-krunner-static-gnu\nBackend.AI Kernel Runner Package for glibc-based Kernels\n\nThis package contains a statically built Python distribution and 3rd-party libraries required to run\n[our krunner module](https://github.com/lablup/backend.ai/tree/main/src/ai/backend/kernel)\ninside containers whose images are provided by users.\n\nThe krunner wheel itself can be installed into any Python environments (the content of this plugin\npackage is agnostic to platforms and architectures as it's a mere declaration of the plugin\ninterface), but we still apply the binary wheel platform tags so that setuptools could distinguish\nthe target CPU architecture as follows:\n\n| Where is Backend.AI running? | What is the user container's base image? | The krunner wheel used |\n|------------------------------|------------------------------------------|------------------------|\n| manylinux (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.whl` |\n| manylinux (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.whl` |\n| manylinux (aarch64)          | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n| manylinux (aarch64)          | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n| musllinux (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.whl` |\n| musllinux (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.whl` |\n| musllinux (aarch64)          | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n| musllinux (aarch64)          | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n| macOS (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.whl` |\n| macOS (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.whl` |\n| macOS (aarch64)              | manylinux (aarch64)                      | `backend.ai_krunner_static_gnu-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n| macOS (aarch64)              | musllinux (aarch64)                      | `backend.ai_krunner_alpine-X.X.X-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl` |\n\nWe named the krunner package based on musl 1.2 as \"alpine\" because practically Alpine linux is the\nonly distribution which actively uses musl and it is currently not possible to build static CPython\nwhich can import 3rd-party dynamic modules on top of the musl ecosystem.\n\n## Notice about source distribution\n\nThis package is to distribute prebuilt binaries, so the source distribution does not have prebuilt\nbinaries and does not work as intended.  Just refer this repository on how we build stuffs.\n\n## How to read below\n\n* `{distro}` is a string like `static-gnu`, `alpine`, etc. depending on which repository you are in.\n* `{distro_}` is a string same to `{distro}` but with hyphens replaced with underscores for Python\n  package names and paths. (e.g., `static_gnu`, `alpine`)\n\n## Development\n\n```console\n$ git clone https://github.com/lablup/backend.ai-krunner-{distro} krunner-{distro}\n$ cd krunner-{distro}\n$ pyenv virtualenv 3.12.2 venv-krunner  # you may share the same venv with other krunner projects\n$ pyenv local venv-krunner\n$ pip install -U pip setuptools\n$ pip install -U -r build/requirements.txt\n$ pip install -U -e .\n```\n\n## How to update\n\n1. Modify Dockerfile and/or other contents.\n  - To update the Python version, update `src/ai/backend/krunner/{distro_}/krunner-python.{distro}.txt`\n    and the dockerfiles (both python and wheels) accordingly, including the\n    `PYTHON_VERSION` environment variable and the download URL of the\n    statically built Python distribution.\n2. Increment *the volume version number* specified as a label `ai.backend.krunner.version`\n   in `src/ai/backend/krunner/{distro_}/krunner-env.{distro}.dockerfile`\n3. Run `scripts/build.py`.\n4. Repeat the above steps for each distro version. (For static builds, there is only one.)\n5. Increment *the package version number* in `src/ai/backend/krunner/{distro_}/__init__.py`\n6. `rm -r dist/* build/*` (skip if these directories do not exist and or are empty)\n7. Commit.\n8. Create a signed annotated tag and push the tag to let GitHub Action build and publish wheels.\n\nNote that `src/ai/backend/krunner/{distro_}/krunner-version.{distro}.txt` files are\noverwritten by the build script from the label.\n\nWARNING: We should choose [`x86_64_v2` binaries from the indygreg repository](https://gregoryszorc.com/docs/python-build-standalone/main/running.html)\nwhen updating the Python runtime version for CPU compatibility with some of our\ntest setups and customer sites.\n\n## Making a minimal glibc-based image compatibile with this krunner package\n\n[Use CentOS 7 or later and install this list of packages.](https://github.com/lablup/backend.ai-krunner-static-gnu/blob/master/compat-test.Dockerfile)\nAlso [refer the test script](https://github.com/lablup/backend.ai-krunner-static-gnu/blob/main/scripts/test.sh).\n\n## Build custom ttyd binary\n\n**\u26a0\ufe0f Warning: Use a x86-64 host to build ttyd, because:**\n  - ttyd uses `musl` as their C stdlib, not `glibc`.\n  - The `musl` toochain used by the build script is x86_64 binaries.\n\n`libwebsockets>=4.0.0` features auto ping/pong with 5 min default interval.\n(https://github.com/warmcat/libwebsockets#connection-validity-tracking) And,\n`ws_ping_pong_interval` of ttyd is not effective in `libwebsockets>=4.0.0`.\nThis seems to be the reason why `ttyd>=1.6.1` does not set\n`ws_ping_pong_interval` for `libwebsockets>=4.0.0`.\n(https://github.com/tsl0922/ttyd/blob/master/src/server.c#L456)\n\nTo fix this issue, we modify and build the latest version of `libwebsockets` used by the ttyd build script manually.\n\n```console\n# Prepare Ubuntu environment (possibly, through container) and dependencies.\nsudo apt-get update\nsudo apt-get install -y autoconf automake build-essential cmake curl file libtool\n\n# Download ttyd source.\ngit clone https://github.com/tsl0922/ttyd.git\ncd ttyd\n```\n\nNow let's modify `./scripts/cross-build.sh`.  \nAdd these two lines under `pushd \"${BUILD_DIR}/libwebsockets-${LIBWEBSOCKETS_VERSION}\"`:\n```sh\nsed -i 's/context->default_retry.secs_since_valid_ping = 300/context->default_retry.secs_since_valid_ping = 20/g' lib/core/context.c \nsed -i 's/context->default_retry.secs_since_valid_hangup = 310/context->default_retry.secs_since_valid_hangup = 30/g' lib/core/context.c \n```\n\nFinally, build the `ttyd` binary.   \n```console\n# Run build script.\n./scripts/cross-build.sh\n\n# Check ttyd binary version.\n./build/ttyd --version\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Backend.AI Kernel Runner based on GNU libc",
    "version": "4.2.0",
    "project_urls": {
        "Homepage": "https://backend.ai"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc526be9de312bcbd60f4d2b8348424b3e2e7413ae3d9dab6ac6bd7a329653bb",
                "md5": "c0837e65f93e2e98da6f2ceaecda0c10",
                "sha256": "3a24afa18a7a2c549461aa5f8857333e133fd1349009e4b078bf358e157138f9"
            },
            "downloads": -1,
            "filename": "backend.ai_krunner_static_gnu-4.2.0-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "c0837e65f93e2e98da6f2ceaecda0c10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 48174150,
            "upload_time": "2024-04-04T12:12:52",
            "upload_time_iso_8601": "2024-04-04T12:12:52.635390Z",
            "url": "https://files.pythonhosted.org/packages/dc/52/6be9de312bcbd60f4d2b8348424b3e2e7413ae3d9dab6ac6bd7a329653bb/backend.ai_krunner_static_gnu-4.2.0-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a47cd80ec9dad98008cebbe019b0ad01569964a6e84e377b36725bf757e9564",
                "md5": "b400413562e5b38936c72863fe7b4f45",
                "sha256": "81ce53a067293f4ed4935b8b6b918fdf6fbb72666202b14b2f1e3afc6f7a62fc"
            },
            "downloads": -1,
            "filename": "backend.ai_krunner_static_gnu-4.2.0-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b400413562e5b38936c72863fe7b4f45",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 49514035,
            "upload_time": "2024-04-04T12:12:57",
            "upload_time_iso_8601": "2024-04-04T12:12:57.771501Z",
            "url": "https://files.pythonhosted.org/packages/0a/47/cd80ec9dad98008cebbe019b0ad01569964a6e84e377b36725bf757e9564/backend.ai_krunner_static_gnu-4.2.0-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c7e564dbe5383b57992c0a17521caa38f7e189d894c51458070b11755f739b0",
                "md5": "f204c8e6e7c3b1b68548f0c28981c79e",
                "sha256": "62f7977362d3ce87da17af122f82681a55f3d2e1cd3b6c5a8eec084ad02e82cc"
            },
            "downloads": -1,
            "filename": "backend.ai-krunner-static-gnu-4.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f204c8e6e7c3b1b68548f0c28981c79e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7882,
            "upload_time": "2024-04-04T12:13:01",
            "upload_time_iso_8601": "2024-04-04T12:13:01.561461Z",
            "url": "https://files.pythonhosted.org/packages/5c/7e/564dbe5383b57992c0a17521caa38f7e189d894c51458070b11755f739b0/backend.ai-krunner-static-gnu-4.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 12:13:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "backend.ai-krunner-static-gnu"
}
        
Elapsed time: 0.21877s