truss 0.11.9rc2__py3-none-any.whl → 0.11.9rc4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of truss might be problematic. Click here for more details.
- truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py +29 -17
- {truss-0.11.9rc2.dist-info → truss-0.11.9rc4.dist-info}/METADATA +1 -1
- {truss-0.11.9rc2.dist-info → truss-0.11.9rc4.dist-info}/RECORD +6 -6
- {truss-0.11.9rc2.dist-info → truss-0.11.9rc4.dist-info}/WHEEL +0 -0
- {truss-0.11.9rc2.dist-info → truss-0.11.9rc4.dist-info}/entry_points.txt +0 -0
- {truss-0.11.9rc2.dist-info → truss-0.11.9rc4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
import subprocess
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
from typing import Optional
|
|
@@ -30,7 +31,7 @@ class ModelContainerPatchApplier:
|
|
|
30
31
|
self,
|
|
31
32
|
inference_server_home: Path,
|
|
32
33
|
app_logger: logging.Logger,
|
|
33
|
-
|
|
34
|
+
uv_path: Optional[str] = None, # Only meant for testing
|
|
34
35
|
) -> None:
|
|
35
36
|
self._inference_server_home = inference_server_home
|
|
36
37
|
self._model_module_dir = (
|
|
@@ -40,10 +41,11 @@ class ModelContainerPatchApplier:
|
|
|
40
41
|
self._inference_server_home / ".." / self._truss_config.bundled_packages_dir
|
|
41
42
|
).resolve()
|
|
42
43
|
self._data_dir = self._inference_server_home / self._truss_config.data_dir
|
|
44
|
+
self._python_executable = os.environ.get("PYTHON_EXECUTABLE", "python3")
|
|
43
45
|
self._app_logger = app_logger
|
|
44
|
-
self.
|
|
45
|
-
if
|
|
46
|
-
self.
|
|
46
|
+
self._uv_path_cached = None
|
|
47
|
+
if uv_path is not None:
|
|
48
|
+
self._uv_path_cached = uv_path
|
|
47
49
|
|
|
48
50
|
def __call__(self, patch: Patch, inf_env: dict):
|
|
49
51
|
self._app_logger.debug(f"Applying patch {patch.to_dict()}")
|
|
@@ -79,10 +81,10 @@ class ModelContainerPatchApplier:
|
|
|
79
81
|
return TrussConfig.from_yaml(self._inference_server_home / "config.yaml")
|
|
80
82
|
|
|
81
83
|
@property
|
|
82
|
-
def
|
|
83
|
-
if self.
|
|
84
|
-
self.
|
|
85
|
-
return self.
|
|
84
|
+
def _uv_path(self) -> str:
|
|
85
|
+
if self._uv_path_cached is None:
|
|
86
|
+
self._uv_path_cached = _identify_uv_path()
|
|
87
|
+
return self._uv_path_cached
|
|
86
88
|
|
|
87
89
|
def _apply_python_requirement_patch(
|
|
88
90
|
self, python_requirement_patch: PythonRequirementPatch
|
|
@@ -95,20 +97,26 @@ class ModelContainerPatchApplier:
|
|
|
95
97
|
if action == Action.REMOVE:
|
|
96
98
|
subprocess.run(
|
|
97
99
|
[
|
|
98
|
-
self.
|
|
100
|
+
self._uv_path,
|
|
101
|
+
"pip",
|
|
99
102
|
"uninstall",
|
|
100
|
-
"-y",
|
|
101
103
|
python_requirement_patch.requirement,
|
|
104
|
+
"--yes",
|
|
105
|
+
"--python",
|
|
106
|
+
self._python_executable,
|
|
102
107
|
],
|
|
103
108
|
check=True,
|
|
104
109
|
)
|
|
105
110
|
elif action in [Action.ADD, Action.UPDATE]:
|
|
106
111
|
subprocess.run(
|
|
107
112
|
[
|
|
108
|
-
self.
|
|
113
|
+
self._uv_path,
|
|
114
|
+
"pip",
|
|
109
115
|
"install",
|
|
110
116
|
python_requirement_patch.requirement,
|
|
111
117
|
"--upgrade",
|
|
118
|
+
"--python",
|
|
119
|
+
self._python_executable,
|
|
112
120
|
],
|
|
113
121
|
check=True,
|
|
114
122
|
)
|
|
@@ -158,11 +166,15 @@ class ModelContainerPatchApplier:
|
|
|
158
166
|
raise ValueError(f"Unknown patch action {action}")
|
|
159
167
|
|
|
160
168
|
|
|
161
|
-
def
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
def _identify_uv_path() -> str:
|
|
170
|
+
candidate_paths: list[Path] = [
|
|
171
|
+
Path.home() / ".local" / "bin" / "uv",
|
|
172
|
+
Path("/usr/local/bin/uv"),
|
|
173
|
+
Path.home() / ".cargo" / "bin" / "uv",
|
|
174
|
+
]
|
|
164
175
|
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
for path in candidate_paths:
|
|
177
|
+
if path.exists():
|
|
178
|
+
return str(path)
|
|
167
179
|
|
|
168
|
-
raise RuntimeError("Unable to find
|
|
180
|
+
raise RuntimeError("Unable to find `uv, make sure it's installed.")
|
|
@@ -84,7 +84,7 @@ truss/templates/control/control/helpers/inference_server_process_controller.py,s
|
|
|
84
84
|
truss/templates/control/control/helpers/inference_server_starter.py,sha256=Fz2Puijro6Cc5cvTsAqOveNJbBQR_ARYJXl4lvETJ8Y,2633
|
|
85
85
|
truss/templates/control/control/helpers/truss_patch/__init__.py,sha256=CXZdUV_ylqLTJrKuFpvSnUT6PUFrZrMF2y6jiHbdaKU,998
|
|
86
86
|
truss/templates/control/control/helpers/truss_patch/model_code_patch_applier.py,sha256=LTIIADLz0wRn7V49j64dU1U7Hbta9YLde3pb5YZWvzQ,2001
|
|
87
|
-
truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py,sha256=
|
|
87
|
+
truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py,sha256=D8cvgfJ-nF4YBMy7u-MeSDqgKHBzeQi_2iXNP_M0H0c,6834
|
|
88
88
|
truss/templates/control/control/helpers/truss_patch/requirement_name_identifier.py,sha256=CL3KEAj4B3ApMQShd7TI5umXVbazLZY5StrNlwHwWtc,1995
|
|
89
89
|
truss/templates/control/control/helpers/truss_patch/system_packages.py,sha256=IYh1CVU_kooAvtSGXKQDDWnNdOhlv7ENWagsL1wvhgw,208
|
|
90
90
|
truss/templates/custom/examples.yaml,sha256=2UcCtEdavImWmiCtj31ckBlAKVOwNMC5AwMIIznKDag,48
|
|
@@ -369,8 +369,8 @@ truss_train/deployment.py,sha256=lWWANSuzBWu2M4oK4qD7n-oVR1JKdmw2Pn5BJQHg-Ck,307
|
|
|
369
369
|
truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
|
|
370
370
|
truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
|
|
371
371
|
truss_train/restore_from_checkpoint.py,sha256=8hdPm-WSgkt74HDPjvCjZMBpvA9MwtoYsxVjOoa7BaM,1176
|
|
372
|
-
truss-0.11.
|
|
373
|
-
truss-0.11.
|
|
374
|
-
truss-0.11.
|
|
375
|
-
truss-0.11.
|
|
376
|
-
truss-0.11.
|
|
372
|
+
truss-0.11.9rc4.dist-info/METADATA,sha256=pO0kvR_xTwz8YRpGcpiMaWlCNjJE4dxRtI5J_30aSdw,6680
|
|
373
|
+
truss-0.11.9rc4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
374
|
+
truss-0.11.9rc4.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
|
|
375
|
+
truss-0.11.9rc4.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
|
|
376
|
+
truss-0.11.9rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|