Files
lancedb/.github/workflows/build_linux_wheel/action.yml
T
Workflow config file is invalid. Please check your config file: invalid jobs: input node is not a mapping node
Xuanwo 108e8183e1 fix(ci): increase swap for Linux ARM Python wheels (#5333)
Both Linux aarch64 wheel variants intermittently lose the final
`lancedb-python` rustc process during fat LTO. The affected runners
reported 31 GiB of RAM and 16 GiB of configured swap, and the logged
Docker invocation supplies no explicit memory cap. The same runner image
has also completed wheel builds, so the historical logs leave the source
of SIGKILL undetermined. [Standard wheel
failure](https://github.com/lancedb/lancedb/actions/runs/46692473826/job/142804749599)
· [Free-threaded release
failure](https://github.com/lancedb/lancedb/actions/runs/46648917509/job/142722631114)

Give the two native ARM wheel builds 32 GiB of swap through their shared
composite action. This keeps fat LTO and one codegen unit, which
preserve release wheel size headroom, and keeps the existing manylinux
platform and ABI tags. Record the build container's memory and swap
peaks and OOM counters on exit, with kernel and systemd-oomd logs on
failed native ARM jobs.
2026-12-02 03:09:15 +08:00

115 lines
5.3 KiB
YAML

# We create a composite action to be re-used both for testing and for releasing
name: build-linux-wheel
description: "Build a manylinux wheel for lance"
inputs:
python-minor-version:
description: "Python minor version for the requested interpreter (e.g. 10, 13, 15)"
required: true
args:
description: "--release"
required: false
default: ""
maturin-version:
description: "Version of maturin to use for this wheel build"
required: false
default: "1.12.4"
arm-build:
description: "Build for arm64 instead of x86_64"
# Note: this does *not* mean the host is arm64, since we might be cross-compiling.
required: false
default: "false"
manylinux:
description: "The manylinux version to build for"
required: false
default: "2_17"
package-name:
description: "Override [project] name in python/pyproject.toml (e.g. 'lancedb-compat'). Default keeps 'lancedb'."
required: false
default: "lancedb"
rustflags:
description: "RUSTFLAGS for the build container, as a single whitespace-free token (e.g. '-Ctarget-cpu=x86-64-v2'). Empty leaves RUSTFLAGS unset, keeping the defaults from .cargo/config.toml."
required: false
default: ""
runs:
using: "composite"
steps:
- name: Get protoc version
id: protoc
uses: ./.github/actions/setup-protoc
with:
install: "false"
- name: CONFIRM ARM BUILD
shell: bash
env:
ARM_BUILD: ${{ inputs.arm-build }}
run: |
echo "ARM BUILD: $ARM_BUILD"
- name: Patch package name for variant build
if: ${{ inputs.package-name != 'lancedb' }}
shell: bash
env:
PACKAGE_NAME: ${{ inputs.package-name }}
run: |
# Swap the [project] name so this build produces e.g. lancedb-compat
# wheels. The package still installs files under the lancedb/
# namespace -- import lancedb still works after pip install.
sed -i.bak 's/^name = "lancedb"$/name = "'"$PACKAGE_NAME"'"/' python/pyproject.toml
rm -f python/pyproject.toml.bak
grep '^name = ' python/pyproject.toml
- name: Build x86_64 Manylinux wheel
if: ${{ inputs.arm-build == 'false' }}
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: ${{ inputs.maturin-version }}
command: build
working-directory: python
docker-options: "-e PIP_EXTRA_INDEX_URL='https://pypi.fury.io/lance-format/ https://pypi.fury.io/lancedb/' -e PROTOC=/usr/local/bin/protoc -e PROTOC_VERSION=${{ steps.protoc.outputs.version }} -e PROTOC_SHA256=${{ steps.protoc.outputs.linux-x86_64-sha256 }} ${{ inputs.rustflags != '' && format('-e RUSTFLAGS={0}', inputs.rustflags) || '' }}"
target: x86_64-unknown-linux-gnu
manylinux: ${{ inputs.manylinux }}
args: ${{ inputs.args }}
before-script-linux: |
set -e
curl -fsSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip -o /tmp/protoc.zip
echo "${PROTOC_SHA256} /tmp/protoc.zip" | sha256sum -c -
unzip /tmp/protoc.zip -d /usr/local
rm /tmp/protoc.zip
/usr/local/bin/protoc --version
- name: Add swap for native Arm wheel builds
if: ${{ inputs.arm-build == 'true' && runner.arch == 'ARM64' }}
shell: bash
run: |
# Give the final fat-LTO rustc process room to spill beyond host RAM.
swap_file="$RUNNER_TEMP/lancedb-swap"
sudo fallocate --length 32G "$swap_file"
sudo chmod 600 "$swap_file"
sudo mkswap "$swap_file"
sudo swapon "$swap_file"
free -h
- name: Build Arm Manylinux Wheel
if: ${{ inputs.arm-build == 'true' }}
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: ${{ inputs.maturin-version }}
command: build
working-directory: python
docker-options: "-e PIP_EXTRA_INDEX_URL='https://pypi.fury.io/lance-format/ https://pypi.fury.io/lancedb/' -e PROTOC=/usr/local/bin/protoc -e PROTOC_VERSION=${{ steps.protoc.outputs.version }} -e PROTOC_SHA256=${{ steps.protoc.outputs.linux-aarch_64-sha256 }} ${{ inputs.rustflags != '' && format('-e RUSTFLAGS={0}', inputs.rustflags) || '' }}"
target: aarch64-unknown-linux-gnu
manylinux: ${{ inputs.manylinux }}
args: ${{ inputs.args }}
before-script-linux: |
set -e
# Report peak usage and OOM counters before Docker removes the container.
trap 'grep -H . /sys/fs/cgroup/memory.{max,peak,swap.max,swap.peak,events} 2>/dev/null || true' EXIT
yum install -y clang
curl -fsSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip -o /tmp/protoc.zip
echo "${PROTOC_SHA256} /tmp/protoc.zip" | sha256sum -c -
unzip /tmp/protoc.zip -d /usr/local
rm /tmp/protoc.zip
/usr/local/bin/protoc --version
- name: Report host memory failures
if: ${{ failure() && inputs.arm-build == 'true' && runner.arch == 'ARM64' }}
shell: bash
run: |
sudo journalctl -k -b --no-pager --grep='oom-kill|Out of memory|Killed process' || true
sudo journalctl -u systemd-oomd -b --no-pager --grep='Killed' || true