truefoundry 0.5.1rc6__py3-none-any.whl → 0.5.1rc8__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 truefoundry might be problematic. Click here for more details.
- truefoundry/common/constants.py +9 -0
- truefoundry/deploy/builder/builders/tfy_notebook_buildpack/__init__.py +4 -2
- truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py +7 -5
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +87 -28
- truefoundry/deploy/builder/constants.py +8 -0
- truefoundry/deploy/builder/utils.py +9 -4
- truefoundry/ml/autogen/client/__init__.py +12 -3
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +164 -0
- truefoundry/ml/autogen/client/models/__init__.py +12 -3
- truefoundry/ml/autogen/client/models/sklearn_framework.py +4 -7
- truefoundry/ml/autogen/client/models/sklearn_model_schema.py +1 -1
- truefoundry/ml/autogen/client/models/{serialization_format.py → sklearn_serialization_format.py} +5 -5
- truefoundry/ml/autogen/client/models/validate_external_storage_root_request_dto.py +71 -0
- truefoundry/ml/autogen/client/models/validate_external_storage_root_response_dto.py +69 -0
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +4 -7
- truefoundry/ml/autogen/client/models/xg_boost_model_schema.py +10 -4
- truefoundry/ml/autogen/client/models/xg_boost_serialization_format.py +36 -0
- truefoundry/ml/autogen/client_README.md +5 -1
- truefoundry/ml/autogen/entities/artifacts.py +49 -36
- truefoundry/ml/model_framework.py +97 -69
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc8.dist-info}/METADATA +1 -1
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc8.dist-info}/RECORD +24 -21
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc8.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.1rc6.dist-info → truefoundry-0.5.1rc8.dist-info}/entry_points.txt +0 -0
truefoundry/common/constants.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import enum
|
|
1
2
|
import os
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Optional
|
|
@@ -15,6 +16,11 @@ TFY_INTERNAL_SIGNED_URL_SERVER_HOST_ENV_KEY = "TFY_INTERNAL_SIGNED_URL_SERVER_HO
|
|
|
15
16
|
TFY_INTERNAL_SIGNED_URL_SERVER_TOKEN_ENV_KEY = "TFY_INTERNAL_SIGNED_URL_SERVER_TOKEN"
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
class PythonPackageManager(str, enum.Enum):
|
|
20
|
+
PIP = "pip"
|
|
21
|
+
UV = "uv"
|
|
22
|
+
|
|
23
|
+
|
|
18
24
|
class TrueFoundrySdkEnv(BaseSettings):
|
|
19
25
|
# Note: Every field in this class should have a default value
|
|
20
26
|
# Never expect the user to set these values
|
|
@@ -46,6 +52,9 @@ class TrueFoundrySdkEnv(BaseSettings):
|
|
|
46
52
|
# For local development, this enables futher configuration via _TFYServersConfig
|
|
47
53
|
TFY_CLI_LOCAL_DEV_MODE: bool = False
|
|
48
54
|
|
|
55
|
+
TFY_PYTHON_BUILD_PACKAGE_MANAGER: PythonPackageManager = PythonPackageManager.PIP
|
|
56
|
+
TFY_PYTHON_BUILD_UV_IMAGE_URI: str = "ghcr.io/astral-sh/uv:latest"
|
|
57
|
+
|
|
49
58
|
|
|
50
59
|
ENV_VARS = TrueFoundrySdkEnv()
|
|
51
60
|
API_SERVER_RELATIVE_PATH = "api/svc"
|
|
@@ -8,7 +8,7 @@ from truefoundry.deploy.builder.builders.tfy_notebook_buildpack.dockerfile_templ
|
|
|
8
8
|
NotebookImageBuild,
|
|
9
9
|
generate_dockerfile_content,
|
|
10
10
|
)
|
|
11
|
-
from truefoundry.deploy.builder.utils import
|
|
11
|
+
from truefoundry.deploy.builder.utils import has_python_package_manager_conf_secret
|
|
12
12
|
|
|
13
13
|
__all__ = ["generate_dockerfile_content", "build"]
|
|
14
14
|
|
|
@@ -38,7 +38,9 @@ def build(
|
|
|
38
38
|
build_configuration: NotebookImageBuild,
|
|
39
39
|
extra_opts: Optional[List[str]] = None,
|
|
40
40
|
):
|
|
41
|
-
mount_pip_conf_secret =
|
|
41
|
+
mount_pip_conf_secret = (
|
|
42
|
+
has_python_package_manager_conf_secret(extra_opts) if extra_opts else False
|
|
43
|
+
)
|
|
42
44
|
with TemporaryDirectory() as local_dir:
|
|
43
45
|
docker_build_configuration = _convert_to_dockerfile_build_config(
|
|
44
46
|
build_configuration,
|
|
@@ -7,7 +7,7 @@ from truefoundry.deploy.builder.builders import dockerfile
|
|
|
7
7
|
from truefoundry.deploy.builder.builders.tfy_python_buildpack.dockerfile_template import (
|
|
8
8
|
generate_dockerfile_content,
|
|
9
9
|
)
|
|
10
|
-
from truefoundry.deploy.builder.utils import
|
|
10
|
+
from truefoundry.deploy.builder.utils import has_python_package_manager_conf_secret
|
|
11
11
|
|
|
12
12
|
__all__ = ["generate_dockerfile_content", "build"]
|
|
13
13
|
|
|
@@ -15,11 +15,11 @@ __all__ = ["generate_dockerfile_content", "build"]
|
|
|
15
15
|
def _convert_to_dockerfile_build_config(
|
|
16
16
|
build_configuration: PythonBuild,
|
|
17
17
|
dockerfile_path: str,
|
|
18
|
-
|
|
18
|
+
mount_python_package_manager_conf_secret: bool = False,
|
|
19
19
|
) -> DockerFileBuild:
|
|
20
20
|
dockerfile_content = generate_dockerfile_content(
|
|
21
21
|
build_configuration=build_configuration,
|
|
22
|
-
|
|
22
|
+
mount_python_package_manager_conf_secret=mount_python_package_manager_conf_secret,
|
|
23
23
|
)
|
|
24
24
|
with open(dockerfile_path, "w", encoding="utf8") as fp:
|
|
25
25
|
fp.write(dockerfile_content)
|
|
@@ -36,12 +36,14 @@ def build(
|
|
|
36
36
|
build_configuration: PythonBuild,
|
|
37
37
|
extra_opts: Optional[List[str]] = None,
|
|
38
38
|
):
|
|
39
|
-
|
|
39
|
+
mount_python_package_manager_conf_secret = (
|
|
40
|
+
has_python_package_manager_conf_secret(extra_opts) if extra_opts else False
|
|
41
|
+
)
|
|
40
42
|
with TemporaryDirectory() as local_dir:
|
|
41
43
|
docker_build_configuration = _convert_to_dockerfile_build_config(
|
|
42
44
|
build_configuration,
|
|
43
45
|
dockerfile_path=os.path.join(local_dir, "Dockerfile"),
|
|
44
|
-
|
|
46
|
+
mount_python_package_manager_conf_secret=mount_python_package_manager_conf_secret,
|
|
45
47
|
)
|
|
46
48
|
dockerfile.build(
|
|
47
49
|
tag=tag,
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import shlex
|
|
2
3
|
from typing import Dict, List, Optional
|
|
3
4
|
|
|
4
5
|
from mako.template import Template
|
|
5
6
|
|
|
6
|
-
from truefoundry.common.constants import ENV_VARS
|
|
7
|
+
from truefoundry.common.constants import ENV_VARS, PythonPackageManager
|
|
7
8
|
from truefoundry.deploy.auto_gen.models import PythonBuild
|
|
8
9
|
from truefoundry.deploy.builder.constants import (
|
|
9
10
|
PIP_CONF_BUILDKIT_SECRET_MOUNT,
|
|
10
11
|
PIP_CONF_SECRET_MOUNT_AS_ENV,
|
|
12
|
+
UV_CONF_BUILDKIT_SECRET_MOUNT,
|
|
13
|
+
UV_CONF_SECRET_MOUNT_AS_ENV,
|
|
11
14
|
)
|
|
12
15
|
from truefoundry.deploy.v2.lib.patched_models import CUDAVersion
|
|
13
16
|
|
|
@@ -22,8 +25,8 @@ RUN ${apt_install_command}
|
|
|
22
25
|
% if requirements_path is not None:
|
|
23
26
|
COPY ${requirements_path} ${requirements_destination_path}
|
|
24
27
|
% endif
|
|
25
|
-
% if
|
|
26
|
-
RUN ${
|
|
28
|
+
% if python_packages_install_command is not None:
|
|
29
|
+
RUN ${package_manager_config_secret_mount} ${python_packages_install_command}
|
|
27
30
|
% endif
|
|
28
31
|
COPY . /app
|
|
29
32
|
WORKDIR /app
|
|
@@ -114,44 +117,91 @@ def generate_pip_install_command(
|
|
|
114
117
|
mount_pip_conf_secret: bool = False,
|
|
115
118
|
) -> Optional[str]:
|
|
116
119
|
upgrade_pip_command = "python -m pip install -U pip setuptools wheel"
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
envs = []
|
|
121
|
+
if mount_pip_conf_secret:
|
|
122
|
+
envs.append(PIP_CONF_SECRET_MOUNT_AS_ENV)
|
|
123
|
+
|
|
124
|
+
command = ["python", "-m", "pip", "install", "--use-pep517", "--no-cache-dir"]
|
|
125
|
+
args = []
|
|
119
126
|
if requirements_path:
|
|
120
|
-
|
|
127
|
+
args.append("-r")
|
|
128
|
+
args.append(requirements_path)
|
|
121
129
|
|
|
122
130
|
if pip_packages:
|
|
123
|
-
|
|
124
|
-
final_pip_install_command or pip_install_base_command
|
|
125
|
-
)
|
|
126
|
-
final_pip_install_command += " " + " ".join(
|
|
127
|
-
f"'{package}'" for package in pip_packages
|
|
128
|
-
)
|
|
131
|
+
args.extend(pip_packages)
|
|
129
132
|
|
|
130
|
-
if not
|
|
133
|
+
if not args:
|
|
131
134
|
return None
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
final_pip_install_command = shlex.join(envs + command + args)
|
|
137
|
+
final_docker_run_command = " && ".join(
|
|
138
|
+
[upgrade_pip_command, final_pip_install_command]
|
|
139
|
+
)
|
|
140
|
+
return final_docker_run_command
|
|
137
141
|
|
|
138
|
-
|
|
142
|
+
|
|
143
|
+
def generate_uv_pip_install_command(
|
|
144
|
+
requirements_path: Optional[str],
|
|
145
|
+
pip_packages: Optional[List[str]],
|
|
146
|
+
mount_uv_conf_secret: bool = False,
|
|
147
|
+
) -> Optional[str]:
|
|
148
|
+
upgrade_pip_command = "python -m pip install -U pip setuptools wheel"
|
|
149
|
+
uv_mount = f"--mount=from={ENV_VARS.TFY_PYTHON_BUILD_UV_IMAGE_URI},source=/uv,target=/usr/local/bin/uv"
|
|
150
|
+
envs = [
|
|
151
|
+
"UV_SYSTEM_PYTHON=true",
|
|
152
|
+
"UV_LINK_MODE=copy",
|
|
153
|
+
"UV_PYTHON_DOWNLOADS=never",
|
|
154
|
+
"UV_INDEX_STRATEGY=unsafe-best-match",
|
|
155
|
+
]
|
|
156
|
+
if mount_uv_conf_secret:
|
|
157
|
+
envs.append(UV_CONF_SECRET_MOUNT_AS_ENV)
|
|
158
|
+
|
|
159
|
+
command = ["uv", "pip", "install", "--no-cache-dir"]
|
|
160
|
+
|
|
161
|
+
args = []
|
|
162
|
+
|
|
163
|
+
if requirements_path:
|
|
164
|
+
args.append("-r")
|
|
165
|
+
args.append(requirements_path)
|
|
166
|
+
|
|
167
|
+
if pip_packages:
|
|
168
|
+
args.extend(pip_packages)
|
|
169
|
+
|
|
170
|
+
if not args:
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
uv_pip_install_command = shlex.join(envs + command + args)
|
|
174
|
+
shell_commands = " && ".join([upgrade_pip_command, uv_pip_install_command])
|
|
175
|
+
final_docker_run_command = " ".join([uv_mount, shell_commands])
|
|
176
|
+
|
|
177
|
+
return final_docker_run_command
|
|
139
178
|
|
|
140
179
|
|
|
141
180
|
def generate_dockerfile_content(
|
|
142
181
|
build_configuration: PythonBuild,
|
|
143
|
-
|
|
182
|
+
package_manager: str = ENV_VARS.TFY_PYTHON_BUILD_PACKAGE_MANAGER,
|
|
183
|
+
mount_python_package_manager_conf_secret: bool = False,
|
|
144
184
|
) -> str:
|
|
145
185
|
# TODO (chiragjn): Handle recursive references to other requirements files e.g. `-r requirements-gpu.txt`
|
|
146
186
|
requirements_path = resolve_requirements_txt_path(build_configuration)
|
|
147
187
|
requirements_destination_path = (
|
|
148
188
|
"/tmp/requirements.txt" if requirements_path else None
|
|
149
189
|
)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
190
|
+
if package_manager == PythonPackageManager.PIP.value:
|
|
191
|
+
python_packages_install_command = generate_pip_install_command(
|
|
192
|
+
requirements_path=requirements_destination_path,
|
|
193
|
+
pip_packages=build_configuration.pip_packages,
|
|
194
|
+
mount_pip_conf_secret=mount_python_package_manager_conf_secret,
|
|
195
|
+
)
|
|
196
|
+
elif package_manager == PythonPackageManager.UV.value:
|
|
197
|
+
python_packages_install_command = generate_uv_pip_install_command(
|
|
198
|
+
requirements_path=requirements_destination_path,
|
|
199
|
+
pip_packages=build_configuration.pip_packages,
|
|
200
|
+
mount_uv_conf_secret=mount_python_package_manager_conf_secret,
|
|
201
|
+
)
|
|
202
|
+
else:
|
|
203
|
+
raise ValueError(f"Unsupported package manager: {package_manager}")
|
|
204
|
+
|
|
155
205
|
apt_install_command = generate_apt_install_command(
|
|
156
206
|
apt_packages=build_configuration.apt_packages
|
|
157
207
|
)
|
|
@@ -161,13 +211,22 @@ def generate_dockerfile_content(
|
|
|
161
211
|
"apt_install_command": apt_install_command,
|
|
162
212
|
"requirements_path": requirements_path,
|
|
163
213
|
"requirements_destination_path": requirements_destination_path,
|
|
164
|
-
"
|
|
214
|
+
"python_packages_install_command": python_packages_install_command,
|
|
165
215
|
}
|
|
166
216
|
|
|
167
|
-
if
|
|
168
|
-
|
|
217
|
+
if mount_python_package_manager_conf_secret:
|
|
218
|
+
if package_manager == PythonPackageManager.PIP.value:
|
|
219
|
+
template_args["package_manager_config_secret_mount"] = (
|
|
220
|
+
PIP_CONF_BUILDKIT_SECRET_MOUNT
|
|
221
|
+
)
|
|
222
|
+
elif package_manager == PythonPackageManager.UV.value:
|
|
223
|
+
template_args["package_manager_config_secret_mount"] = (
|
|
224
|
+
UV_CONF_BUILDKIT_SECRET_MOUNT
|
|
225
|
+
)
|
|
226
|
+
else:
|
|
227
|
+
raise ValueError(f"Unsupported package manager: {package_manager}")
|
|
169
228
|
else:
|
|
170
|
-
template_args["
|
|
229
|
+
template_args["package_manager_config_secret_mount"] = ""
|
|
171
230
|
|
|
172
231
|
if build_configuration.cuda_version:
|
|
173
232
|
template = CUDA_DOCKERFILE_TEMPLATE
|
|
@@ -5,3 +5,11 @@ PIP_CONF_BUILDKIT_SECRET_MOUNT = (
|
|
|
5
5
|
PIP_CONF_SECRET_MOUNT_AS_ENV = (
|
|
6
6
|
f"PIP_CONFIG_FILE=/run/secrets/{BUILDKIT_SECRET_MOUNT_PIP_CONF_ID}"
|
|
7
7
|
)
|
|
8
|
+
|
|
9
|
+
BUILDKIT_SECRET_MOUNT_UV_CONF_ID = "uv.toml"
|
|
10
|
+
UV_CONF_BUILDKIT_SECRET_MOUNT = (
|
|
11
|
+
f"--mount=type=secret,id={BUILDKIT_SECRET_MOUNT_UV_CONF_ID}"
|
|
12
|
+
)
|
|
13
|
+
UV_CONF_SECRET_MOUNT_AS_ENV = (
|
|
14
|
+
f"UV_CONFIG_FILE=/run/secrets/{BUILDKIT_SECRET_MOUNT_UV_CONF_ID}"
|
|
15
|
+
)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
from typing import List, Optional
|
|
2
2
|
|
|
3
|
-
from truefoundry.deploy.builder.constants import
|
|
3
|
+
from truefoundry.deploy.builder.constants import (
|
|
4
|
+
BUILDKIT_SECRET_MOUNT_PIP_CONF_ID,
|
|
5
|
+
BUILDKIT_SECRET_MOUNT_UV_CONF_ID,
|
|
6
|
+
)
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
def _get_id_from_buildkit_secret_value(value: str) -> Optional[str]:
|
|
@@ -19,14 +22,16 @@ def _get_id_from_buildkit_secret_value(value: str) -> Optional[str]:
|
|
|
19
22
|
return None
|
|
20
23
|
|
|
21
24
|
|
|
22
|
-
def
|
|
25
|
+
def has_python_package_manager_conf_secret(docker_build_extra_args: List[str]) -> bool:
|
|
23
26
|
args = [arg.strip() for arg in docker_build_extra_args]
|
|
24
27
|
for i, arg in enumerate(docker_build_extra_args):
|
|
25
28
|
if (
|
|
26
29
|
arg == "--secret"
|
|
27
30
|
and i + 1 < len(args)
|
|
28
|
-
and
|
|
29
|
-
|
|
31
|
+
and (
|
|
32
|
+
_get_id_from_buildkit_secret_value(args[i + 1])
|
|
33
|
+
in (BUILDKIT_SECRET_MOUNT_PIP_CONF_ID, BUILDKIT_SECRET_MOUNT_UV_CONF_ID)
|
|
34
|
+
)
|
|
30
35
|
):
|
|
31
36
|
return True
|
|
32
37
|
return False
|
|
@@ -363,9 +363,6 @@ from truefoundry.ml.autogen.client.models.search_runs_request_dto import (
|
|
|
363
363
|
from truefoundry.ml.autogen.client.models.search_runs_response_dto import (
|
|
364
364
|
SearchRunsResponseDto,
|
|
365
365
|
)
|
|
366
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
367
|
-
SerializationFormat,
|
|
368
|
-
)
|
|
369
366
|
from truefoundry.ml.autogen.client.models.set_experiment_tag_request_dto import (
|
|
370
367
|
SetExperimentTagRequestDto,
|
|
371
368
|
)
|
|
@@ -373,6 +370,9 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
373
370
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
374
371
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
375
372
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
373
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
374
|
+
SklearnSerializationFormat,
|
|
375
|
+
)
|
|
376
376
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
377
377
|
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
378
378
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
@@ -423,6 +423,12 @@ from truefoundry.ml.autogen.client.models.update_run_response_dto import (
|
|
|
423
423
|
)
|
|
424
424
|
from truefoundry.ml.autogen.client.models.url import Url
|
|
425
425
|
from truefoundry.ml.autogen.client.models.user_message import UserMessage
|
|
426
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
427
|
+
ValidateExternalStorageRootRequestDto,
|
|
428
|
+
)
|
|
429
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
430
|
+
ValidateExternalStorageRootResponseDto,
|
|
431
|
+
)
|
|
426
432
|
from truefoundry.ml.autogen.client.models.validation_error import ValidationError
|
|
427
433
|
from truefoundry.ml.autogen.client.models.validation_error_loc_inner import (
|
|
428
434
|
ValidationErrorLocInner,
|
|
@@ -431,3 +437,6 @@ from truefoundry.ml.autogen.client.models.xg_boost_framework import XGBoostFrame
|
|
|
431
437
|
from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
|
|
432
438
|
XGBoostModelSchema,
|
|
433
439
|
)
|
|
440
|
+
from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
|
|
441
|
+
XGBoostSerializationFormat,
|
|
442
|
+
)
|
|
@@ -167,6 +167,12 @@ from truefoundry.ml.autogen.client.models.update_dataset_request_dto import (
|
|
|
167
167
|
from truefoundry.ml.autogen.client.models.update_model_version_request_dto import (
|
|
168
168
|
UpdateModelVersionRequestDto,
|
|
169
169
|
)
|
|
170
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
171
|
+
ValidateExternalStorageRootRequestDto,
|
|
172
|
+
)
|
|
173
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
174
|
+
ValidateExternalStorageRootResponseDto,
|
|
175
|
+
)
|
|
170
176
|
from truefoundry.pydantic_v1 import (
|
|
171
177
|
StrictInt,
|
|
172
178
|
StrictStr,
|
|
@@ -7215,3 +7221,161 @@ class MlfoundryArtifactsApi:
|
|
|
7215
7221
|
collection_formats=_collection_formats,
|
|
7216
7222
|
_request_auth=_params.get("_request_auth"),
|
|
7217
7223
|
)
|
|
7224
|
+
|
|
7225
|
+
@validate_arguments
|
|
7226
|
+
def validate_external_storage_root_path_post(
|
|
7227
|
+
self,
|
|
7228
|
+
validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto,
|
|
7229
|
+
**kwargs,
|
|
7230
|
+
) -> ValidateExternalStorageRootResponseDto: # noqa: E501
|
|
7231
|
+
"""Validate External Storage Root Path # noqa: E501
|
|
7232
|
+
|
|
7233
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
7234
|
+
asynchronous HTTP request, please pass async_req=True
|
|
7235
|
+
|
|
7236
|
+
>>> thread = api.validate_external_storage_root_path_post(validate_external_storage_root_request_dto, async_req=True)
|
|
7237
|
+
>>> result = thread.get()
|
|
7238
|
+
|
|
7239
|
+
:param validate_external_storage_root_request_dto: (required)
|
|
7240
|
+
:type validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto
|
|
7241
|
+
:param async_req: Whether to execute the request asynchronously.
|
|
7242
|
+
:type async_req: bool, optional
|
|
7243
|
+
:param _request_timeout: timeout setting for this request.
|
|
7244
|
+
If one number provided, it will be total request
|
|
7245
|
+
timeout. It can also be a pair (tuple) of
|
|
7246
|
+
(connection, read) timeouts.
|
|
7247
|
+
:return: Returns the result object.
|
|
7248
|
+
If the method is called asynchronously,
|
|
7249
|
+
returns the request thread.
|
|
7250
|
+
:rtype: ValidateExternalStorageRootResponseDto
|
|
7251
|
+
"""
|
|
7252
|
+
kwargs["_return_http_data_only"] = True
|
|
7253
|
+
if "_preload_content" in kwargs:
|
|
7254
|
+
message = "Error! Please call the validate_external_storage_root_path_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
|
|
7255
|
+
raise ValueError(message)
|
|
7256
|
+
return self.validate_external_storage_root_path_post_with_http_info(
|
|
7257
|
+
validate_external_storage_root_request_dto, **kwargs
|
|
7258
|
+
) # noqa: E501
|
|
7259
|
+
|
|
7260
|
+
@validate_arguments
|
|
7261
|
+
def validate_external_storage_root_path_post_with_http_info(
|
|
7262
|
+
self,
|
|
7263
|
+
validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto,
|
|
7264
|
+
**kwargs,
|
|
7265
|
+
) -> ApiResponse: # noqa: E501
|
|
7266
|
+
"""Validate External Storage Root Path # noqa: E501
|
|
7267
|
+
|
|
7268
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
7269
|
+
asynchronous HTTP request, please pass async_req=True
|
|
7270
|
+
|
|
7271
|
+
>>> thread = api.validate_external_storage_root_path_post_with_http_info(validate_external_storage_root_request_dto, async_req=True)
|
|
7272
|
+
>>> result = thread.get()
|
|
7273
|
+
|
|
7274
|
+
:param validate_external_storage_root_request_dto: (required)
|
|
7275
|
+
:type validate_external_storage_root_request_dto: ValidateExternalStorageRootRequestDto
|
|
7276
|
+
:param async_req: Whether to execute the request asynchronously.
|
|
7277
|
+
:type async_req: bool, optional
|
|
7278
|
+
:param _preload_content: if False, the ApiResponse.data will
|
|
7279
|
+
be set to none and raw_data will store the
|
|
7280
|
+
HTTP response body without reading/decoding.
|
|
7281
|
+
Default is True.
|
|
7282
|
+
:type _preload_content: bool, optional
|
|
7283
|
+
:param _return_http_data_only: response data instead of ApiResponse
|
|
7284
|
+
object with status code, headers, etc
|
|
7285
|
+
:type _return_http_data_only: bool, optional
|
|
7286
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
7287
|
+
number provided, it will be total request
|
|
7288
|
+
timeout. It can also be a pair (tuple) of
|
|
7289
|
+
(connection, read) timeouts.
|
|
7290
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
7291
|
+
request; this effectively ignores the authentication
|
|
7292
|
+
in the spec for a single request.
|
|
7293
|
+
:type _request_auth: dict, optional
|
|
7294
|
+
:type _content_type: string, optional: force content-type for the request
|
|
7295
|
+
:return: Returns the result object.
|
|
7296
|
+
If the method is called asynchronously,
|
|
7297
|
+
returns the request thread.
|
|
7298
|
+
:rtype: tuple(ValidateExternalStorageRootResponseDto, status_code(int), headers(HTTPHeaderDict))
|
|
7299
|
+
"""
|
|
7300
|
+
|
|
7301
|
+
_params = locals()
|
|
7302
|
+
|
|
7303
|
+
_all_params = ["validate_external_storage_root_request_dto"]
|
|
7304
|
+
_all_params.extend(
|
|
7305
|
+
[
|
|
7306
|
+
"async_req",
|
|
7307
|
+
"_return_http_data_only",
|
|
7308
|
+
"_preload_content",
|
|
7309
|
+
"_request_timeout",
|
|
7310
|
+
"_request_auth",
|
|
7311
|
+
"_content_type",
|
|
7312
|
+
"_headers",
|
|
7313
|
+
]
|
|
7314
|
+
)
|
|
7315
|
+
|
|
7316
|
+
# validate the arguments
|
|
7317
|
+
for _key, _val in _params["kwargs"].items():
|
|
7318
|
+
if _key not in _all_params:
|
|
7319
|
+
raise ApiTypeError(
|
|
7320
|
+
"Got an unexpected keyword argument '%s'"
|
|
7321
|
+
" to method validate_external_storage_root_path_post" % _key
|
|
7322
|
+
)
|
|
7323
|
+
_params[_key] = _val
|
|
7324
|
+
del _params["kwargs"]
|
|
7325
|
+
|
|
7326
|
+
_collection_formats = {}
|
|
7327
|
+
|
|
7328
|
+
# process the path parameters
|
|
7329
|
+
_path_params = {}
|
|
7330
|
+
|
|
7331
|
+
# process the query parameters
|
|
7332
|
+
_query_params = []
|
|
7333
|
+
# process the header parameters
|
|
7334
|
+
_header_params = dict(_params.get("_headers", {}))
|
|
7335
|
+
# process the form parameters
|
|
7336
|
+
_form_params = []
|
|
7337
|
+
_files = {}
|
|
7338
|
+
# process the body parameter
|
|
7339
|
+
_body_params = None
|
|
7340
|
+
if _params["validate_external_storage_root_request_dto"] is not None:
|
|
7341
|
+
_body_params = _params["validate_external_storage_root_request_dto"]
|
|
7342
|
+
|
|
7343
|
+
# set the HTTP header `Accept`
|
|
7344
|
+
_header_params["Accept"] = self.api_client.select_header_accept(
|
|
7345
|
+
["application/json"]
|
|
7346
|
+
) # noqa: E501
|
|
7347
|
+
|
|
7348
|
+
# set the HTTP header `Content-Type`
|
|
7349
|
+
_content_types_list = _params.get(
|
|
7350
|
+
"_content_type",
|
|
7351
|
+
self.api_client.select_header_content_type(["application/json"]),
|
|
7352
|
+
)
|
|
7353
|
+
if _content_types_list:
|
|
7354
|
+
_header_params["Content-Type"] = _content_types_list
|
|
7355
|
+
|
|
7356
|
+
# authentication setting
|
|
7357
|
+
_auth_settings = ["HTTPBearer", "APIKeyCookie"] # noqa: E501
|
|
7358
|
+
|
|
7359
|
+
_response_types_map = {
|
|
7360
|
+
"200": "ValidateExternalStorageRootResponseDto",
|
|
7361
|
+
"422": "HTTPValidationError",
|
|
7362
|
+
}
|
|
7363
|
+
|
|
7364
|
+
return self.api_client.call_api(
|
|
7365
|
+
"/api/2.0/mlflow/mlfoundry-artifacts/artifact-versions/validate-storage-root",
|
|
7366
|
+
"POST",
|
|
7367
|
+
_path_params,
|
|
7368
|
+
_query_params,
|
|
7369
|
+
_header_params,
|
|
7370
|
+
body=_body_params,
|
|
7371
|
+
post_params=_form_params,
|
|
7372
|
+
files=_files,
|
|
7373
|
+
response_types_map=_response_types_map,
|
|
7374
|
+
auth_settings=_auth_settings,
|
|
7375
|
+
async_req=_params.get("async_req"),
|
|
7376
|
+
_return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
|
|
7377
|
+
_preload_content=_params.get("_preload_content", True),
|
|
7378
|
+
_request_timeout=_params.get("_request_timeout"),
|
|
7379
|
+
collection_formats=_collection_formats,
|
|
7380
|
+
_request_auth=_params.get("_request_auth"),
|
|
7381
|
+
)
|
|
@@ -334,9 +334,6 @@ from truefoundry.ml.autogen.client.models.search_runs_request_dto import (
|
|
|
334
334
|
from truefoundry.ml.autogen.client.models.search_runs_response_dto import (
|
|
335
335
|
SearchRunsResponseDto,
|
|
336
336
|
)
|
|
337
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
338
|
-
SerializationFormat,
|
|
339
|
-
)
|
|
340
337
|
from truefoundry.ml.autogen.client.models.set_experiment_tag_request_dto import (
|
|
341
338
|
SetExperimentTagRequestDto,
|
|
342
339
|
)
|
|
@@ -344,6 +341,9 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
344
341
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
345
342
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
346
343
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
344
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
345
|
+
SklearnSerializationFormat,
|
|
346
|
+
)
|
|
347
347
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
348
348
|
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
349
349
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
@@ -394,6 +394,12 @@ from truefoundry.ml.autogen.client.models.update_run_response_dto import (
|
|
|
394
394
|
)
|
|
395
395
|
from truefoundry.ml.autogen.client.models.url import Url
|
|
396
396
|
from truefoundry.ml.autogen.client.models.user_message import UserMessage
|
|
397
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_request_dto import (
|
|
398
|
+
ValidateExternalStorageRootRequestDto,
|
|
399
|
+
)
|
|
400
|
+
from truefoundry.ml.autogen.client.models.validate_external_storage_root_response_dto import (
|
|
401
|
+
ValidateExternalStorageRootResponseDto,
|
|
402
|
+
)
|
|
397
403
|
from truefoundry.ml.autogen.client.models.validation_error import ValidationError
|
|
398
404
|
from truefoundry.ml.autogen.client.models.validation_error_loc_inner import (
|
|
399
405
|
ValidationErrorLocInner,
|
|
@@ -402,3 +408,6 @@ from truefoundry.ml.autogen.client.models.xg_boost_framework import XGBoostFrame
|
|
|
402
408
|
from truefoundry.ml.autogen.client.models.xg_boost_model_schema import (
|
|
403
409
|
XGBoostModelSchema,
|
|
404
410
|
)
|
|
411
|
+
from truefoundry.ml.autogen.client.models.xg_boost_serialization_format import (
|
|
412
|
+
XGBoostSerializationFormat,
|
|
413
|
+
)
|
|
@@ -18,10 +18,10 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
from typing import Optional
|
|
20
20
|
|
|
21
|
-
from truefoundry.ml.autogen.client.models.serialization_format import (
|
|
22
|
-
SerializationFormat,
|
|
23
|
-
)
|
|
24
21
|
from truefoundry.ml.autogen.client.models.sklearn_model_schema import SklearnModelSchema
|
|
22
|
+
from truefoundry.ml.autogen.client.models.sklearn_serialization_format import (
|
|
23
|
+
SklearnSerializationFormat,
|
|
24
|
+
)
|
|
25
25
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
26
26
|
|
|
27
27
|
|
|
@@ -38,10 +38,7 @@ class SklearnFramework(BaseModel):
|
|
|
38
38
|
default=None,
|
|
39
39
|
description="+label=Model file path +usage=Relative path to the model file",
|
|
40
40
|
)
|
|
41
|
-
serialization_format: Optional[
|
|
42
|
-
default=None,
|
|
43
|
-
description="+label=Serialization format +usage=Serialization format used for the model",
|
|
44
|
-
)
|
|
41
|
+
serialization_format: Optional[SklearnSerializationFormat] = None
|
|
45
42
|
model_schema: Optional[SklearnModelSchema] = None
|
|
46
43
|
__properties = ["type", "model_filepath", "serialization_format", "model_schema"]
|
|
47
44
|
|
truefoundry/ml/autogen/client/models/{serialization_format.py → sklearn_serialization_format.py}
RENAMED
|
@@ -17,9 +17,9 @@ import re # noqa: F401
|
|
|
17
17
|
from aenum import Enum
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class SklearnSerializationFormat(str, Enum):
|
|
21
21
|
"""
|
|
22
|
-
+label=Serialization format +usage=Serialization format used for
|
|
22
|
+
+label=Serialization format +usage=Serialization format used for sklearn models
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
"""
|
|
@@ -30,6 +30,6 @@ class SerializationFormat(str, Enum):
|
|
|
30
30
|
PICKLE = "pickle"
|
|
31
31
|
|
|
32
32
|
@classmethod
|
|
33
|
-
def from_json(cls, json_str: str) ->
|
|
34
|
-
"""Create an instance of
|
|
35
|
-
return
|
|
33
|
+
def from_json(cls, json_str: str) -> SklearnSerializationFormat:
|
|
34
|
+
"""Create an instance of SklearnSerializationFormat from a JSON string"""
|
|
35
|
+
return SklearnSerializationFormat(json.loads(json_str))
|