truss 0.11.2rc505__py3-none-any.whl → 0.11.3__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/api/__init__.py +5 -0
- truss/tests/patch/test_calc_patch.py +30 -51
- truss/tests/test_control_truss_patching.py +0 -2
- truss/truss_handle/patch/calc_patch.py +9 -6
- {truss-0.11.2rc505.dist-info → truss-0.11.3.dist-info}/METADATA +1 -1
- {truss-0.11.2rc505.dist-info → truss-0.11.3.dist-info}/RECORD +9 -9
- {truss-0.11.2rc505.dist-info → truss-0.11.3.dist-info}/WHEEL +0 -0
- {truss-0.11.2rc505.dist-info → truss-0.11.3.dist-info}/entry_points.txt +0 -0
- {truss-0.11.2rc505.dist-info → truss-0.11.3.dist-info}/licenses/LICENSE +0 -0
truss/api/__init__.py
CHANGED
|
@@ -64,6 +64,7 @@ def push(
|
|
|
64
64
|
environment: Optional[str] = None,
|
|
65
65
|
progress_bar: Optional[Type["progress.Progress"]] = None,
|
|
66
66
|
include_git_info: bool = False,
|
|
67
|
+
preserve_env_instance_type: bool = True,
|
|
67
68
|
) -> definitions.ModelDeployment:
|
|
68
69
|
"""
|
|
69
70
|
Pushes a Truss to Baseten.
|
|
@@ -88,6 +89,9 @@ def push(
|
|
|
88
89
|
include_git_info: Whether to attach git versioning info (sha, branch, tag) to
|
|
89
90
|
deployments made from within a git repo. If set to True in `.trussrc`, it
|
|
90
91
|
will always be attached.
|
|
92
|
+
preserve_env_instance_type: When pushing a truss to an environment, whether to use the resources
|
|
93
|
+
specified in the truss config to resolve the instance type or preserve the instance type
|
|
94
|
+
configured in the specified environment.
|
|
91
95
|
|
|
92
96
|
Returns:
|
|
93
97
|
The newly created ModelDeployment.
|
|
@@ -130,6 +134,7 @@ def push(
|
|
|
130
134
|
environment=environment,
|
|
131
135
|
progress_bar=progress_bar,
|
|
132
136
|
include_git_info=include_git_info,
|
|
137
|
+
preserve_env_instance_type=preserve_env_instance_type,
|
|
133
138
|
) # type: ignore
|
|
134
139
|
|
|
135
140
|
return definitions.ModelDeployment(cast(BasetenService, service))
|
|
@@ -16,7 +16,6 @@ from truss.templates.control.control.helpers.custom_types import (
|
|
|
16
16
|
Patch,
|
|
17
17
|
PatchType,
|
|
18
18
|
PythonRequirementPatch,
|
|
19
|
-
SystemPackagePatch,
|
|
20
19
|
)
|
|
21
20
|
from truss.truss_handle.patch.calc_patch import (
|
|
22
21
|
_calc_python_requirements_patches,
|
|
@@ -736,45 +735,33 @@ def test_calc_config_patches_add_remove_env_var(custom_model_truss_dir: Path):
|
|
|
736
735
|
]
|
|
737
736
|
|
|
738
737
|
|
|
739
|
-
def
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
body=ConfigPatch(
|
|
750
|
-
action=Action.UPDATE,
|
|
751
|
-
config=yaml.safe_load((custom_model_truss_dir / "config.yaml").open()),
|
|
752
|
-
),
|
|
753
|
-
),
|
|
754
|
-
]
|
|
738
|
+
def test_system_package_changes_make_truss_unpatchable_add(
|
|
739
|
+
custom_model_truss_dir: Path,
|
|
740
|
+
):
|
|
741
|
+
# System package changes should raise a ValueError indicating full rebuild required
|
|
742
|
+
with pytest.raises(
|
|
743
|
+
ValueError, match="System package changes detected - full rebuild required"
|
|
744
|
+
):
|
|
745
|
+
_apply_config_change_and_calc_patches(
|
|
746
|
+
custom_model_truss_dir, lambda config: config.system_packages.append("curl")
|
|
747
|
+
)
|
|
755
748
|
|
|
756
749
|
|
|
757
|
-
def
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
body=ConfigPatch(
|
|
770
|
-
action=Action.UPDATE,
|
|
771
|
-
config=yaml.safe_load((custom_model_truss_dir / "config.yaml").open()),
|
|
772
|
-
),
|
|
773
|
-
),
|
|
774
|
-
]
|
|
750
|
+
def test_system_package_changes_make_truss_unpatchable_remove(
|
|
751
|
+
custom_model_truss_dir: Path,
|
|
752
|
+
):
|
|
753
|
+
# System package changes should raise a ValueError indicating full rebuild required
|
|
754
|
+
with pytest.raises(
|
|
755
|
+
ValueError, match="System package changes detected - full rebuild required"
|
|
756
|
+
):
|
|
757
|
+
_apply_config_change_and_calc_patches(
|
|
758
|
+
custom_model_truss_dir,
|
|
759
|
+
config_pre_op=lambda config: config.system_packages.append("curl"),
|
|
760
|
+
config_op=lambda config: config.system_packages.clear(),
|
|
761
|
+
)
|
|
775
762
|
|
|
776
763
|
|
|
777
|
-
def
|
|
764
|
+
def test_system_package_changes_make_truss_unpatchable_modify(
|
|
778
765
|
custom_model_truss_dir: Path,
|
|
779
766
|
):
|
|
780
767
|
def config_pre_op(config: TrussConfig):
|
|
@@ -783,21 +770,13 @@ def test_calc_config_patches_add_and_remove_system_package(
|
|
|
783
770
|
def config_op(config: TrussConfig):
|
|
784
771
|
config.system_packages = ["curl", "libsnd"]
|
|
785
772
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
Patch(
|
|
794
|
-
type=PatchType.CONFIG,
|
|
795
|
-
body=ConfigPatch(
|
|
796
|
-
action=Action.UPDATE,
|
|
797
|
-
config=yaml.safe_load((custom_model_truss_dir / "config.yaml").open()),
|
|
798
|
-
),
|
|
799
|
-
),
|
|
800
|
-
]
|
|
773
|
+
# System package changes should raise a ValueError indicating full rebuild required
|
|
774
|
+
with pytest.raises(
|
|
775
|
+
ValueError, match="System package changes detected - full rebuild required"
|
|
776
|
+
):
|
|
777
|
+
_apply_config_change_and_calc_patches(
|
|
778
|
+
custom_model_truss_dir, config_pre_op=config_pre_op, config_op=config_op
|
|
779
|
+
)
|
|
801
780
|
|
|
802
781
|
|
|
803
782
|
def test_calc_config_patches_toggle_apply_library_patches(custom_model_truss_dir: Path):
|
|
@@ -145,7 +145,6 @@ def test_control_truss_python_sys_req_patch(
|
|
|
145
145
|
th.remove_python_requirement(req)
|
|
146
146
|
return th.docker_predict([1], tag=tag, binary=binary, local_port=None)
|
|
147
147
|
|
|
148
|
-
|
|
149
148
|
with ensure_kill_all():
|
|
150
149
|
th.docker_predict([1], tag=tag, binary=binary, local_port=None)
|
|
151
150
|
orig_num_truss_images = len(th.get_all_docker_images())
|
|
@@ -162,7 +161,6 @@ def test_control_truss_python_sys_req_patch(
|
|
|
162
161
|
verify_python_requirement_not_installed_on_container(container, python_req)
|
|
163
162
|
|
|
164
163
|
|
|
165
|
-
|
|
166
164
|
@pytest.mark.integration
|
|
167
165
|
@pytest.mark.parametrize(
|
|
168
166
|
"binary, python_version",
|
|
@@ -18,7 +18,6 @@ from truss.templates.control.control.helpers.custom_types import (
|
|
|
18
18
|
Patch,
|
|
19
19
|
PatchType,
|
|
20
20
|
PythonRequirementPatch,
|
|
21
|
-
SystemPackagePatch,
|
|
22
21
|
)
|
|
23
22
|
from truss.templates.control.control.helpers.truss_patch.requirement_name_identifier import (
|
|
24
23
|
RequirementMeta,
|
|
@@ -423,13 +422,17 @@ def _calc_python_requirements_patches(
|
|
|
423
422
|
def _calc_system_packages_patches(
|
|
424
423
|
prev_config: TrussConfig, new_config: TrussConfig
|
|
425
424
|
) -> List[Patch]:
|
|
426
|
-
"""Calculate patch based on changes to system
|
|
425
|
+
"""Calculate patch based on changes to system packages.
|
|
427
426
|
|
|
428
|
-
System package patches are no longer supported, so this
|
|
429
|
-
|
|
427
|
+
System package patches are no longer supported, so this function
|
|
428
|
+
raises an exception if any system package changes are detected.
|
|
430
429
|
"""
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
prev_pkgs = system_packages_set(prev_config.system_packages)
|
|
431
|
+
new_pkgs = system_packages_set(new_config.system_packages)
|
|
432
|
+
|
|
433
|
+
if prev_pkgs != new_pkgs:
|
|
434
|
+
raise ValueError("System package changes detected - full rebuild required")
|
|
435
|
+
|
|
433
436
|
return []
|
|
434
437
|
|
|
435
438
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
truss/__init__.py,sha256=CoUcP6vx_pocyemRmpbCPlndkHhdMkABAlr0ZXVuPCk,1163
|
|
2
|
-
truss/api/__init__.py,sha256=
|
|
2
|
+
truss/api/__init__.py,sha256=5GTE2rlupet-beaawUr0FPyDPEJ9UyBTUpJmCE3RGfc,5453
|
|
3
3
|
truss/api/definitions.py,sha256=QAaIBqL59Q-R7HtLcXcoeCIWBN2HqOzApdFX0PpCq2s,1604
|
|
4
4
|
truss/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
truss/base/constants.py,sha256=sExArdnuGg83z83XMgaQ4b8SS3V_j_bJEpOATDGJzpE,3600
|
|
@@ -131,7 +131,7 @@ truss/tests/helpers.py,sha256=DKnUGzmt-k4IN_wSnlAXbVYCiEt58xFzFmmuCDSQ0dg,555
|
|
|
131
131
|
truss/tests/test_build.py,sha256=Wq4sM9tmZFVTCN3YljvOcn04Kkj-L-41Tlw0DKQ8Z7c,709
|
|
132
132
|
truss/tests/test_config.py,sha256=AVpVCL_XHYXKSGHzwecrh7BAJlB_Wr5AUlnnwMqWM98,30559
|
|
133
133
|
truss/tests/test_context_builder_image.py,sha256=fVZNJSzZNiWa7Dr1X_VhhMJtyJ5HzsLaPglOr6NV2CA,1105
|
|
134
|
-
truss/tests/test_control_truss_patching.py,sha256=
|
|
134
|
+
truss/tests/test_control_truss_patching.py,sha256=qQOUfyF1MorZ_obOvPJK9utI4HUAzgT6YBS-fo90TEw,14497
|
|
135
135
|
truss/tests/test_custom_server.py,sha256=GP2qMgnqxJMPRtfEciqbhBcG0_JUK7gNL7nrXPGrSLg,1305
|
|
136
136
|
truss/tests/test_docker.py,sha256=3RI6jEC9CVQsKj83s_gOBl3EkdOaov-KEX4IihfMJW4,523
|
|
137
137
|
truss/tests/test_model_inference.py,sha256=9QfPMa1kjxvKCWg5XKocjwcpfDkKB7pWd8bn4hIkshk,76213
|
|
@@ -150,7 +150,7 @@ truss/tests/contexts/image_builder/test_serving_image_builder.py,sha256=16niCXZn
|
|
|
150
150
|
truss/tests/contexts/local_loader/test_load_local.py,sha256=D1qMH2IpYA2j5009v50QMgUnKdeOsX15ndkwXe10a4E,801
|
|
151
151
|
truss/tests/contexts/local_loader/test_truss_module_finder.py,sha256=oN1K2lg3ATHY5yOVUTfQIaSqusTF9I2wFaYaTSo5-O4,5342
|
|
152
152
|
truss/tests/local/test_local_config_handler.py,sha256=aLvcOyfppskA2MziVLy_kMcagjxMpO4mjar9zxUN6g0,2245
|
|
153
|
-
truss/tests/patch/test_calc_patch.py,sha256=
|
|
153
|
+
truss/tests/patch/test_calc_patch.py,sha256=ClvrkNvxc5-bclXZUnqCis0bS1he2vbxn3DIcrR1WuU,31082
|
|
154
154
|
truss/tests/patch/test_dir_signature.py,sha256=HnG9Cyqt86YagYkY-jurSf36yYP2oM7PQvfb_d5T2mY,1033
|
|
155
155
|
truss/tests/patch/test_hash.py,sha256=VsGAllNP653rmyrvPYBRY1gEc0gTpLl38tAhjXFUGGM,5997
|
|
156
156
|
truss/tests/patch/test_signature.py,sha256=vdAy5dbIqTEWLZVpO6szTGdNTRZgE8PtABGuhPP0Y6s,728
|
|
@@ -325,7 +325,7 @@ truss/truss_handle/readme_generator.py,sha256=B4XbGwUjzMNOr71DWNAL8kCu5_ZHq7YOM8
|
|
|
325
325
|
truss/truss_handle/truss_gatherer.py,sha256=Xysl_UnCVhehPfZeHa8p7WFp94ENqh-VVpbuqnCui3A,2870
|
|
326
326
|
truss/truss_handle/truss_handle.py,sha256=WF2MQSly9DQ1SoAvqfi87Ulu4llTadpXoncsDjpL79E,40886
|
|
327
327
|
truss/truss_handle/patch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
328
|
-
truss/truss_handle/patch/calc_patch.py,sha256=
|
|
328
|
+
truss/truss_handle/patch/calc_patch.py,sha256=_-cBKRiRgleqn7vtqG53Ta18zTE0BWTAQEgFeKCUtK4,17971
|
|
329
329
|
truss/truss_handle/patch/constants.py,sha256=pCEi5Pwi8Rnqthrr3VEsWL9EP1P1VV1T8DEYuitHLmc,139
|
|
330
330
|
truss/truss_handle/patch/custom_types.py,sha256=QklzhgLD_PpvNvNYQCvujAd16eYEaDGfLA1scxk6zsA,3481
|
|
331
331
|
truss/truss_handle/patch/dir_signature.py,sha256=UCdZCzXkI-l-ae0I0pdmB2bavB9qzhhOKYXyLnDFQZY,921
|
|
@@ -368,8 +368,8 @@ truss_train/deployment.py,sha256=lWWANSuzBWu2M4oK4qD7n-oVR1JKdmw2Pn5BJQHg-Ck,307
|
|
|
368
368
|
truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
|
|
369
369
|
truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
|
|
370
370
|
truss_train/restore_from_checkpoint.py,sha256=KmJuTUVpvtvlkEClcmllxAF2TKgbp-FuzfblfGh06XA,1239
|
|
371
|
-
truss-0.11.
|
|
372
|
-
truss-0.11.
|
|
373
|
-
truss-0.11.
|
|
374
|
-
truss-0.11.
|
|
375
|
-
truss-0.11.
|
|
371
|
+
truss-0.11.3.dist-info/METADATA,sha256=tzcaX0tJ3oM9TfBC0FGlbh3No2PfcyBO4Yfg3IPMkKE,6669
|
|
372
|
+
truss-0.11.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
373
|
+
truss-0.11.3.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
|
|
374
|
+
truss-0.11.3.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
|
|
375
|
+
truss-0.11.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|