mlrun 1.7.2rc4__py3-none-any.whl → 1.8.0__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 mlrun might be problematic. Click here for more details.
- mlrun/__init__.py +26 -22
- mlrun/__main__.py +15 -16
- mlrun/alerts/alert.py +150 -15
- mlrun/api/schemas/__init__.py +1 -9
- mlrun/artifacts/__init__.py +2 -3
- mlrun/artifacts/base.py +62 -19
- mlrun/artifacts/dataset.py +17 -17
- mlrun/artifacts/document.py +454 -0
- mlrun/artifacts/manager.py +28 -18
- mlrun/artifacts/model.py +91 -59
- mlrun/artifacts/plots.py +2 -2
- mlrun/common/constants.py +8 -0
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/artifact.py +1 -1
- mlrun/common/formatters/feature_set.py +2 -0
- mlrun/common/formatters/function.py +1 -0
- mlrun/{model_monitoring/db/stores/v3io_kv/__init__.py → common/formatters/model_endpoint.py} +17 -0
- mlrun/common/formatters/pipeline.py +1 -2
- mlrun/common/formatters/project.py +9 -0
- mlrun/common/model_monitoring/__init__.py +0 -5
- mlrun/common/model_monitoring/helpers.py +12 -62
- mlrun/common/runtimes/constants.py +25 -4
- mlrun/common/schemas/__init__.py +9 -5
- mlrun/common/schemas/alert.py +114 -19
- mlrun/common/schemas/api_gateway.py +3 -3
- mlrun/common/schemas/artifact.py +22 -9
- mlrun/common/schemas/auth.py +8 -4
- mlrun/common/schemas/background_task.py +7 -7
- mlrun/common/schemas/client_spec.py +4 -4
- mlrun/common/schemas/clusterization_spec.py +2 -2
- mlrun/common/schemas/common.py +53 -3
- mlrun/common/schemas/constants.py +15 -0
- mlrun/common/schemas/datastore_profile.py +1 -1
- mlrun/common/schemas/feature_store.py +9 -9
- mlrun/common/schemas/frontend_spec.py +4 -4
- mlrun/common/schemas/function.py +10 -10
- mlrun/common/schemas/hub.py +1 -1
- mlrun/common/schemas/k8s.py +3 -3
- mlrun/common/schemas/memory_reports.py +3 -3
- mlrun/common/schemas/model_monitoring/__init__.py +4 -8
- mlrun/common/schemas/model_monitoring/constants.py +127 -46
- mlrun/common/schemas/model_monitoring/grafana.py +18 -12
- mlrun/common/schemas/model_monitoring/model_endpoints.py +154 -160
- mlrun/common/schemas/notification.py +24 -3
- mlrun/common/schemas/object.py +1 -1
- mlrun/common/schemas/pagination.py +4 -4
- mlrun/common/schemas/partition.py +142 -0
- mlrun/common/schemas/pipeline.py +3 -3
- mlrun/common/schemas/project.py +26 -18
- mlrun/common/schemas/runs.py +3 -3
- mlrun/common/schemas/runtime_resource.py +5 -5
- mlrun/common/schemas/schedule.py +1 -1
- mlrun/common/schemas/secret.py +1 -1
- mlrun/{model_monitoring/db/stores/sqldb/__init__.py → common/schemas/serving.py} +10 -1
- mlrun/common/schemas/tag.py +3 -3
- mlrun/common/schemas/workflow.py +6 -5
- mlrun/common/types.py +1 -0
- mlrun/config.py +157 -89
- mlrun/data_types/__init__.py +5 -3
- mlrun/data_types/infer.py +13 -3
- mlrun/data_types/spark.py +2 -1
- mlrun/datastore/__init__.py +59 -18
- mlrun/datastore/alibaba_oss.py +4 -1
- mlrun/datastore/azure_blob.py +4 -1
- mlrun/datastore/base.py +19 -24
- mlrun/datastore/datastore.py +10 -4
- mlrun/datastore/datastore_profile.py +178 -45
- mlrun/datastore/dbfs_store.py +4 -1
- mlrun/datastore/filestore.py +4 -1
- mlrun/datastore/google_cloud_storage.py +4 -1
- mlrun/datastore/hdfs.py +4 -1
- mlrun/datastore/inmem.py +4 -1
- mlrun/datastore/redis.py +4 -1
- mlrun/datastore/s3.py +14 -3
- mlrun/datastore/sources.py +89 -92
- mlrun/datastore/store_resources.py +7 -4
- mlrun/datastore/storeytargets.py +51 -16
- mlrun/datastore/targets.py +38 -31
- mlrun/datastore/utils.py +87 -4
- mlrun/datastore/v3io.py +4 -1
- mlrun/datastore/vectorstore.py +291 -0
- mlrun/datastore/wasbfs/fs.py +13 -12
- mlrun/db/base.py +286 -100
- mlrun/db/httpdb.py +1562 -490
- mlrun/db/nopdb.py +250 -83
- mlrun/errors.py +6 -2
- mlrun/execution.py +194 -50
- mlrun/feature_store/__init__.py +2 -10
- mlrun/feature_store/api.py +20 -458
- mlrun/feature_store/common.py +9 -9
- mlrun/feature_store/feature_set.py +20 -18
- mlrun/feature_store/feature_vector.py +105 -479
- mlrun/feature_store/feature_vector_utils.py +466 -0
- mlrun/feature_store/retrieval/base.py +15 -11
- mlrun/feature_store/retrieval/job.py +2 -1
- mlrun/feature_store/retrieval/storey_merger.py +1 -1
- mlrun/feature_store/steps.py +3 -3
- mlrun/features.py +30 -13
- mlrun/frameworks/__init__.py +1 -2
- mlrun/frameworks/_common/__init__.py +1 -2
- mlrun/frameworks/_common/artifacts_library.py +2 -2
- mlrun/frameworks/_common/mlrun_interface.py +10 -6
- mlrun/frameworks/_common/model_handler.py +31 -31
- mlrun/frameworks/_common/producer.py +3 -1
- mlrun/frameworks/_dl_common/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
- mlrun/frameworks/_ml_common/__init__.py +1 -2
- mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_ml_common/model_handler.py +21 -21
- mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/auto_mlrun/__init__.py +1 -2
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
- mlrun/frameworks/huggingface/__init__.py +1 -2
- mlrun/frameworks/huggingface/model_server.py +9 -9
- mlrun/frameworks/lgbm/__init__.py +47 -44
- mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
- mlrun/frameworks/lgbm/model_handler.py +15 -11
- mlrun/frameworks/lgbm/model_server.py +11 -7
- mlrun/frameworks/lgbm/utils.py +2 -2
- mlrun/frameworks/onnx/__init__.py +1 -2
- mlrun/frameworks/onnx/dataset.py +3 -3
- mlrun/frameworks/onnx/mlrun_interface.py +2 -2
- mlrun/frameworks/onnx/model_handler.py +7 -5
- mlrun/frameworks/onnx/model_server.py +8 -6
- mlrun/frameworks/parallel_coordinates.py +11 -11
- mlrun/frameworks/pytorch/__init__.py +22 -23
- mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
- mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
- mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
- mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
- mlrun/frameworks/pytorch/model_handler.py +21 -17
- mlrun/frameworks/pytorch/model_server.py +13 -9
- mlrun/frameworks/sklearn/__init__.py +19 -18
- mlrun/frameworks/sklearn/estimator.py +2 -2
- mlrun/frameworks/sklearn/metric.py +3 -3
- mlrun/frameworks/sklearn/metrics_library.py +8 -6
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
- mlrun/frameworks/sklearn/model_handler.py +4 -3
- mlrun/frameworks/tf_keras/__init__.py +11 -12
- mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
- mlrun/frameworks/tf_keras/model_handler.py +17 -13
- mlrun/frameworks/tf_keras/model_server.py +12 -8
- mlrun/frameworks/xgboost/__init__.py +19 -18
- mlrun/frameworks/xgboost/model_handler.py +13 -9
- mlrun/k8s_utils.py +2 -5
- mlrun/launcher/base.py +3 -4
- mlrun/launcher/client.py +2 -2
- mlrun/launcher/local.py +6 -2
- mlrun/launcher/remote.py +1 -1
- mlrun/lists.py +8 -4
- mlrun/model.py +132 -46
- mlrun/model_monitoring/__init__.py +3 -5
- mlrun/model_monitoring/api.py +113 -98
- mlrun/model_monitoring/applications/__init__.py +0 -5
- mlrun/model_monitoring/applications/_application_steps.py +81 -50
- mlrun/model_monitoring/applications/base.py +467 -14
- mlrun/model_monitoring/applications/context.py +212 -134
- mlrun/model_monitoring/{db/stores/base → applications/evidently}/__init__.py +6 -2
- mlrun/model_monitoring/applications/evidently/base.py +146 -0
- mlrun/model_monitoring/applications/histogram_data_drift.py +89 -56
- mlrun/model_monitoring/applications/results.py +67 -15
- mlrun/model_monitoring/controller.py +701 -315
- mlrun/model_monitoring/db/__init__.py +0 -2
- mlrun/model_monitoring/db/_schedules.py +242 -0
- mlrun/model_monitoring/db/_stats.py +189 -0
- mlrun/model_monitoring/db/tsdb/__init__.py +33 -22
- mlrun/model_monitoring/db/tsdb/base.py +243 -49
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +76 -36
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +213 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +534 -88
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +436 -106
- mlrun/model_monitoring/helpers.py +356 -114
- mlrun/model_monitoring/stream_processing.py +190 -345
- mlrun/model_monitoring/tracking_policy.py +11 -4
- mlrun/model_monitoring/writer.py +49 -90
- mlrun/package/__init__.py +3 -6
- mlrun/package/context_handler.py +2 -2
- mlrun/package/packager.py +12 -9
- mlrun/package/packagers/__init__.py +0 -2
- mlrun/package/packagers/default_packager.py +14 -11
- mlrun/package/packagers/numpy_packagers.py +16 -7
- mlrun/package/packagers/pandas_packagers.py +18 -18
- mlrun/package/packagers/python_standard_library_packagers.py +25 -11
- mlrun/package/packagers_manager.py +35 -32
- mlrun/package/utils/__init__.py +0 -3
- mlrun/package/utils/_pickler.py +6 -6
- mlrun/platforms/__init__.py +47 -16
- mlrun/platforms/iguazio.py +4 -1
- mlrun/projects/operations.py +30 -30
- mlrun/projects/pipelines.py +116 -47
- mlrun/projects/project.py +1292 -329
- mlrun/render.py +5 -9
- mlrun/run.py +57 -14
- mlrun/runtimes/__init__.py +1 -3
- mlrun/runtimes/base.py +30 -22
- mlrun/runtimes/daskjob.py +9 -9
- mlrun/runtimes/databricks_job/databricks_runtime.py +6 -5
- mlrun/runtimes/function_reference.py +5 -2
- mlrun/runtimes/generators.py +3 -2
- mlrun/runtimes/kubejob.py +6 -7
- mlrun/runtimes/mounts.py +574 -0
- mlrun/runtimes/mpijob/__init__.py +0 -2
- mlrun/runtimes/mpijob/abstract.py +7 -6
- mlrun/runtimes/nuclio/api_gateway.py +7 -7
- mlrun/runtimes/nuclio/application/application.py +11 -13
- mlrun/runtimes/nuclio/application/reverse_proxy.go +66 -64
- mlrun/runtimes/nuclio/function.py +127 -70
- mlrun/runtimes/nuclio/serving.py +105 -37
- mlrun/runtimes/pod.py +159 -54
- mlrun/runtimes/remotesparkjob.py +3 -2
- mlrun/runtimes/sparkjob/__init__.py +0 -2
- mlrun/runtimes/sparkjob/spark3job.py +22 -12
- mlrun/runtimes/utils.py +7 -6
- mlrun/secrets.py +2 -2
- mlrun/serving/__init__.py +8 -0
- mlrun/serving/merger.py +7 -5
- mlrun/serving/remote.py +35 -22
- mlrun/serving/routers.py +186 -240
- mlrun/serving/server.py +41 -10
- mlrun/serving/states.py +432 -118
- mlrun/serving/utils.py +13 -2
- mlrun/serving/v1_serving.py +3 -2
- mlrun/serving/v2_serving.py +161 -203
- mlrun/track/__init__.py +1 -1
- mlrun/track/tracker.py +2 -2
- mlrun/track/trackers/mlflow_tracker.py +6 -5
- mlrun/utils/async_http.py +35 -22
- mlrun/utils/clones.py +7 -4
- mlrun/utils/helpers.py +511 -58
- mlrun/utils/logger.py +119 -13
- mlrun/utils/notifications/notification/__init__.py +22 -19
- mlrun/utils/notifications/notification/base.py +39 -15
- mlrun/utils/notifications/notification/console.py +6 -6
- mlrun/utils/notifications/notification/git.py +11 -11
- mlrun/utils/notifications/notification/ipython.py +10 -9
- mlrun/utils/notifications/notification/mail.py +176 -0
- mlrun/utils/notifications/notification/slack.py +16 -8
- mlrun/utils/notifications/notification/webhook.py +24 -8
- mlrun/utils/notifications/notification_pusher.py +191 -200
- mlrun/utils/regex.py +12 -2
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/METADATA +69 -54
- mlrun-1.8.0.dist-info/RECORD +351 -0
- {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/WHEEL +1 -1
- mlrun/model_monitoring/applications/evidently_base.py +0 -137
- mlrun/model_monitoring/db/stores/__init__.py +0 -136
- mlrun/model_monitoring/db/stores/base/store.py +0 -213
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -71
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -190
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +0 -103
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -40
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +0 -659
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +0 -726
- mlrun/model_monitoring/model_endpoint.py +0 -118
- mlrun-1.7.2rc4.dist-info/RECORD +0 -351
- {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info/licenses}/LICENSE +0 -0
- {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/top_level.txt +0 -0
mlrun/artifacts/base.py
CHANGED
|
@@ -36,7 +36,16 @@ from ..utils import (
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class ArtifactMetadata(ModelObj):
|
|
39
|
-
_dict_fields = [
|
|
39
|
+
_dict_fields = [
|
|
40
|
+
"key",
|
|
41
|
+
"project",
|
|
42
|
+
"iter",
|
|
43
|
+
"tree",
|
|
44
|
+
"description",
|
|
45
|
+
"hash",
|
|
46
|
+
"tag",
|
|
47
|
+
"uid",
|
|
48
|
+
]
|
|
40
49
|
_extra_fields = ["updated", "labels"]
|
|
41
50
|
|
|
42
51
|
def __init__(
|
|
@@ -48,6 +57,7 @@ class ArtifactMetadata(ModelObj):
|
|
|
48
57
|
description=None,
|
|
49
58
|
hash=None,
|
|
50
59
|
tag=None,
|
|
60
|
+
uid=None,
|
|
51
61
|
):
|
|
52
62
|
self.key = key
|
|
53
63
|
self.project = project
|
|
@@ -58,18 +68,26 @@ class ArtifactMetadata(ModelObj):
|
|
|
58
68
|
self.labels = {}
|
|
59
69
|
self.updated = None
|
|
60
70
|
self.tag = tag # temp store of the tag
|
|
71
|
+
self.uid = uid
|
|
61
72
|
|
|
62
73
|
def base_dict(self):
|
|
63
74
|
return super().to_dict()
|
|
64
75
|
|
|
65
|
-
def to_dict(
|
|
76
|
+
def to_dict(
|
|
77
|
+
self,
|
|
78
|
+
fields: typing.Optional[list] = None,
|
|
79
|
+
exclude: typing.Optional[list] = None,
|
|
80
|
+
strip: bool = False,
|
|
81
|
+
):
|
|
66
82
|
"""return long dict form of the artifact"""
|
|
67
83
|
return super().to_dict(
|
|
68
84
|
self._dict_fields + self._extra_fields, exclude=exclude, strip=strip
|
|
69
85
|
)
|
|
70
86
|
|
|
71
87
|
@classmethod
|
|
72
|
-
def from_dict(
|
|
88
|
+
def from_dict(
|
|
89
|
+
cls, struct=None, fields=None, deprecated_fields: typing.Optional[dict] = None
|
|
90
|
+
):
|
|
73
91
|
fields = fields or cls._dict_fields + cls._extra_fields
|
|
74
92
|
return super().from_dict(
|
|
75
93
|
struct, fields=fields, deprecated_fields=deprecated_fields
|
|
@@ -109,7 +127,7 @@ class ArtifactSpec(ModelObj):
|
|
|
109
127
|
db_key=None,
|
|
110
128
|
extra_data=None,
|
|
111
129
|
body=None,
|
|
112
|
-
unpackaging_instructions: dict = None,
|
|
130
|
+
unpackaging_instructions: typing.Optional[dict] = None,
|
|
113
131
|
):
|
|
114
132
|
self.src_path = src_path
|
|
115
133
|
self.target_path = target_path
|
|
@@ -131,14 +149,21 @@ class ArtifactSpec(ModelObj):
|
|
|
131
149
|
def base_dict(self):
|
|
132
150
|
return super().to_dict()
|
|
133
151
|
|
|
134
|
-
def to_dict(
|
|
152
|
+
def to_dict(
|
|
153
|
+
self,
|
|
154
|
+
fields: typing.Optional[list] = None,
|
|
155
|
+
exclude: typing.Optional[list] = None,
|
|
156
|
+
strip: bool = False,
|
|
157
|
+
):
|
|
135
158
|
"""return long dict form of the artifact"""
|
|
136
159
|
return super().to_dict(
|
|
137
160
|
self._dict_fields + self._extra_fields, exclude=exclude, strip=strip
|
|
138
161
|
)
|
|
139
162
|
|
|
140
163
|
@classmethod
|
|
141
|
-
def from_dict(
|
|
164
|
+
def from_dict(
|
|
165
|
+
cls, struct=None, fields=None, deprecated_fields: typing.Optional[dict] = None
|
|
166
|
+
):
|
|
142
167
|
fields = fields or cls._dict_fields + cls._extra_fields
|
|
143
168
|
return super().from_dict(
|
|
144
169
|
struct, fields=fields, deprecated_fields=deprecated_fields
|
|
@@ -192,9 +217,9 @@ class Artifact(ModelObj):
|
|
|
192
217
|
size=None,
|
|
193
218
|
target_path=None,
|
|
194
219
|
project=None,
|
|
195
|
-
src_path: str = None,
|
|
220
|
+
src_path: typing.Optional[str] = None,
|
|
196
221
|
# All params up until here are legacy params for compatibility with legacy artifacts.
|
|
197
|
-
# TODO: remove them in 1.
|
|
222
|
+
# TODO: remove them in 1.10.0.
|
|
198
223
|
metadata: ArtifactMetadata = None,
|
|
199
224
|
spec: ArtifactSpec = None,
|
|
200
225
|
):
|
|
@@ -210,7 +235,7 @@ class Artifact(ModelObj):
|
|
|
210
235
|
or src_path
|
|
211
236
|
):
|
|
212
237
|
warnings.warn(
|
|
213
|
-
"Artifact constructor parameters are deprecated and will be removed in 1.
|
|
238
|
+
"Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
|
|
214
239
|
"Use the metadata and spec parameters instead.",
|
|
215
240
|
DeprecationWarning,
|
|
216
241
|
)
|
|
@@ -354,6 +379,7 @@ class Artifact(ModelObj):
|
|
|
354
379
|
iter=self.metadata.iter,
|
|
355
380
|
tree=tree,
|
|
356
381
|
tag=tag,
|
|
382
|
+
uid=self.uid,
|
|
357
383
|
)
|
|
358
384
|
return mlrun.datastore.get_store_uri(self._store_prefix, uri)
|
|
359
385
|
|
|
@@ -366,7 +392,7 @@ class Artifact(ModelObj):
|
|
|
366
392
|
struct[field] = val.base_dict()
|
|
367
393
|
return struct
|
|
368
394
|
|
|
369
|
-
def upload(self, artifact_path: str = None):
|
|
395
|
+
def upload(self, artifact_path: typing.Optional[str] = None):
|
|
370
396
|
"""
|
|
371
397
|
internal, upload to target store
|
|
372
398
|
:param artifact_path: required only for when generating target_path from artifact hash
|
|
@@ -379,7 +405,9 @@ class Artifact(ModelObj):
|
|
|
379
405
|
if src_path and os.path.isfile(src_path):
|
|
380
406
|
self._upload_file(source_path=src_path, artifact_path=artifact_path)
|
|
381
407
|
|
|
382
|
-
def _upload_body(
|
|
408
|
+
def _upload_body(
|
|
409
|
+
self, body, target=None, artifact_path: typing.Optional[str] = None
|
|
410
|
+
):
|
|
383
411
|
body_hash = None
|
|
384
412
|
if not target and not self.spec.target_path:
|
|
385
413
|
if not mlrun.mlconf.artifacts.generate_target_path_from_artifact_hash:
|
|
@@ -400,7 +428,10 @@ class Artifact(ModelObj):
|
|
|
400
428
|
)
|
|
401
429
|
|
|
402
430
|
def _upload_file(
|
|
403
|
-
self,
|
|
431
|
+
self,
|
|
432
|
+
source_path: str,
|
|
433
|
+
target_path: typing.Optional[str] = None,
|
|
434
|
+
artifact_path: typing.Optional[str] = None,
|
|
404
435
|
):
|
|
405
436
|
file_hash = None
|
|
406
437
|
if not target_path and not self.spec.target_path:
|
|
@@ -623,6 +654,14 @@ class Artifact(ModelObj):
|
|
|
623
654
|
def hash(self, hash):
|
|
624
655
|
self.metadata.hash = hash
|
|
625
656
|
|
|
657
|
+
@property
|
|
658
|
+
def uid(self):
|
|
659
|
+
return self.metadata.uid
|
|
660
|
+
|
|
661
|
+
@uid.setter
|
|
662
|
+
def uid(self, uid):
|
|
663
|
+
self.metadata.uid = uid
|
|
664
|
+
|
|
626
665
|
def generate_target_path(self, artifact_path, producer):
|
|
627
666
|
return generate_target_path(self, artifact_path, producer)
|
|
628
667
|
|
|
@@ -651,7 +690,7 @@ class DirArtifact(Artifact):
|
|
|
651
690
|
def is_dir(self):
|
|
652
691
|
return True
|
|
653
692
|
|
|
654
|
-
def upload(self, artifact_path: str = None):
|
|
693
|
+
def upload(self, artifact_path: typing.Optional[str] = None):
|
|
655
694
|
"""
|
|
656
695
|
internal, upload to target store
|
|
657
696
|
:param artifact_path: required only for when generating target_path from artifact hash
|
|
@@ -719,13 +758,13 @@ class LinkArtifact(Artifact):
|
|
|
719
758
|
link_tree=None,
|
|
720
759
|
project=None,
|
|
721
760
|
# All params up until here are legacy params for compatibility with legacy artifacts.
|
|
722
|
-
# TODO: remove them in 1.
|
|
761
|
+
# TODO: remove them in 1.10.0.
|
|
723
762
|
metadata: ArtifactMetadata = None,
|
|
724
763
|
spec: LinkArtifactSpec = None,
|
|
725
764
|
):
|
|
726
765
|
if key or target_path or link_iteration or link_key or link_tree or project:
|
|
727
766
|
warnings.warn(
|
|
728
|
-
"Artifact constructor parameters are deprecated and will be removed in 1.
|
|
767
|
+
"Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
|
|
729
768
|
"Use the metadata and spec parameters instead.",
|
|
730
769
|
DeprecationWarning,
|
|
731
770
|
)
|
|
@@ -758,13 +797,17 @@ def upload_extra_data(
|
|
|
758
797
|
extra_data: dict,
|
|
759
798
|
prefix="",
|
|
760
799
|
update_spec=False,
|
|
761
|
-
artifact_path: str = None,
|
|
800
|
+
artifact_path: typing.Optional[str] = None,
|
|
762
801
|
):
|
|
763
802
|
"""upload extra data to the artifact store"""
|
|
764
803
|
if not extra_data:
|
|
765
804
|
return
|
|
766
805
|
target_path = artifact.target_path
|
|
767
806
|
for key, item in extra_data.items():
|
|
807
|
+
if item is ...:
|
|
808
|
+
# Skip future links (packagers feature for linking artifacts before they are logged)
|
|
809
|
+
continue
|
|
810
|
+
|
|
768
811
|
if isinstance(item, bytes):
|
|
769
812
|
if target_path:
|
|
770
813
|
target = os.path.join(target_path, prefix + key)
|
|
@@ -850,7 +893,7 @@ def generate_target_path(item: Artifact, artifact_path, producer):
|
|
|
850
893
|
return f"{artifact_path}{item.key}{suffix}"
|
|
851
894
|
|
|
852
895
|
|
|
853
|
-
# TODO:
|
|
896
|
+
# TODO: Remove once data migration v5 is obsolete
|
|
854
897
|
def convert_legacy_artifact_to_new_format(
|
|
855
898
|
legacy_artifact: dict,
|
|
856
899
|
) -> Artifact:
|
|
@@ -862,9 +905,9 @@ def convert_legacy_artifact_to_new_format(
|
|
|
862
905
|
artifact_tag = legacy_artifact.get("tag", "")
|
|
863
906
|
if artifact_tag:
|
|
864
907
|
artifact_key = f"{artifact_key}:{artifact_tag}"
|
|
865
|
-
# TODO:
|
|
908
|
+
# TODO: Remove once data migration v5 is obsolete
|
|
866
909
|
warnings.warn(
|
|
867
|
-
f"Converting legacy artifact '{artifact_key}' to new format. This will not be supported in MLRun 1.
|
|
910
|
+
f"Converting legacy artifact '{artifact_key}' to new format. This will not be supported in MLRun 1.10.0. "
|
|
868
911
|
f"Make sure to save the artifact/project in the new format.",
|
|
869
912
|
FutureWarning,
|
|
870
913
|
)
|
mlrun/artifacts/dataset.py
CHANGED
|
@@ -149,21 +149,21 @@ class DatasetArtifact(Artifact):
|
|
|
149
149
|
|
|
150
150
|
def __init__(
|
|
151
151
|
self,
|
|
152
|
-
key: str = None,
|
|
152
|
+
key: Optional[str] = None,
|
|
153
153
|
df=None,
|
|
154
|
-
preview: int = None,
|
|
154
|
+
preview: Optional[int] = None,
|
|
155
155
|
format: str = "", # TODO: should be changed to 'fmt'.
|
|
156
|
-
stats: bool = None,
|
|
157
|
-
target_path: str = None,
|
|
158
|
-
extra_data: dict = None,
|
|
159
|
-
column_metadata: dict = None,
|
|
156
|
+
stats: Optional[bool] = None,
|
|
157
|
+
target_path: Optional[str] = None,
|
|
158
|
+
extra_data: Optional[dict] = None,
|
|
159
|
+
column_metadata: Optional[dict] = None,
|
|
160
160
|
ignore_preview_limits: bool = False,
|
|
161
|
-
label_column: str = None,
|
|
161
|
+
label_column: Optional[str] = None,
|
|
162
162
|
**kwargs,
|
|
163
163
|
):
|
|
164
164
|
if key or format or target_path:
|
|
165
165
|
warnings.warn(
|
|
166
|
-
"Artifact constructor parameters are deprecated and will be removed in 1.
|
|
166
|
+
"Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
|
|
167
167
|
"Use the metadata and spec parameters instead.",
|
|
168
168
|
DeprecationWarning,
|
|
169
169
|
)
|
|
@@ -207,7 +207,7 @@ class DatasetArtifact(Artifact):
|
|
|
207
207
|
def spec(self, spec):
|
|
208
208
|
self._spec = self._verify_dict(spec, "spec", DatasetArtifactSpec)
|
|
209
209
|
|
|
210
|
-
def upload(self, artifact_path: str = None):
|
|
210
|
+
def upload(self, artifact_path: Optional[str] = None):
|
|
211
211
|
"""
|
|
212
212
|
internal, upload to target store
|
|
213
213
|
:param artifact_path: required only for when generating target_path from artifact hash
|
|
@@ -396,13 +396,13 @@ def get_df_stats(df):
|
|
|
396
396
|
def update_dataset_meta(
|
|
397
397
|
artifact,
|
|
398
398
|
from_df=None,
|
|
399
|
-
schema: dict = None,
|
|
400
|
-
header: list = None,
|
|
401
|
-
preview: list = None,
|
|
402
|
-
stats: dict = None,
|
|
403
|
-
extra_data: dict = None,
|
|
404
|
-
column_metadata: dict = None,
|
|
405
|
-
labels: dict = None,
|
|
399
|
+
schema: Optional[dict] = None,
|
|
400
|
+
header: Optional[list] = None,
|
|
401
|
+
preview: Optional[list] = None,
|
|
402
|
+
stats: Optional[dict] = None,
|
|
403
|
+
extra_data: Optional[dict] = None,
|
|
404
|
+
column_metadata: Optional[dict] = None,
|
|
405
|
+
labels: Optional[dict] = None,
|
|
406
406
|
ignore_preview_limits: bool = False,
|
|
407
407
|
):
|
|
408
408
|
"""Update dataset object attributes/metadata
|
|
@@ -495,4 +495,4 @@ def upload_dataframe(
|
|
|
495
495
|
size = target_class(path=target_path).write_dataframe(df, **kw)
|
|
496
496
|
return size, None
|
|
497
497
|
|
|
498
|
-
raise mlrun.errors.MLRunInvalidArgumentError(f"
|
|
498
|
+
raise mlrun.errors.MLRunInvalidArgumentError(f"Format {format} not implemented yet")
|