truefoundry 0.5.0rc2__py3-none-any.whl → 0.5.0rc4__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/deploy/auto_gen/models.py +12 -8
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +2 -2
- truefoundry/deploy/python_deploy_codegen.py +1 -0
- truefoundry/deploy/v2/lib/deploy_workflow.py +8 -2
- truefoundry/ml/__init__.py +6 -3
- truefoundry/ml/autogen/client/__init__.py +9 -4
- truefoundry/ml/autogen/client/models/__init__.py +9 -4
- truefoundry/ml/autogen/client/models/artifact_version_dto.py +3 -5
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +111 -0
- truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py} +8 -8
- truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +3 -5
- truefoundry/ml/autogen/client/models/manifest.py +154 -0
- truefoundry/ml/autogen/client/models/model_version_manifest.py +3 -3
- truefoundry/ml/autogen/client/models/source.py +23 -23
- truefoundry/ml/autogen/client/models/source1.py +154 -0
- truefoundry/ml/autogen/client/models/transformers_framework.py +6 -1
- truefoundry/ml/autogen/client/models/{truefoundry_model_source.py → true_foundry_artifact_source.py} +9 -9
- truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +11 -1
- truefoundry/ml/autogen/client_README.md +5 -2
- truefoundry/ml/autogen/entities/artifacts.py +22 -8
- truefoundry/ml/log_types/artifacts/artifact.py +131 -63
- truefoundry/ml/log_types/artifacts/general_artifact.py +7 -26
- truefoundry/ml/log_types/artifacts/model.py +74 -81
- truefoundry/ml/mlfoundry_api.py +4 -4
- truefoundry/ml/mlfoundry_run.py +8 -5
- truefoundry/ml/model_framework.py +2 -2
- truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py +41 -8
- {truefoundry-0.5.0rc2.dist-info → truefoundry-0.5.0rc4.dist-info}/METADATA +2 -2
- {truefoundry-0.5.0rc2.dist-info → truefoundry-0.5.0rc4.dist-info}/RECORD +31 -28
- {truefoundry-0.5.0rc2.dist-info → truefoundry-0.5.0rc4.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.0rc2.dist-info → truefoundry-0.5.0rc4.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: application.json
|
|
3
|
-
# timestamp: 2024-
|
|
3
|
+
# timestamp: 2024-11-04T08:35:21+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -315,7 +315,7 @@ class GitHelmRepo(BaseModel):
|
|
|
315
315
|
regex=r"^(((https?|wss):\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))$"
|
|
316
316
|
) = Field(
|
|
317
317
|
...,
|
|
318
|
-
description="+label=Git repository URL\n+sort=1\n+message=Needs to be a valid URL
|
|
318
|
+
description="TODO: Check this regex and add guidelines\n+label=Git repository URL\n+sort=1\n+message=Needs to be a valid URL.",
|
|
319
319
|
)
|
|
320
320
|
revision: str = Field(
|
|
321
321
|
...,
|
|
@@ -1151,7 +1151,7 @@ class VolumeMount(BaseModel):
|
|
|
1151
1151
|
...,
|
|
1152
1152
|
description="+label=Volume mount path\n+usage=Absolute file path where the volume will be mounted.\n+message=Please enter a valid mount path",
|
|
1153
1153
|
)
|
|
1154
|
-
sub_path: Optional[
|
|
1154
|
+
sub_path: Optional[constr(regex=r"^(?:[^/\n]+/*)*[^/\n]+(\.[^/\n]+)?$")] = Field(
|
|
1155
1155
|
None,
|
|
1156
1156
|
description="+label=Sub Path\n+usage=Sub path within the volume to mount. Defaults to root of the volume.",
|
|
1157
1157
|
)
|
|
@@ -1285,7 +1285,7 @@ class Codeserver(BaseWorkbenchInput):
|
|
|
1285
1285
|
|
|
1286
1286
|
|
|
1287
1287
|
class ContainerTaskConfig(BaseModel):
|
|
1288
|
-
type:
|
|
1288
|
+
type: Literal["container-task-config"] = Field(
|
|
1289
1289
|
..., description="+value=container-task-config"
|
|
1290
1290
|
)
|
|
1291
1291
|
image: Union[Build, Image] = Field(
|
|
@@ -1301,7 +1301,9 @@ class ContainerTaskConfig(BaseModel):
|
|
|
1301
1301
|
None,
|
|
1302
1302
|
description="+usage=Configure data to be mounted to Workflow pod(s) as a volume.\n+sort=400",
|
|
1303
1303
|
)
|
|
1304
|
-
service_account: str = Field(
|
|
1304
|
+
service_account: Optional[str] = Field(
|
|
1305
|
+
None, description="+label=Service Account\n+sort=500"
|
|
1306
|
+
)
|
|
1305
1307
|
|
|
1306
1308
|
|
|
1307
1309
|
class CoreNATSOutputConfig(BaseModel):
|
|
@@ -1559,7 +1561,7 @@ class PythonTaskConfig(BaseModel):
|
|
|
1559
1561
|
+docs=Describes the configuration for the python function task
|
|
1560
1562
|
"""
|
|
1561
1563
|
|
|
1562
|
-
type:
|
|
1564
|
+
type: Literal["python-task-config"] = Field(
|
|
1563
1565
|
..., description="+value=python-task-config"
|
|
1564
1566
|
)
|
|
1565
1567
|
image: Union[TaskPythonBuild, TaskDockerFileBuild] = Field(
|
|
@@ -1575,7 +1577,9 @@ class PythonTaskConfig(BaseModel):
|
|
|
1575
1577
|
None,
|
|
1576
1578
|
description="+usage=Configure data to be mounted to Workflow pod(s) as a volume.\n+sort=400",
|
|
1577
1579
|
)
|
|
1578
|
-
service_account: str = Field(
|
|
1580
|
+
service_account: Optional[str] = Field(
|
|
1581
|
+
None, description="+label=Service Account\n+sort=500"
|
|
1582
|
+
)
|
|
1579
1583
|
|
|
1580
1584
|
|
|
1581
1585
|
class SSHServer(BaseWorkbenchInput):
|
|
@@ -1722,7 +1726,7 @@ class Workflow(BaseModel):
|
|
|
1722
1726
|
+docs=Describes the configuration for the worflow
|
|
1723
1727
|
"""
|
|
1724
1728
|
|
|
1725
|
-
type:
|
|
1729
|
+
type: Literal["workflow"] = Field(..., description="+value=workflow")
|
|
1726
1730
|
name: constr(regex=r"^[a-z][a-z0-9\-]{1,30}[a-z0-9]$") = Field(
|
|
1727
1731
|
...,
|
|
1728
1732
|
description="+usage=Name of the workflow\n+sort=1\n+message=3 to 32 lower case characters long alphanumeric word, may contain - in between, cannot start with a number",
|
|
@@ -31,7 +31,7 @@ WORKDIR /app
|
|
|
31
31
|
|
|
32
32
|
DOCKERFILE_TEMPLATE = Template(
|
|
33
33
|
"""
|
|
34
|
-
FROM
|
|
34
|
+
FROM ${python_image_repo}:${python_version}
|
|
35
35
|
ENV PATH=/virtualenvs/venv/bin:$PATH
|
|
36
36
|
RUN apt update && \
|
|
37
37
|
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends git && \
|
|
@@ -43,7 +43,7 @@ RUN apt update && \
|
|
|
43
43
|
|
|
44
44
|
CUDA_DOCKERFILE_TEMPLATE = Template(
|
|
45
45
|
"""
|
|
46
|
-
FROM
|
|
46
|
+
FROM nvidia/cuda:${nvidia_cuda_image_tag}
|
|
47
47
|
ENV PATH=/virtualenvs/venv/bin:$PATH
|
|
48
48
|
RUN echo "deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) main" >> /etc/apt/sources.list && \
|
|
49
49
|
echo "deb-src https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) main" >> /etc/apt/sources.list && \
|
|
@@ -111,6 +111,7 @@ def convert_deployment_config_to_python(workspace_fqn: str, application_spec: di
|
|
|
111
111
|
application_type = application_obj.type
|
|
112
112
|
if (
|
|
113
113
|
hasattr(application_obj, "image")
|
|
114
|
+
and hasattr(application_obj.image, "type")
|
|
114
115
|
and application_obj.image.type == "build"
|
|
115
116
|
and application_obj.image.build_source.type == "remote"
|
|
116
117
|
):
|
|
@@ -11,7 +11,10 @@ from flytekit.configuration import (
|
|
|
11
11
|
)
|
|
12
12
|
from flytekit.configuration import Image as FlytekitImage
|
|
13
13
|
from flytekit.models.launch_plan import LaunchPlan as FlyteLaunchPlan
|
|
14
|
-
from flytekit.tools.repo import
|
|
14
|
+
from flytekit.tools.repo import (
|
|
15
|
+
serialize_get_control_plane_entities as get_serialized_entities,
|
|
16
|
+
)
|
|
17
|
+
from flytekit.tools.repo import serialize_load_only as serialize_workflow
|
|
15
18
|
from flytekit.tools.translator import TaskSpec as FlyteTaskSpec
|
|
16
19
|
from flytekit.tools.translator import WorkflowSpec as FlyteWorkflowSpec
|
|
17
20
|
from google.protobuf.json_format import MessageToDict
|
|
@@ -207,9 +210,12 @@ def _generate_manifest_for_workflow(
|
|
|
207
210
|
project_root_path=source_absolute_path, filepath=workflow_file_absolute_path
|
|
208
211
|
)
|
|
209
212
|
|
|
210
|
-
|
|
213
|
+
serialize_workflow(
|
|
211
214
|
pkgs=[package_path], settings=settings, local_source_root=source_absolute_path
|
|
212
215
|
)
|
|
216
|
+
workflow_entities = get_serialized_entities(
|
|
217
|
+
settings, local_source_root=source_absolute_path
|
|
218
|
+
)
|
|
213
219
|
_validate_workflow_entities(workflow_entities, source_absolute_path)
|
|
214
220
|
|
|
215
221
|
workflow.flyte_entities = []
|
truefoundry/ml/__init__.py
CHANGED
|
@@ -8,10 +8,13 @@ from truefoundry.ml.enums import (
|
|
|
8
8
|
)
|
|
9
9
|
from truefoundry.ml.exceptions import MlFoundryException
|
|
10
10
|
from truefoundry.ml.log_types import Image, Plot
|
|
11
|
-
from truefoundry.ml.log_types.artifacts.artifact import
|
|
11
|
+
from truefoundry.ml.log_types.artifacts.artifact import (
|
|
12
|
+
ArtifactPath,
|
|
13
|
+
ArtifactVersion,
|
|
14
|
+
BlobStorageDirectory,
|
|
15
|
+
)
|
|
12
16
|
from truefoundry.ml.log_types.artifacts.dataset import DataDirectory, DataDirectoryPath
|
|
13
17
|
from truefoundry.ml.log_types.artifacts.model import (
|
|
14
|
-
BlobStorageModelDirectory,
|
|
15
18
|
ModelVersion,
|
|
16
19
|
)
|
|
17
20
|
from truefoundry.ml.logger import init_logger
|
|
@@ -38,7 +41,7 @@ from truefoundry.ml.model_framework import (
|
|
|
38
41
|
__all__ = [
|
|
39
42
|
"ArtifactPath",
|
|
40
43
|
"ArtifactVersion",
|
|
41
|
-
"
|
|
44
|
+
"BlobStorageDirectory",
|
|
42
45
|
"DataDirectory",
|
|
43
46
|
"DataDirectoryPath",
|
|
44
47
|
"DataSlice",
|
|
@@ -61,6 +61,9 @@ from truefoundry.ml.autogen.client.models.artifact_response_dto import (
|
|
|
61
61
|
)
|
|
62
62
|
from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
|
|
63
63
|
from truefoundry.ml.autogen.client.models.artifact_version_dto import ArtifactVersionDto
|
|
64
|
+
from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
|
|
65
|
+
ArtifactVersionManifest,
|
|
66
|
+
)
|
|
64
67
|
from truefoundry.ml.autogen.client.models.artifact_version_response_dto import (
|
|
65
68
|
ArtifactVersionResponseDto,
|
|
66
69
|
)
|
|
@@ -169,8 +172,8 @@ from truefoundry.ml.autogen.client.models.experiment_response_dto import (
|
|
|
169
172
|
ExperimentResponseDto,
|
|
170
173
|
)
|
|
171
174
|
from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTagDto
|
|
172
|
-
from truefoundry.ml.autogen.client.models.
|
|
173
|
-
|
|
175
|
+
from truefoundry.ml.autogen.client.models.external_artifact_source import (
|
|
176
|
+
ExternalArtifactSource,
|
|
174
177
|
)
|
|
175
178
|
from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
|
|
176
179
|
from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
|
|
@@ -300,6 +303,7 @@ from truefoundry.ml.autogen.client.models.log_metric_request_dto import (
|
|
|
300
303
|
from truefoundry.ml.autogen.client.models.log_param_request_dto import (
|
|
301
304
|
LogParamRequestDto,
|
|
302
305
|
)
|
|
306
|
+
from truefoundry.ml.autogen.client.models.manifest import Manifest
|
|
303
307
|
from truefoundry.ml.autogen.client.models.method import Method
|
|
304
308
|
from truefoundry.ml.autogen.client.models.metric_collection_dto import (
|
|
305
309
|
MetricCollectionDto,
|
|
@@ -362,6 +366,7 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
362
366
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
363
367
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
364
368
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
369
|
+
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
365
370
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
366
371
|
from truefoundry.ml.autogen.client.models.stats_models_framework import (
|
|
367
372
|
StatsModelsFramework,
|
|
@@ -387,8 +392,8 @@ from truefoundry.ml.autogen.client.models.trigger_job_run_config_request_dto imp
|
|
|
387
392
|
from truefoundry.ml.autogen.client.models.trigger_job_run_config_response_dto import (
|
|
388
393
|
TriggerJobRunConfigResponseDto,
|
|
389
394
|
)
|
|
390
|
-
from truefoundry.ml.autogen.client.models.
|
|
391
|
-
|
|
395
|
+
from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
|
|
396
|
+
TrueFoundryArtifactSource,
|
|
392
397
|
)
|
|
393
398
|
from truefoundry.ml.autogen.client.models.update_artifact_version_request_dto import (
|
|
394
399
|
UpdateArtifactVersionRequestDto,
|
|
@@ -32,6 +32,9 @@ from truefoundry.ml.autogen.client.models.artifact_response_dto import (
|
|
|
32
32
|
)
|
|
33
33
|
from truefoundry.ml.autogen.client.models.artifact_type import ArtifactType
|
|
34
34
|
from truefoundry.ml.autogen.client.models.artifact_version_dto import ArtifactVersionDto
|
|
35
|
+
from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
|
|
36
|
+
ArtifactVersionManifest,
|
|
37
|
+
)
|
|
35
38
|
from truefoundry.ml.autogen.client.models.artifact_version_response_dto import (
|
|
36
39
|
ArtifactVersionResponseDto,
|
|
37
40
|
)
|
|
@@ -140,8 +143,8 @@ from truefoundry.ml.autogen.client.models.experiment_response_dto import (
|
|
|
140
143
|
ExperimentResponseDto,
|
|
141
144
|
)
|
|
142
145
|
from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTagDto
|
|
143
|
-
from truefoundry.ml.autogen.client.models.
|
|
144
|
-
|
|
146
|
+
from truefoundry.ml.autogen.client.models.external_artifact_source import (
|
|
147
|
+
ExternalArtifactSource,
|
|
145
148
|
)
|
|
146
149
|
from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
|
|
147
150
|
from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
|
|
@@ -271,6 +274,7 @@ from truefoundry.ml.autogen.client.models.log_metric_request_dto import (
|
|
|
271
274
|
from truefoundry.ml.autogen.client.models.log_param_request_dto import (
|
|
272
275
|
LogParamRequestDto,
|
|
273
276
|
)
|
|
277
|
+
from truefoundry.ml.autogen.client.models.manifest import Manifest
|
|
274
278
|
from truefoundry.ml.autogen.client.models.method import Method
|
|
275
279
|
from truefoundry.ml.autogen.client.models.metric_collection_dto import (
|
|
276
280
|
MetricCollectionDto,
|
|
@@ -333,6 +337,7 @@ from truefoundry.ml.autogen.client.models.set_tag_request_dto import SetTagReque
|
|
|
333
337
|
from truefoundry.ml.autogen.client.models.signed_url_dto import SignedURLDto
|
|
334
338
|
from truefoundry.ml.autogen.client.models.sklearn_framework import SklearnFramework
|
|
335
339
|
from truefoundry.ml.autogen.client.models.source import Source
|
|
340
|
+
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
336
341
|
from truefoundry.ml.autogen.client.models.spa_cy_framework import SpaCyFramework
|
|
337
342
|
from truefoundry.ml.autogen.client.models.stats_models_framework import (
|
|
338
343
|
StatsModelsFramework,
|
|
@@ -358,8 +363,8 @@ from truefoundry.ml.autogen.client.models.trigger_job_run_config_request_dto imp
|
|
|
358
363
|
from truefoundry.ml.autogen.client.models.trigger_job_run_config_response_dto import (
|
|
359
364
|
TriggerJobRunConfigResponseDto,
|
|
360
365
|
)
|
|
361
|
-
from truefoundry.ml.autogen.client.models.
|
|
362
|
-
|
|
366
|
+
from truefoundry.ml.autogen.client.models.true_foundry_artifact_source import (
|
|
367
|
+
TrueFoundryArtifactSource,
|
|
363
368
|
)
|
|
364
369
|
from truefoundry.ml.autogen.client.models.update_artifact_version_request_dto import (
|
|
365
370
|
UpdateArtifactVersionRequestDto,
|
|
@@ -26,9 +26,7 @@ from truefoundry.ml.autogen.client.models.artifact_version_status import (
|
|
|
26
26
|
ArtifactVersionStatus,
|
|
27
27
|
)
|
|
28
28
|
from truefoundry.ml.autogen.client.models.internal_metadata import InternalMetadata
|
|
29
|
-
from truefoundry.ml.autogen.client.models.
|
|
30
|
-
ModelVersionManifest,
|
|
31
|
-
)
|
|
29
|
+
from truefoundry.ml.autogen.client.models.manifest import Manifest
|
|
32
30
|
from truefoundry.ml.autogen.client.models.subject import Subject
|
|
33
31
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr
|
|
34
32
|
|
|
@@ -59,7 +57,7 @@ class ArtifactVersionDto(BaseModel):
|
|
|
59
57
|
artifact_name: Optional[StrictStr] = None
|
|
60
58
|
internal_metadata: Optional[InternalMetadata] = None
|
|
61
59
|
artifact_size: Optional[StrictInt] = None
|
|
62
|
-
manifest: Optional[
|
|
60
|
+
manifest: Optional[Manifest] = None
|
|
63
61
|
serialization_format: ArtifactVersionSerializationFormat = Field(...)
|
|
64
62
|
__properties = [
|
|
65
63
|
"id",
|
|
@@ -158,7 +156,7 @@ class ArtifactVersionDto(BaseModel):
|
|
|
158
156
|
if obj.get("internal_metadata") is not None
|
|
159
157
|
else None,
|
|
160
158
|
"artifact_size": obj.get("artifact_size"),
|
|
161
|
-
"manifest":
|
|
159
|
+
"manifest": Manifest.from_dict(obj.get("manifest"))
|
|
162
160
|
if obj.get("manifest") is not None
|
|
163
161
|
else None,
|
|
164
162
|
"serialization_format": obj.get("serialization_format"),
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
|
+
|
|
21
|
+
from truefoundry.ml.autogen.client.models.source import Source
|
|
22
|
+
from truefoundry.pydantic_v1 import (
|
|
23
|
+
BaseModel,
|
|
24
|
+
Field,
|
|
25
|
+
StrictStr,
|
|
26
|
+
conint,
|
|
27
|
+
constr,
|
|
28
|
+
validator,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ArtifactVersionManifest(BaseModel):
|
|
33
|
+
"""
|
|
34
|
+
Artifact Version manifest. # noqa: E501
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
38
|
+
default=None,
|
|
39
|
+
description="+label=Description +docs=Description of the artifact version",
|
|
40
|
+
)
|
|
41
|
+
metadata: Dict[str, Any] = Field(
|
|
42
|
+
default=...,
|
|
43
|
+
description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
|
|
44
|
+
)
|
|
45
|
+
type: Optional[StrictStr] = "artifact-version"
|
|
46
|
+
source: Source = Field(...)
|
|
47
|
+
step: Optional[conint(strict=True, ge=0)] = Field(
|
|
48
|
+
default=0, description="+label=Step"
|
|
49
|
+
)
|
|
50
|
+
__properties = ["description", "metadata", "type", "source", "step"]
|
|
51
|
+
|
|
52
|
+
@validator("type")
|
|
53
|
+
def type_validate_enum(cls, value):
|
|
54
|
+
"""Validates the enum"""
|
|
55
|
+
if value is None:
|
|
56
|
+
return value
|
|
57
|
+
|
|
58
|
+
if value not in ("artifact-version"):
|
|
59
|
+
raise ValueError("must be one of enum values ('artifact-version')")
|
|
60
|
+
return value
|
|
61
|
+
|
|
62
|
+
class Config:
|
|
63
|
+
"""Pydantic configuration"""
|
|
64
|
+
|
|
65
|
+
allow_population_by_field_name = True
|
|
66
|
+
validate_assignment = True
|
|
67
|
+
|
|
68
|
+
def to_str(self) -> str:
|
|
69
|
+
"""Returns the string representation of the model using alias"""
|
|
70
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
71
|
+
|
|
72
|
+
def to_json(self) -> str:
|
|
73
|
+
"""Returns the JSON representation of the model using alias"""
|
|
74
|
+
return json.dumps(self.to_dict())
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_json(cls, json_str: str) -> ArtifactVersionManifest:
|
|
78
|
+
"""Create an instance of ArtifactVersionManifest from a JSON string"""
|
|
79
|
+
return cls.from_dict(json.loads(json_str))
|
|
80
|
+
|
|
81
|
+
def to_dict(self):
|
|
82
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
83
|
+
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
84
|
+
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of source
|
|
85
|
+
if self.source:
|
|
86
|
+
_dict["source"] = self.source.to_dict()
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: dict) -> ArtifactVersionManifest:
|
|
91
|
+
"""Create an instance of ArtifactVersionManifest from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return ArtifactVersionManifest.parse_obj(obj)
|
|
97
|
+
|
|
98
|
+
_obj = ArtifactVersionManifest.parse_obj(
|
|
99
|
+
{
|
|
100
|
+
"description": obj.get("description"),
|
|
101
|
+
"metadata": obj.get("metadata"),
|
|
102
|
+
"type": obj.get("type")
|
|
103
|
+
if obj.get("type") is not None
|
|
104
|
+
else "artifact-version",
|
|
105
|
+
"source": Source.from_dict(obj.get("source"))
|
|
106
|
+
if obj.get("source") is not None
|
|
107
|
+
else None,
|
|
108
|
+
"step": obj.get("step") if obj.get("step") is not None else 0,
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
return _obj
|
truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py}
RENAMED
|
@@ -20,7 +20,7 @@ import re # noqa: F401
|
|
|
20
20
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, validator
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class ExternalArtifactSource(BaseModel):
|
|
24
24
|
"""
|
|
25
25
|
+label=External # noqa: E501
|
|
26
26
|
"""
|
|
@@ -30,7 +30,7 @@ class ExternalModelSource(BaseModel):
|
|
|
30
30
|
description="+label=Type +usage=Type of the source +value=external +type=External",
|
|
31
31
|
)
|
|
32
32
|
uri: StrictStr = Field(
|
|
33
|
-
default=..., description="+label=URI +usage=URI of the
|
|
33
|
+
default=..., description="+label=URI +usage=URI of the Artifact source"
|
|
34
34
|
)
|
|
35
35
|
__properties = ["type", "uri"]
|
|
36
36
|
|
|
@@ -56,8 +56,8 @@ class ExternalModelSource(BaseModel):
|
|
|
56
56
|
return json.dumps(self.to_dict())
|
|
57
57
|
|
|
58
58
|
@classmethod
|
|
59
|
-
def from_json(cls, json_str: str) ->
|
|
60
|
-
"""Create an instance of
|
|
59
|
+
def from_json(cls, json_str: str) -> ExternalArtifactSource:
|
|
60
|
+
"""Create an instance of ExternalArtifactSource from a JSON string"""
|
|
61
61
|
return cls.from_dict(json.loads(json_str))
|
|
62
62
|
|
|
63
63
|
def to_dict(self):
|
|
@@ -66,15 +66,15 @@ class ExternalModelSource(BaseModel):
|
|
|
66
66
|
return _dict
|
|
67
67
|
|
|
68
68
|
@classmethod
|
|
69
|
-
def from_dict(cls, obj: dict) ->
|
|
70
|
-
"""Create an instance of
|
|
69
|
+
def from_dict(cls, obj: dict) -> ExternalArtifactSource:
|
|
70
|
+
"""Create an instance of ExternalArtifactSource from a dict"""
|
|
71
71
|
if obj is None:
|
|
72
72
|
return None
|
|
73
73
|
|
|
74
74
|
if not isinstance(obj, dict):
|
|
75
|
-
return
|
|
75
|
+
return ExternalArtifactSource.parse_obj(obj)
|
|
76
76
|
|
|
77
|
-
_obj =
|
|
77
|
+
_obj = ExternalArtifactSource.parse_obj(
|
|
78
78
|
{"type": obj.get("type"), "uri": obj.get("uri")}
|
|
79
79
|
)
|
|
80
80
|
return _obj
|
|
@@ -19,9 +19,7 @@ import re # noqa: F401
|
|
|
19
19
|
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.ml.autogen.client.models.internal_metadata import InternalMetadata
|
|
22
|
-
from truefoundry.ml.autogen.client.models.
|
|
23
|
-
ModelVersionManifest,
|
|
24
|
-
)
|
|
22
|
+
from truefoundry.ml.autogen.client.models.manifest import Manifest
|
|
25
23
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictInt, StrictStr
|
|
26
24
|
|
|
27
25
|
|
|
@@ -38,7 +36,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
|
|
|
38
36
|
data_path: Optional[StrictStr] = None
|
|
39
37
|
step: Optional[StrictInt] = None
|
|
40
38
|
artifact_size: Optional[StrictInt] = None
|
|
41
|
-
manifest: Optional[
|
|
39
|
+
manifest: Optional[Manifest] = None
|
|
42
40
|
__properties = [
|
|
43
41
|
"id",
|
|
44
42
|
"run_uuid",
|
|
@@ -104,7 +102,7 @@ class FinalizeArtifactVersionRequestDto(BaseModel):
|
|
|
104
102
|
"data_path": obj.get("data_path"),
|
|
105
103
|
"step": obj.get("step"),
|
|
106
104
|
"artifact_size": obj.get("artifact_size"),
|
|
107
|
-
"manifest":
|
|
105
|
+
"manifest": Manifest.from_dict(obj.get("manifest"))
|
|
108
106
|
if obj.get("manifest") is not None
|
|
109
107
|
else None,
|
|
110
108
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
|
20
|
+
|
|
21
|
+
from truefoundry.ml.autogen.client.models.artifact_version_manifest import (
|
|
22
|
+
ArtifactVersionManifest,
|
|
23
|
+
)
|
|
24
|
+
from truefoundry.ml.autogen.client.models.model_version_manifest import (
|
|
25
|
+
ModelVersionManifest,
|
|
26
|
+
)
|
|
27
|
+
from truefoundry.pydantic_v1 import (
|
|
28
|
+
BaseModel,
|
|
29
|
+
Field,
|
|
30
|
+
ValidationError,
|
|
31
|
+
validator,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
MANIFEST_ANY_OF_SCHEMAS = ["ArtifactVersionManifest", "ModelVersionManifest"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Manifest(BaseModel):
|
|
38
|
+
"""
|
|
39
|
+
Manifest
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
# data type: ModelVersionManifest
|
|
43
|
+
anyof_schema_1_validator: Optional[ModelVersionManifest] = None
|
|
44
|
+
# data type: ArtifactVersionManifest
|
|
45
|
+
anyof_schema_2_validator: Optional[ArtifactVersionManifest] = None
|
|
46
|
+
if TYPE_CHECKING:
|
|
47
|
+
actual_instance: Union[ArtifactVersionManifest, ModelVersionManifest]
|
|
48
|
+
else:
|
|
49
|
+
actual_instance: Any
|
|
50
|
+
any_of_schemas: List[str] = Field(MANIFEST_ANY_OF_SCHEMAS, const=True)
|
|
51
|
+
|
|
52
|
+
class Config:
|
|
53
|
+
validate_assignment = True
|
|
54
|
+
|
|
55
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
56
|
+
if args:
|
|
57
|
+
if len(args) > 1:
|
|
58
|
+
raise ValueError(
|
|
59
|
+
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
60
|
+
)
|
|
61
|
+
if kwargs:
|
|
62
|
+
raise ValueError(
|
|
63
|
+
"If a position argument is used, keyword arguments cannot be used."
|
|
64
|
+
)
|
|
65
|
+
super().__init__(actual_instance=args[0])
|
|
66
|
+
else:
|
|
67
|
+
super().__init__(**kwargs)
|
|
68
|
+
|
|
69
|
+
@validator("actual_instance")
|
|
70
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
71
|
+
instance = Manifest.construct()
|
|
72
|
+
error_messages = []
|
|
73
|
+
# validate data type: ModelVersionManifest
|
|
74
|
+
if not isinstance(v, ModelVersionManifest):
|
|
75
|
+
error_messages.append(
|
|
76
|
+
f"Error! Input type `{type(v)}` is not `ModelVersionManifest`"
|
|
77
|
+
)
|
|
78
|
+
else:
|
|
79
|
+
return v
|
|
80
|
+
|
|
81
|
+
# validate data type: ArtifactVersionManifest
|
|
82
|
+
if not isinstance(v, ArtifactVersionManifest):
|
|
83
|
+
error_messages.append(
|
|
84
|
+
f"Error! Input type `{type(v)}` is not `ArtifactVersionManifest`"
|
|
85
|
+
)
|
|
86
|
+
else:
|
|
87
|
+
return v
|
|
88
|
+
|
|
89
|
+
if error_messages:
|
|
90
|
+
# no match
|
|
91
|
+
raise ValueError(
|
|
92
|
+
"No match found when setting the actual_instance in Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. Details: "
|
|
93
|
+
+ ", ".join(error_messages)
|
|
94
|
+
)
|
|
95
|
+
else:
|
|
96
|
+
return v
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: dict) -> Manifest:
|
|
100
|
+
return cls.from_json(json.dumps(obj))
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_json(cls, json_str: str) -> Manifest:
|
|
104
|
+
"""Returns the object represented by the json string"""
|
|
105
|
+
instance = Manifest.construct()
|
|
106
|
+
error_messages = []
|
|
107
|
+
# anyof_schema_1_validator: Optional[ModelVersionManifest] = None
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = ModelVersionManifest.from_json(json_str)
|
|
110
|
+
return instance
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
113
|
+
# anyof_schema_2_validator: Optional[ArtifactVersionManifest] = None
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = ArtifactVersionManifest.from_json(json_str)
|
|
116
|
+
return instance
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
|
|
120
|
+
if error_messages:
|
|
121
|
+
# no match
|
|
122
|
+
raise ValueError(
|
|
123
|
+
"No match found when deserializing the JSON string into Manifest with anyOf schemas: ArtifactVersionManifest, ModelVersionManifest. Details: "
|
|
124
|
+
+ ", ".join(error_messages)
|
|
125
|
+
)
|
|
126
|
+
else:
|
|
127
|
+
return instance
|
|
128
|
+
|
|
129
|
+
def to_json(self) -> str:
|
|
130
|
+
"""Returns the JSON representation of the actual instance"""
|
|
131
|
+
if self.actual_instance is None:
|
|
132
|
+
return "null"
|
|
133
|
+
|
|
134
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
135
|
+
if callable(to_json):
|
|
136
|
+
return self.actual_instance.to_json()
|
|
137
|
+
else:
|
|
138
|
+
return json.dumps(self.actual_instance)
|
|
139
|
+
|
|
140
|
+
def to_dict(self) -> dict:
|
|
141
|
+
"""Returns the dict representation of the actual instance"""
|
|
142
|
+
if self.actual_instance is None:
|
|
143
|
+
return "null"
|
|
144
|
+
|
|
145
|
+
to_json = getattr(self.actual_instance, "to_json", None)
|
|
146
|
+
if callable(to_json):
|
|
147
|
+
return self.actual_instance.to_dict()
|
|
148
|
+
else:
|
|
149
|
+
# primitive type
|
|
150
|
+
return self.actual_instance
|
|
151
|
+
|
|
152
|
+
def to_str(self) -> str:
|
|
153
|
+
"""Returns the string representation of the actual instance"""
|
|
154
|
+
return pprint.pformat(self.dict())
|
|
@@ -19,7 +19,7 @@ import re # noqa: F401
|
|
|
19
19
|
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.ml.autogen.client.models.framework import Framework
|
|
22
|
-
from truefoundry.ml.autogen.client.models.
|
|
22
|
+
from truefoundry.ml.autogen.client.models.source1 import Source1
|
|
23
23
|
from truefoundry.pydantic_v1 import (
|
|
24
24
|
BaseModel,
|
|
25
25
|
Field,
|
|
@@ -44,7 +44,7 @@ class ModelVersionManifest(BaseModel):
|
|
|
44
44
|
description="+label=Metadata +docs=Metadata for the model version +usage=Metadata for the model version +uiType=JsonInput",
|
|
45
45
|
)
|
|
46
46
|
type: Optional[StrictStr] = "model-version"
|
|
47
|
-
source:
|
|
47
|
+
source: Source1 = Field(...)
|
|
48
48
|
framework: Optional[Framework] = None
|
|
49
49
|
step: Optional[conint(strict=True, ge=0)] = Field(
|
|
50
50
|
default=0, description="+label=Step"
|
|
@@ -107,7 +107,7 @@ class ModelVersionManifest(BaseModel):
|
|
|
107
107
|
"type": obj.get("type")
|
|
108
108
|
if obj.get("type") is not None
|
|
109
109
|
else "model-version",
|
|
110
|
-
"source":
|
|
110
|
+
"source": Source1.from_dict(obj.get("source"))
|
|
111
111
|
if obj.get("source") is not None
|
|
112
112
|
else None,
|
|
113
113
|
"framework": Framework.from_dict(obj.get("framework"))
|