Skip to content

Commit c812d14

Browse files
authored
fix(ray): fix dynamic package loading issue (#275)
Because - Ray worker needs to import custom user defined package during the runtime This commit - add the direct package path in `PYTHONPATH`
1 parent e369019 commit c812d14

File tree

6 files changed

+13
-40
lines changed

6 files changed

+13
-40
lines changed

.github/labeler.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/add-label-to-pr.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/add-pr-to-prj.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

instill/helpers/docker/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
4040
pip install --default-timeout=1000 instill-sdk==${INSTILL_PYTHON_SDK_VERSION}; \
4141
fi;
4242

43-
# Download protobuf definition from GitHub
44-
RUN curl -L https://raw.githubusercontent.com/instill-ai/protobufs/1427cfe974daf443987b08a97fe4ff1cd9fcd7c8/model/ray/v1alpha/user_defined.proto -o user_defined.proto
45-
46-
RUN python -m grpc_tools.protoc -I=. --python_out=. --pyi_out=. --grpc_python_out=. ./user_defined.proto
47-
ENV PYTHONPATH=/home/ray
43+
# The python-sdk is a local module that is not installed in the Ray worker environment.
44+
# Ray workers need to deserialize model configurations and deployment settings that were
45+
# created in the runtime environment. These objects may depend on this python-sdk.
46+
# Instead of installing the SDK in the Ray image, we copy
47+
# the entire SDK to /home/ray and set PYTHONPATH to allow dynamic importing.
48+
ENV PYTHONPATH=/home/ray/python-sdk/instill/protogen/model/ray/v1alpha

instill/helpers/docker/Dockerfile.vllm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
9090

9191
USER ray
9292

93-
# Download protobuf definition from GitHub
94-
RUN curl -L https://raw.githubusercontent.com/instill-ai/protobufs/1427cfe974daf443987b08a97fe4ff1cd9fcd7c8/model/ray/v1alpha/user_defined.proto -o user_defined.proto
95-
96-
RUN python -m grpc_tools.protoc -I=. --python_out=. --pyi_out=. --grpc_python_out=. ./user_defined.proto
97-
ENV PYTHONPATH=/home/ray
93+
# The python-sdk is a local module that is not installed in the Ray worker environment.
94+
# Ray workers need to deserialize model configurations and deployment settings that were
95+
# created in the runtime environment. These objects may depend on this python-sdk.
96+
# Instead of installing the SDK in the Ray image, we copy
97+
# the entire SDK to /home/ray and set PYTHONPATH to allow dynamic importing.
98+
ENV PYTHONPATH=/home/ray/python-sdk/instill/protogen/model/ray/v1alpha

0 commit comments

Comments
 (0)