Skip to content

Commit 1890797

Browse files
authored
Merge pull request #1701 from basetenlabs/nikhil/release-0.9.102
Release 0.9.102
2 parents 0792084 + 2de7bae commit 1890797

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "truss"
3-
version = "0.9.101"
3+
version = "0.9.102"
44
description = "A seamless bridge from model development to model delivery"
55
license = "MIT"
66
readme = "README.md"

truss/templates/control_venv.Dockerfile.jinja

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

truss/templates/server.Dockerfile.jinja

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@
22
{%- include "cache.Dockerfile.jinja" %}
33
{%- endif %} {#- endif model_cache_v1 #}
44

5-
{%- set requires_live_reload = config.live_reload and not config.docker_server %}
6-
7-
{%- if requires_live_reload %}
8-
{% include "control_venv.Dockerfile.jinja" %}
9-
{%- endif %} {#- endif requires_live_reload #}
10-
115
{% extends "base.Dockerfile.jinja" %}
126

13-
147
{% block base_image_patch %}
158
{# If user base image is supplied in config, apply build commands from truss base image #}
169
{% if config.base_image %}
@@ -34,14 +27,14 @@ COPY ./{{ base_server_requirements_filename }} {{ base_server_requirements_filen
3427
RUN pip install -r {{ base_server_requirements_filename }} --no-cache-dir && rm -rf /root/.cache/pip
3528
{%- endif %} {#- endif not config.docker_server #}
3629

37-
{%- if requires_live_reload %}
30+
{%- if config.live_reload and not config.docker_server %}
3831
{# Create symlink for inference server IF a user base image is supplied and live_reload is enabled. #}
3932
{# This links the base images primary python executable path to /usr/local/bin/python. #}
4033
{# This is specific to the user-provided base image scenario. #}
4134
RUN readlink {{ config.base_image.python_executable_path }} &>/dev/null \
4235
&& echo "WARNING: Overwriting existing link at /usr/local/bin/python"
4336
RUN ln -sf {{ config.base_image.python_executable_path }} /usr/local/bin/python
44-
{%- endif %} {#- endif requires_live_reload #}
37+
{%- endif %} {#- endif config.live_reload and not config.docker_server (for symlink) #}
4538
{% endif %} {#- endif config.base_image #}
4639

4740
{% endblock %} {#- endblock base_image_patch #}
@@ -98,24 +91,34 @@ COPY ./truss /app/truss
9891
{%- endif %} {#- endif use_local_src #}
9992

10093
COPY ./config.yaml /app/config.yaml
101-
{%- if requires_live_reload %}
94+
{%- if config.live_reload and not config.docker_server %}
10295
COPY ./control /control
103-
104-
# NB(nikhil): Copy the virtual env, and system dependencies for the
105-
# python version specific to the control server. We need to run ldconfig
106-
# so dynamic linking works.
107-
COPY --from=control-server-venv /usr/local/lib/ /usr/local/lib/
108-
COPY --from=control-server-venv /control/.env /control/.env
109-
RUN ldconfig
110-
96+
# Step 1: Ensure a usable python{{ control_python_version }} is available
97+
RUN if python{{ control_python_version }} -c 'import venv; venv.EnvBuilder(with_pip=True).create("/tmp/__probe_env")' > /dev/null 2>&1; then \
98+
echo "Using system python{{ control_python_version }}"; \
99+
python{{ control_python_version }} -m pip install --upgrade pip virtualenv && \
100+
python{{ control_python_version }} -m virtualenv /control/.env; \
101+
else \
102+
echo "Installing Miniforge-based python{{ control_python_version }}..."; \
103+
curl -fsSL -o miniforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh && \
104+
bash miniforge.sh -b -p /opt/conda-control && \
105+
rm miniforge.sh && \
106+
/opt/conda-control/bin/conda create -y -p /opt/conda-control/envs/py{{ control_python_version }} python={{ control_python_version }} && \
107+
/opt/conda-control/envs/py{{ control_python_version }}/bin/pip install --upgrade pip virtualenv && \
108+
/opt/conda-control/bin/conda clean -afy && \
109+
rm -rf /opt/conda-control/pkgs && \
110+
/opt/conda-control/envs/py{{ control_python_version }}/bin/python -m virtualenv /control/.env; \
111+
fi
112+
113+
# Step 2: Install requirements into the freshly created venv
111114
RUN /control/.env/bin/pip install -r /control/requirements.txt
112-
{%- endif %} {#- endif requires_live_reload #}
113-
115+
{%- endif %} {#- endif config.live_reload and not config.docker_server (for control server setup) #}
114116
{%- if model_dir_exists %}
115117
COPY ./{{ config.model_module_dir }} /app/model
116118
{%- endif %} {#- endif model_dir_exists #}
117119
{% endblock %} {#- endblock app_copy #}
118120

121+
119122
{% block run %}
120123
{%- if config.docker_server %}
121124
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -133,7 +136,7 @@ COPY supervisord.conf {{ supervisor_config_path }}
133136
ENV SUPERVISOR_SERVER_URL="{{ supervisor_server_url }}"
134137
ENV SERVER_START_CMD="supervisord -c {{ supervisor_config_path }}"
135138
ENTRYPOINT ["supervisord", "-c", "{{ supervisor_config_path }}"]
136-
{%- elif requires_live_reload %} {#- elif requires_live_reload #}
139+
{%- elif config.live_reload %} {#- elif config.live_reload #}
137140
ENV HASH_TRUSS="{{ truss_hash }}"
138141
ENV CONTROL_SERVER_PORT="8080"
139142
ENV INFERENCE_SERVER_PORT="8090"

0 commit comments

Comments
 (0)