Commit 139a9a83 authored by Ryan McCormick's avatar Ryan McCormick Committed by GitHub
Browse files

chore: Add triton_distributed_rs wheel install to container build (#135)

parent a62a8627
...@@ -28,7 +28,6 @@ USER root ...@@ -28,7 +28,6 @@ USER root
# Rust build/dev dependencies # Rust build/dev dependencies
RUN apt-get update; apt-get install -y gdb protobuf-compiler RUN apt-get update; apt-get install -y gdb protobuf-compiler
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN pip install maturin
ENV PATH="/root/.cargo/bin:${PATH}" ENV PATH="/root/.cargo/bin:${PATH}"
# Install OpenAI-compatible frontend and its dependencies from triton server # Install OpenAI-compatible frontend and its dependencies from triton server
...@@ -149,20 +148,25 @@ RUN apt-get install tmux -y ...@@ -149,20 +148,25 @@ RUN apt-get install tmux -y
# Working directory # Working directory
WORKDIR /workspace WORKDIR /workspace
#TODO Exclude container directory COPY runtime /workspace/runtime
COPY . /workspace
RUN cd runtime/rust && \ RUN cd runtime/rust && \
cargo build --release --locked && cargo doc --no-deps cargo build --release --locked && cargo doc --no-deps
# Create virtualenv # Install uv and create virtualenv for general use
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN mkdir /opt/triton && \ RUN mkdir /opt/triton && \
uv venv /opt/triton/venv --python 3.12 && \ uv venv /opt/triton/venv --python 3.12 && \
source /opt/triton/venv/bin/activate && \ source /opt/triton/venv/bin/activate && \
cd runtime/rust/python-wheel && \ cd runtime/rust/python-wheel && \
maturin develop uv build && \
uv pip install dist/triton_distributed_rs*cp312*.whl
# Install triton_distributed_rs wheel globally in container for tests that
# currently run without virtual environment activated.
# TODO: In future, we may use a virtualenv for everything and remove this.
RUN pip install runtime/rust/python-wheel/dist/triton_distributed_rs*cp312*.whl
COPY icp /workspace/icp
RUN /workspace/icp/protos/gen_python.sh RUN /workspace/icp/protos/gen_python.sh
# Install python packages # Install python packages
...@@ -173,10 +177,13 @@ ARG PYTHON_PACKAGE_VERSION=0.0.1.dev+unknown ...@@ -173,10 +177,13 @@ ARG PYTHON_PACKAGE_VERSION=0.0.1.dev+unknown
# #
# Normally SCM version is taken directly from .git but this is not available in the Dockerfile # Normally SCM version is taken directly from .git but this is not available in the Dockerfile
# and so we pass in via a buildarg # and so we pass in via a buildarg
RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TRITON_DISTRIBUTED_ICP=${PYTHON_PACKAGE_VERSION} pip install -e /workspace/icp/python RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TRITON_DISTRIBUTED_ICP=${PYTHON_PACKAGE_VERSION} pip install -e /workspace/icp/python
RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TRITON_DISTRIBUTED_RUNTIME=${PYTHON_PACKAGE_VERSION} pip install -e /workspace/runtime/python RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TRITON_DISTRIBUTED_RUNTIME=${PYTHON_PACKAGE_VERSION} pip install -e /workspace/runtime/python
# Copy everything in after install steps to avoid re-running build/install
# commands on unrelated changes in other dirs.
COPY . /workspace
# Sets pythonpath for python modules # Sets pythonpath for python modules
ENV PYTHONPATH="${PYTHONPATH}:/workspace/examples/python:/opt/tritonserver/python/openai/openai_frontend" ENV PYTHONPATH="${PYTHONPATH}:/workspace/examples/python:/opt/tritonserver/python/openai/openai_frontend"
......
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
pytestmark = pytest.mark.pre_merge
def test_bindings_install():
# Verify python bindings to rust can be imported
import triton_distributed_rs as tdr
# Placeholder to avoid unused import errors or removal by linters
assert tdr
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment