mlrun 1.6.0rc35__py3-none-any.whl → 1.7.0rc2__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/__main__.py +3 -3
- mlrun/api/schemas/__init__.py +1 -1
- mlrun/artifacts/base.py +11 -6
- mlrun/artifacts/dataset.py +2 -2
- mlrun/artifacts/model.py +30 -24
- mlrun/artifacts/plots.py +2 -2
- mlrun/common/db/sql_session.py +5 -3
- mlrun/common/helpers.py +1 -2
- mlrun/common/schemas/artifact.py +3 -3
- mlrun/common/schemas/auth.py +3 -3
- mlrun/common/schemas/background_task.py +1 -1
- mlrun/common/schemas/client_spec.py +1 -1
- mlrun/common/schemas/feature_store.py +16 -16
- mlrun/common/schemas/frontend_spec.py +7 -7
- mlrun/common/schemas/function.py +1 -1
- mlrun/common/schemas/hub.py +4 -9
- mlrun/common/schemas/memory_reports.py +2 -2
- mlrun/common/schemas/model_monitoring/grafana.py +4 -4
- mlrun/common/schemas/model_monitoring/model_endpoints.py +14 -15
- mlrun/common/schemas/notification.py +4 -4
- mlrun/common/schemas/object.py +2 -2
- mlrun/common/schemas/pipeline.py +1 -1
- mlrun/common/schemas/project.py +3 -3
- mlrun/common/schemas/runtime_resource.py +8 -12
- mlrun/common/schemas/schedule.py +3 -3
- mlrun/common/schemas/tag.py +1 -2
- mlrun/common/schemas/workflow.py +2 -2
- mlrun/config.py +8 -4
- mlrun/data_types/to_pandas.py +1 -3
- mlrun/datastore/base.py +0 -28
- mlrun/datastore/datastore_profile.py +9 -9
- mlrun/datastore/filestore.py +0 -1
- mlrun/datastore/google_cloud_storage.py +1 -1
- mlrun/datastore/sources.py +7 -11
- mlrun/datastore/spark_utils.py +1 -2
- mlrun/datastore/targets.py +31 -31
- mlrun/datastore/utils.py +4 -6
- mlrun/datastore/v3io.py +70 -46
- mlrun/db/base.py +22 -23
- mlrun/db/httpdb.py +34 -34
- mlrun/db/nopdb.py +19 -19
- mlrun/errors.py +1 -1
- mlrun/execution.py +4 -4
- mlrun/feature_store/api.py +20 -21
- mlrun/feature_store/common.py +1 -1
- mlrun/feature_store/feature_set.py +28 -32
- mlrun/feature_store/feature_vector.py +24 -27
- mlrun/feature_store/retrieval/base.py +7 -7
- mlrun/feature_store/retrieval/conversion.py +2 -4
- mlrun/feature_store/steps.py +7 -15
- mlrun/features.py +5 -7
- mlrun/frameworks/_common/artifacts_library.py +9 -9
- mlrun/frameworks/_common/mlrun_interface.py +5 -5
- mlrun/frameworks/_common/model_handler.py +48 -48
- mlrun/frameworks/_common/plan.py +2 -3
- mlrun/frameworks/_common/producer.py +3 -4
- mlrun/frameworks/_common/utils.py +5 -5
- mlrun/frameworks/_dl_common/loggers/logger.py +6 -7
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +9 -9
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +16 -35
- mlrun/frameworks/_ml_common/artifacts_library.py +1 -2
- mlrun/frameworks/_ml_common/loggers/logger.py +3 -4
- mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +4 -5
- mlrun/frameworks/_ml_common/model_handler.py +24 -24
- mlrun/frameworks/_ml_common/pkl_model_server.py +2 -2
- mlrun/frameworks/_ml_common/plan.py +1 -1
- mlrun/frameworks/_ml_common/plans/calibration_curve_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/feature_importance_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/_ml_common/utils.py +4 -4
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +7 -7
- mlrun/frameworks/huggingface/model_server.py +4 -4
- mlrun/frameworks/lgbm/__init__.py +32 -32
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -5
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -5
- mlrun/frameworks/lgbm/mlrun_interfaces/booster_mlrun_interface.py +1 -3
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +6 -6
- mlrun/frameworks/lgbm/model_handler.py +9 -9
- mlrun/frameworks/lgbm/model_server.py +6 -6
- mlrun/frameworks/lgbm/utils.py +5 -5
- mlrun/frameworks/onnx/dataset.py +8 -8
- mlrun/frameworks/onnx/mlrun_interface.py +3 -3
- mlrun/frameworks/onnx/model_handler.py +6 -6
- mlrun/frameworks/onnx/model_server.py +7 -7
- mlrun/frameworks/parallel_coordinates.py +2 -2
- mlrun/frameworks/pytorch/__init__.py +16 -16
- mlrun/frameworks/pytorch/callbacks/callback.py +4 -5
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +17 -17
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +23 -29
- mlrun/frameworks/pytorch/callbacks_handler.py +38 -38
- mlrun/frameworks/pytorch/mlrun_interface.py +20 -20
- mlrun/frameworks/pytorch/model_handler.py +17 -17
- mlrun/frameworks/pytorch/model_server.py +7 -7
- mlrun/frameworks/sklearn/__init__.py +12 -12
- mlrun/frameworks/sklearn/estimator.py +4 -4
- mlrun/frameworks/sklearn/metrics_library.py +14 -14
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -6
- mlrun/frameworks/sklearn/model_handler.py +2 -2
- mlrun/frameworks/tf_keras/__init__.py +5 -5
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +14 -14
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +19 -23
- mlrun/frameworks/tf_keras/mlrun_interface.py +7 -9
- mlrun/frameworks/tf_keras/model_handler.py +14 -14
- mlrun/frameworks/tf_keras/model_server.py +6 -6
- mlrun/frameworks/xgboost/__init__.py +12 -12
- mlrun/frameworks/xgboost/model_handler.py +6 -6
- mlrun/k8s_utils.py +4 -5
- mlrun/kfpops.py +2 -2
- mlrun/launcher/base.py +10 -10
- mlrun/launcher/local.py +8 -8
- mlrun/launcher/remote.py +7 -7
- mlrun/lists.py +3 -4
- mlrun/model.py +205 -55
- mlrun/model_monitoring/api.py +21 -24
- mlrun/model_monitoring/application.py +4 -4
- mlrun/model_monitoring/batch.py +17 -17
- mlrun/model_monitoring/controller.py +2 -1
- mlrun/model_monitoring/features_drift_table.py +44 -31
- mlrun/model_monitoring/prometheus.py +1 -4
- mlrun/model_monitoring/stores/kv_model_endpoint_store.py +11 -13
- mlrun/model_monitoring/stores/model_endpoint_store.py +9 -11
- mlrun/model_monitoring/stores/models/__init__.py +2 -2
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +11 -13
- mlrun/model_monitoring/stream_processing.py +16 -34
- mlrun/model_monitoring/tracking_policy.py +2 -1
- mlrun/package/__init__.py +6 -6
- mlrun/package/context_handler.py +5 -5
- mlrun/package/packager.py +7 -7
- mlrun/package/packagers/default_packager.py +6 -6
- mlrun/package/packagers/numpy_packagers.py +15 -15
- mlrun/package/packagers/pandas_packagers.py +5 -5
- mlrun/package/packagers/python_standard_library_packagers.py +10 -10
- mlrun/package/packagers_manager.py +18 -23
- mlrun/package/utils/_formatter.py +4 -4
- mlrun/package/utils/_pickler.py +2 -2
- mlrun/package/utils/_supported_format.py +4 -4
- mlrun/package/utils/log_hint_utils.py +2 -2
- mlrun/package/utils/type_hint_utils.py +4 -9
- mlrun/platforms/other.py +1 -2
- mlrun/projects/operations.py +5 -5
- mlrun/projects/pipelines.py +9 -9
- mlrun/projects/project.py +58 -46
- mlrun/render.py +1 -1
- mlrun/run.py +9 -9
- mlrun/runtimes/__init__.py +7 -4
- mlrun/runtimes/base.py +20 -23
- mlrun/runtimes/constants.py +5 -5
- mlrun/runtimes/daskjob.py +8 -8
- mlrun/runtimes/databricks_job/databricks_cancel_task.py +1 -1
- mlrun/runtimes/databricks_job/databricks_runtime.py +7 -7
- mlrun/runtimes/function_reference.py +1 -1
- mlrun/runtimes/local.py +1 -1
- mlrun/runtimes/mpijob/abstract.py +1 -2
- mlrun/runtimes/nuclio/__init__.py +20 -0
- mlrun/runtimes/{function.py → nuclio/function.py} +15 -16
- mlrun/runtimes/{nuclio.py → nuclio/nuclio.py} +6 -6
- mlrun/runtimes/{serving.py → nuclio/serving.py} +13 -12
- mlrun/runtimes/pod.py +95 -48
- mlrun/runtimes/remotesparkjob.py +1 -1
- mlrun/runtimes/sparkjob/spark3job.py +50 -33
- mlrun/runtimes/utils.py +1 -2
- mlrun/secrets.py +3 -3
- mlrun/serving/remote.py +0 -4
- mlrun/serving/routers.py +6 -6
- mlrun/serving/server.py +4 -4
- mlrun/serving/states.py +29 -0
- mlrun/serving/utils.py +3 -3
- mlrun/serving/v1_serving.py +6 -7
- mlrun/serving/v2_serving.py +50 -8
- mlrun/track/tracker_manager.py +3 -3
- mlrun/track/trackers/mlflow_tracker.py +1 -2
- mlrun/utils/async_http.py +5 -7
- mlrun/utils/azure_vault.py +1 -1
- mlrun/utils/clones.py +1 -2
- mlrun/utils/condition_evaluator.py +3 -3
- mlrun/utils/db.py +3 -3
- mlrun/utils/helpers.py +37 -119
- mlrun/utils/http.py +1 -4
- mlrun/utils/logger.py +49 -14
- mlrun/utils/notifications/notification/__init__.py +3 -3
- mlrun/utils/notifications/notification/base.py +2 -2
- mlrun/utils/notifications/notification/ipython.py +1 -1
- mlrun/utils/notifications/notification_pusher.py +8 -14
- mlrun/utils/retryer.py +207 -0
- mlrun/utils/singleton.py +1 -1
- mlrun/utils/v3io_clients.py +2 -3
- mlrun/utils/version/version.json +2 -2
- mlrun/utils/version/version.py +2 -6
- {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/METADATA +9 -9
- mlrun-1.7.0rc2.dist-info/RECORD +315 -0
- mlrun-1.6.0rc35.dist-info/RECORD +0 -313
- {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/LICENSE +0 -0
- {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/WHEEL +0 -0
- {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/entry_points.txt +0 -0
- {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/top_level.txt +0 -0
mlrun/__main__.py
CHANGED
|
@@ -863,9 +863,9 @@ def db(
|
|
|
863
863
|
env["MLRUN_DBPATH"] = ""
|
|
864
864
|
|
|
865
865
|
if port is not None:
|
|
866
|
-
env["
|
|
866
|
+
env["MLRUN_HTTPDB__PORT"] = str(port)
|
|
867
867
|
if dirpath is not None:
|
|
868
|
-
env["
|
|
868
|
+
env["MLRUN_HTTPDB__DIRPATH"] = dirpath
|
|
869
869
|
if dsn is not None:
|
|
870
870
|
if dsn.startswith("sqlite://") and "check_same_thread=" not in dsn:
|
|
871
871
|
dsn += "?check_same_thread=false"
|
|
@@ -1452,7 +1452,7 @@ def load_notification(notifications: str, project: mlrun.projects.MlrunProject):
|
|
|
1452
1452
|
for notification in notifications:
|
|
1453
1453
|
if notification.startswith("file="):
|
|
1454
1454
|
file_path = notification.split("=")[-1]
|
|
1455
|
-
notification = open(file_path
|
|
1455
|
+
notification = open(file_path)
|
|
1456
1456
|
notification = json.load(notification)
|
|
1457
1457
|
else:
|
|
1458
1458
|
notification = json.loads(notification)
|
mlrun/api/schemas/__init__.py
CHANGED
|
@@ -48,7 +48,7 @@ import mlrun.common.schemas.secret as old_secret
|
|
|
48
48
|
import mlrun.common.schemas.tag as old_tag
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
class DeprecationHelper
|
|
51
|
+
class DeprecationHelper:
|
|
52
52
|
"""A helper class to deprecate old schemas"""
|
|
53
53
|
|
|
54
54
|
def __init__(self, new_target, version="1.4.0"):
|
mlrun/artifacts/base.py
CHANGED
|
@@ -63,9 +63,11 @@ class ArtifactMetadata(ModelObj):
|
|
|
63
63
|
def base_dict(self):
|
|
64
64
|
return super().to_dict()
|
|
65
65
|
|
|
66
|
-
def to_dict(self, fields=None, exclude=None):
|
|
66
|
+
def to_dict(self, fields: list = None, exclude: list = None, strip: bool = False):
|
|
67
67
|
"""return long dict form of the artifact"""
|
|
68
|
-
return super().to_dict(
|
|
68
|
+
return super().to_dict(
|
|
69
|
+
self._dict_fields + self._extra_fields, exclude=exclude, strip=strip
|
|
70
|
+
)
|
|
69
71
|
|
|
70
72
|
@classmethod
|
|
71
73
|
def from_dict(cls, struct=None, fields=None, deprecated_fields: dict = None):
|
|
@@ -129,9 +131,11 @@ class ArtifactSpec(ModelObj):
|
|
|
129
131
|
def base_dict(self):
|
|
130
132
|
return super().to_dict()
|
|
131
133
|
|
|
132
|
-
def to_dict(self, fields=None, exclude=None):
|
|
134
|
+
def to_dict(self, fields: list = None, exclude: list = None, strip: bool = False):
|
|
133
135
|
"""return long dict form of the artifact"""
|
|
134
|
-
return super().to_dict(
|
|
136
|
+
return super().to_dict(
|
|
137
|
+
self._dict_fields + self._extra_fields, exclude=exclude, strip=strip
|
|
138
|
+
)
|
|
135
139
|
|
|
136
140
|
@classmethod
|
|
137
141
|
def from_dict(cls, struct=None, fields=None, deprecated_fields: dict = None):
|
|
@@ -833,11 +837,12 @@ class LegacyArtifact(ModelObj):
|
|
|
833
837
|
"""return short dict form of the artifact"""
|
|
834
838
|
return super().to_dict()
|
|
835
839
|
|
|
836
|
-
def to_dict(self, fields=None):
|
|
840
|
+
def to_dict(self, fields: list = None, exclude: list = None, strip: bool = False):
|
|
837
841
|
"""return long dict form of the artifact"""
|
|
838
842
|
return super().to_dict(
|
|
839
843
|
self._dict_fields
|
|
840
|
-
+ ["updated", "labels", "annotations", "producer", "sources", "project"]
|
|
844
|
+
+ ["updated", "labels", "annotations", "producer", "sources", "project"],
|
|
845
|
+
strip=strip,
|
|
841
846
|
)
|
|
842
847
|
|
|
843
848
|
@classmethod
|
mlrun/artifacts/dataset.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import os
|
|
15
15
|
import pathlib
|
|
16
16
|
from io import StringIO
|
|
17
|
-
from typing import Optional
|
|
17
|
+
from typing import Optional
|
|
18
18
|
|
|
19
19
|
import numpy as np
|
|
20
20
|
import pandas as pd
|
|
@@ -656,7 +656,7 @@ def update_dataset_meta(
|
|
|
656
656
|
|
|
657
657
|
def upload_dataframe(
|
|
658
658
|
df, target_path, format, src_path=None, **kw
|
|
659
|
-
) ->
|
|
659
|
+
) -> tuple[Optional[int], Optional[str]]:
|
|
660
660
|
if src_path and os.path.isfile(src_path):
|
|
661
661
|
mlrun.datastore.store_manager.object(url=target_path).upload(src_path)
|
|
662
662
|
return (
|
mlrun/artifacts/model.py
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import tempfile
|
|
15
15
|
from os import path
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Any
|
|
17
17
|
|
|
18
|
+
import pandas as pd
|
|
18
19
|
import yaml
|
|
19
20
|
from deprecated import deprecated
|
|
20
21
|
|
|
@@ -68,8 +69,8 @@ class ModelArtifactSpec(ArtifactSpec):
|
|
|
68
69
|
model_file=None,
|
|
69
70
|
metrics=None,
|
|
70
71
|
paraemeters=None,
|
|
71
|
-
inputs:
|
|
72
|
-
outputs:
|
|
72
|
+
inputs: list[Feature] = None,
|
|
73
|
+
outputs: list[Feature] = None,
|
|
73
74
|
framework=None,
|
|
74
75
|
algorithm=None,
|
|
75
76
|
feature_vector=None,
|
|
@@ -91,8 +92,8 @@ class ModelArtifactSpec(ArtifactSpec):
|
|
|
91
92
|
self.model_file = model_file
|
|
92
93
|
self.metrics = metrics or {}
|
|
93
94
|
self.parameters = paraemeters or {}
|
|
94
|
-
self.inputs:
|
|
95
|
-
self.outputs:
|
|
95
|
+
self.inputs: list[Feature] = inputs or []
|
|
96
|
+
self.outputs: list[Feature] = outputs or []
|
|
96
97
|
self.framework = framework
|
|
97
98
|
self.algorithm = algorithm
|
|
98
99
|
self.feature_vector = feature_vector
|
|
@@ -101,21 +102,21 @@ class ModelArtifactSpec(ArtifactSpec):
|
|
|
101
102
|
self.model_target_file = model_target_file
|
|
102
103
|
|
|
103
104
|
@property
|
|
104
|
-
def inputs(self) ->
|
|
105
|
+
def inputs(self) -> list[Feature]:
|
|
105
106
|
"""input feature list"""
|
|
106
107
|
return self._inputs
|
|
107
108
|
|
|
108
109
|
@inputs.setter
|
|
109
|
-
def inputs(self, inputs:
|
|
110
|
+
def inputs(self, inputs: list[Feature]):
|
|
110
111
|
self._inputs = ObjectList.from_list(Feature, inputs)
|
|
111
112
|
|
|
112
113
|
@property
|
|
113
|
-
def outputs(self) ->
|
|
114
|
+
def outputs(self) -> list[Feature]:
|
|
114
115
|
"""output feature list"""
|
|
115
116
|
return self._outputs
|
|
116
117
|
|
|
117
118
|
@outputs.setter
|
|
118
|
-
def outputs(self, outputs:
|
|
119
|
+
def outputs(self, outputs: list[Feature]):
|
|
119
120
|
self._outputs = ObjectList.from_list(Feature, outputs)
|
|
120
121
|
|
|
121
122
|
|
|
@@ -175,22 +176,22 @@ class ModelArtifact(Artifact):
|
|
|
175
176
|
self._spec = self._verify_dict(spec, "spec", ModelArtifactSpec)
|
|
176
177
|
|
|
177
178
|
@property
|
|
178
|
-
def inputs(self) ->
|
|
179
|
+
def inputs(self) -> list[Feature]:
|
|
179
180
|
"""input feature list"""
|
|
180
181
|
return self.spec.inputs
|
|
181
182
|
|
|
182
183
|
@inputs.setter
|
|
183
|
-
def inputs(self, inputs:
|
|
184
|
+
def inputs(self, inputs: list[Feature]):
|
|
184
185
|
"""input feature list"""
|
|
185
186
|
self.spec.inputs = inputs
|
|
186
187
|
|
|
187
188
|
@property
|
|
188
|
-
def outputs(self) ->
|
|
189
|
+
def outputs(self) -> list[Feature]:
|
|
189
190
|
"""input feature list"""
|
|
190
191
|
return self.spec.outputs
|
|
191
192
|
|
|
192
193
|
@outputs.setter
|
|
193
|
-
def outputs(self, outputs:
|
|
194
|
+
def outputs(self, outputs: list[Feature]):
|
|
194
195
|
"""input feature list"""
|
|
195
196
|
self.spec.outputs = outputs
|
|
196
197
|
|
|
@@ -260,6 +261,7 @@ class ModelArtifact(Artifact):
|
|
|
260
261
|
"""
|
|
261
262
|
subset = df
|
|
262
263
|
inferer = get_infer_interface(subset)
|
|
264
|
+
numeric_columns = self._extract_numeric_features(df)
|
|
263
265
|
if label_columns:
|
|
264
266
|
if not isinstance(label_columns, list):
|
|
265
267
|
label_columns = [label_columns]
|
|
@@ -273,9 +275,13 @@ class ModelArtifact(Artifact):
|
|
|
273
275
|
)
|
|
274
276
|
if with_stats:
|
|
275
277
|
self.spec.feature_stats = inferer.get_stats(
|
|
276
|
-
df, options=InferOptions.Histogram, num_bins=num_bins
|
|
278
|
+
df[numeric_columns], options=InferOptions.Histogram, num_bins=num_bins
|
|
277
279
|
)
|
|
278
280
|
|
|
281
|
+
@staticmethod
|
|
282
|
+
def _extract_numeric_features(df: pd.DataFrame) -> list[Any]:
|
|
283
|
+
return [col for col in df.columns if pd.api.types.is_numeric_dtype(df[col])]
|
|
284
|
+
|
|
279
285
|
@property
|
|
280
286
|
def is_dir(self):
|
|
281
287
|
return True
|
|
@@ -284,7 +290,7 @@ class ModelArtifact(Artifact):
|
|
|
284
290
|
if not self.spec.model_file:
|
|
285
291
|
raise ValueError("model_file attr must be specified")
|
|
286
292
|
|
|
287
|
-
super(
|
|
293
|
+
super().before_log()
|
|
288
294
|
|
|
289
295
|
if self.spec.framework:
|
|
290
296
|
self.metadata.labels = self.metadata.labels or {}
|
|
@@ -445,8 +451,8 @@ class LegacyModelArtifact(LegacyArtifact):
|
|
|
445
451
|
self.model_file = model_file
|
|
446
452
|
self.parameters = parameters or {}
|
|
447
453
|
self.metrics = metrics or {}
|
|
448
|
-
self.inputs:
|
|
449
|
-
self.outputs:
|
|
454
|
+
self.inputs: list[Feature] = inputs or []
|
|
455
|
+
self.outputs: list[Feature] = outputs or []
|
|
450
456
|
self.extra_data = extra_data or {}
|
|
451
457
|
self.framework = framework
|
|
452
458
|
self.algorithm = algorithm
|
|
@@ -456,21 +462,21 @@ class LegacyModelArtifact(LegacyArtifact):
|
|
|
456
462
|
self.model_target_file = model_target_file
|
|
457
463
|
|
|
458
464
|
@property
|
|
459
|
-
def inputs(self) ->
|
|
465
|
+
def inputs(self) -> list[Feature]:
|
|
460
466
|
"""input feature list"""
|
|
461
467
|
return self._inputs
|
|
462
468
|
|
|
463
469
|
@inputs.setter
|
|
464
|
-
def inputs(self, inputs:
|
|
470
|
+
def inputs(self, inputs: list[Feature]):
|
|
465
471
|
self._inputs = ObjectList.from_list(Feature, inputs)
|
|
466
472
|
|
|
467
473
|
@property
|
|
468
|
-
def outputs(self) ->
|
|
474
|
+
def outputs(self) -> list[Feature]:
|
|
469
475
|
"""output feature list"""
|
|
470
476
|
return self._outputs
|
|
471
477
|
|
|
472
478
|
@outputs.setter
|
|
473
|
-
def outputs(self, outputs:
|
|
479
|
+
def outputs(self, outputs: list[Feature]):
|
|
474
480
|
self._outputs = ObjectList.from_list(Feature, outputs)
|
|
475
481
|
|
|
476
482
|
def infer_from_df(self, df, label_columns=None, with_stats=True, num_bins=None):
|
|
@@ -505,7 +511,7 @@ class LegacyModelArtifact(LegacyArtifact):
|
|
|
505
511
|
if not self.model_file:
|
|
506
512
|
raise ValueError("model_file attr must be specified")
|
|
507
513
|
|
|
508
|
-
super(
|
|
514
|
+
super().before_log()
|
|
509
515
|
|
|
510
516
|
if self.framework:
|
|
511
517
|
self.labels = self.labels or {}
|
|
@@ -642,8 +648,8 @@ def update_model(
|
|
|
642
648
|
parameters: dict = None,
|
|
643
649
|
metrics: dict = None,
|
|
644
650
|
extra_data: dict = None,
|
|
645
|
-
inputs:
|
|
646
|
-
outputs:
|
|
651
|
+
inputs: list[Feature] = None,
|
|
652
|
+
outputs: list[Feature] = None,
|
|
647
653
|
feature_vector: str = None,
|
|
648
654
|
feature_weights: list = None,
|
|
649
655
|
key_prefix: str = "",
|
mlrun/artifacts/plots.py
CHANGED
|
@@ -176,7 +176,7 @@ class BokehArtifact(Artifact):
|
|
|
176
176
|
if figure is not None and not isinstance(figure, Figure):
|
|
177
177
|
raise ValueError(
|
|
178
178
|
"BokehArtifact requires the figure parameter to be a "
|
|
179
|
-
"'bokeh.plotting.Figure' but received '{
|
|
179
|
+
f"'bokeh.plotting.Figure' but received '{type(figure)}'"
|
|
180
180
|
)
|
|
181
181
|
|
|
182
182
|
# Call the artifact initializer:
|
|
@@ -412,7 +412,7 @@ class LegacyBokehArtifact(LegacyArtifact):
|
|
|
412
412
|
if figure is not None and not isinstance(figure, Figure):
|
|
413
413
|
raise ValueError(
|
|
414
414
|
"BokehArtifact requires the figure parameter to be a "
|
|
415
|
-
"'bokeh.plotting.Figure' but received '{
|
|
415
|
+
f"'bokeh.plotting.Figure' but received '{type(figure)}'"
|
|
416
416
|
)
|
|
417
417
|
|
|
418
418
|
# Call the artifact initializer:
|
mlrun/common/db/sql_session.py
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
-
import typing
|
|
17
16
|
|
|
18
17
|
from sqlalchemy import create_engine
|
|
19
18
|
from sqlalchemy.engine import Engine
|
|
@@ -23,8 +22,8 @@ from sqlalchemy.orm import sessionmaker as SessionMaker
|
|
|
23
22
|
from mlrun.config import config
|
|
24
23
|
|
|
25
24
|
# TODO: wrap the following functions in a singleton class
|
|
26
|
-
_engines:
|
|
27
|
-
_session_makers:
|
|
25
|
+
_engines: dict[str, Engine] = {}
|
|
26
|
+
_session_makers: dict[str, SessionMaker] = {}
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
# doing lazy load to allow tests to initialize the engine
|
|
@@ -63,9 +62,12 @@ def _init_engine(dsn=None):
|
|
|
63
62
|
max_overflow = config.httpdb.db.connections_pool_max_overflow
|
|
64
63
|
if max_overflow is None:
|
|
65
64
|
max_overflow = config.httpdb.max_workers
|
|
65
|
+
|
|
66
66
|
kwargs = {
|
|
67
67
|
"pool_size": pool_size,
|
|
68
68
|
"max_overflow": max_overflow,
|
|
69
|
+
"pool_pre_ping": config.httpdb.db.connections_pool_pre_ping,
|
|
70
|
+
"pool_recycle": config.httpdb.db.connections_pool_recycle,
|
|
69
71
|
}
|
|
70
72
|
engine = create_engine(dsn, **kwargs)
|
|
71
73
|
_engines[dsn] = engine
|
mlrun/common/helpers.py
CHANGED
|
@@ -12,12 +12,11 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
import typing
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
def parse_versioned_object_uri(
|
|
19
18
|
uri: str, default_project: str = ""
|
|
20
|
-
) ->
|
|
19
|
+
) -> tuple[str, str, str, str]:
|
|
21
20
|
project = default_project
|
|
22
21
|
tag = ""
|
|
23
22
|
hash_key = ""
|
mlrun/common/schemas/artifact.py
CHANGED
|
@@ -30,7 +30,7 @@ class ArtifactCategories(mlrun.common.types.StrEnum):
|
|
|
30
30
|
# and should not be used as such
|
|
31
31
|
link = "link"
|
|
32
32
|
|
|
33
|
-
def to_kinds_filter(self) ->
|
|
33
|
+
def to_kinds_filter(self) -> tuple[list[str], bool]:
|
|
34
34
|
link_kind = ArtifactCategories.link.value
|
|
35
35
|
|
|
36
36
|
if self.value == ArtifactCategories.model.value:
|
|
@@ -81,8 +81,8 @@ class ArtifactSpec(pydantic.BaseModel):
|
|
|
81
81
|
inline: typing.Optional[str]
|
|
82
82
|
size: typing.Optional[int]
|
|
83
83
|
db_key: typing.Optional[str]
|
|
84
|
-
extra_data: typing.Optional[
|
|
85
|
-
unpackaging_instructions: typing.Optional[
|
|
84
|
+
extra_data: typing.Optional[dict[str, typing.Any]]
|
|
85
|
+
unpackaging_instructions: typing.Optional[dict[str, typing.Any]]
|
|
86
86
|
|
|
87
87
|
class Config:
|
|
88
88
|
extra = pydantic.Extra.allow
|
mlrun/common/schemas/auth.py
CHANGED
|
@@ -115,17 +115,17 @@ class AuthInfo(pydantic.BaseModel):
|
|
|
115
115
|
data_session: typing.Optional[str] = None
|
|
116
116
|
access_key: typing.Optional[str] = None
|
|
117
117
|
user_id: typing.Optional[str] = None
|
|
118
|
-
user_group_ids:
|
|
118
|
+
user_group_ids: list[str] = []
|
|
119
119
|
user_unix_id: typing.Optional[int] = None
|
|
120
120
|
projects_role: typing.Optional[ProjectsRole] = None
|
|
121
|
-
planes:
|
|
121
|
+
planes: list[str] = []
|
|
122
122
|
|
|
123
123
|
def to_nuclio_auth_info(self):
|
|
124
124
|
if self.session != "":
|
|
125
125
|
return NuclioAuthInfo(password=self.session, mode=NuclioAuthKinds.iguazio)
|
|
126
126
|
return None
|
|
127
127
|
|
|
128
|
-
def get_member_ids(self) ->
|
|
128
|
+
def get_member_ids(self) -> list[str]:
|
|
129
129
|
member_ids = []
|
|
130
130
|
if self.user_id:
|
|
131
131
|
member_ids.append(self.user_id)
|
|
@@ -28,7 +28,7 @@ class ClientSpec(pydantic.BaseModel):
|
|
|
28
28
|
mpijob_crd_version: typing.Optional[str]
|
|
29
29
|
ui_url: typing.Optional[str]
|
|
30
30
|
artifact_path: typing.Optional[str]
|
|
31
|
-
feature_store_data_prefixes: typing.Optional[
|
|
31
|
+
feature_store_data_prefixes: typing.Optional[dict[str, str]]
|
|
32
32
|
spark_app_image: typing.Optional[str]
|
|
33
33
|
spark_app_image_tag: typing.Optional[str]
|
|
34
34
|
spark_history_server_path: typing.Optional[str]
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import Optional
|
|
16
16
|
|
|
17
17
|
from pydantic import BaseModel, Extra, Field
|
|
18
18
|
|
|
@@ -46,8 +46,8 @@ class Entity(BaseModel):
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class FeatureSetSpec(ObjectSpec):
|
|
49
|
-
entities:
|
|
50
|
-
features:
|
|
49
|
+
entities: list[Entity] = []
|
|
50
|
+
features: list[Feature] = []
|
|
51
51
|
engine: Optional[str] = Field(default="storey")
|
|
52
52
|
|
|
53
53
|
|
|
@@ -65,7 +65,7 @@ class FeatureSet(BaseModel):
|
|
|
65
65
|
class EntityRecord(BaseModel):
|
|
66
66
|
name: str
|
|
67
67
|
value_type: str
|
|
68
|
-
labels:
|
|
68
|
+
labels: list[LabelRecord]
|
|
69
69
|
|
|
70
70
|
class Config:
|
|
71
71
|
orm_mode = True
|
|
@@ -74,31 +74,31 @@ class EntityRecord(BaseModel):
|
|
|
74
74
|
class FeatureRecord(BaseModel):
|
|
75
75
|
name: str
|
|
76
76
|
value_type: str
|
|
77
|
-
labels:
|
|
77
|
+
labels: list[LabelRecord]
|
|
78
78
|
|
|
79
79
|
class Config:
|
|
80
80
|
orm_mode = True
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
class FeatureSetRecord(ObjectRecord):
|
|
84
|
-
entities:
|
|
85
|
-
features:
|
|
84
|
+
entities: list[EntityRecord]
|
|
85
|
+
features: list[FeatureRecord]
|
|
86
86
|
|
|
87
87
|
class Config:
|
|
88
88
|
orm_mode = True
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
class FeatureSetsOutput(BaseModel):
|
|
92
|
-
feature_sets:
|
|
92
|
+
feature_sets: list[FeatureSet]
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
class FeatureSetsTagsOutput(BaseModel):
|
|
96
|
-
tags:
|
|
96
|
+
tags: list[str] = []
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
class FeatureSetDigestSpec(BaseModel):
|
|
100
|
-
entities:
|
|
101
|
-
features:
|
|
100
|
+
entities: list[Entity]
|
|
101
|
+
features: list[Feature]
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
class FeatureSetDigestOutput(BaseModel):
|
|
@@ -112,7 +112,7 @@ class FeatureListOutput(BaseModel):
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
class FeaturesOutput(BaseModel):
|
|
115
|
-
features:
|
|
115
|
+
features: list[FeatureListOutput]
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
class EntityListOutput(BaseModel):
|
|
@@ -121,7 +121,7 @@ class EntityListOutput(BaseModel):
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
class EntitiesOutput(BaseModel):
|
|
124
|
-
entities:
|
|
124
|
+
entities: list[EntityListOutput]
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
class FeatureVector(BaseModel):
|
|
@@ -140,11 +140,11 @@ class FeatureVectorRecord(ObjectRecord):
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
class FeatureVectorsOutput(BaseModel):
|
|
143
|
-
feature_vectors:
|
|
143
|
+
feature_vectors: list[FeatureVector]
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
class FeatureVectorsTagsOutput(BaseModel):
|
|
147
|
-
tags:
|
|
147
|
+
tags: list[str] = []
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
class DataSource(BaseModel):
|
|
@@ -167,7 +167,7 @@ class DataTarget(BaseModel):
|
|
|
167
167
|
|
|
168
168
|
class FeatureSetIngestInput(BaseModel):
|
|
169
169
|
source: Optional[DataSource]
|
|
170
|
-
targets: Optional[
|
|
170
|
+
targets: Optional[list[DataTarget]]
|
|
171
171
|
infer_options: Optional[int]
|
|
172
172
|
credentials: Credentials = Credentials()
|
|
173
173
|
|
|
@@ -53,20 +53,20 @@ class FeatureFlags(pydantic.BaseModel):
|
|
|
53
53
|
class FrontendSpec(pydantic.BaseModel):
|
|
54
54
|
jobs_dashboard_url: typing.Optional[str]
|
|
55
55
|
model_monitoring_dashboard_url: typing.Optional[str]
|
|
56
|
-
abortable_function_kinds:
|
|
56
|
+
abortable_function_kinds: list[str] = []
|
|
57
57
|
feature_flags: FeatureFlags
|
|
58
58
|
default_function_priority_class_name: typing.Optional[str]
|
|
59
|
-
valid_function_priority_class_names:
|
|
60
|
-
default_function_image_by_kind:
|
|
59
|
+
valid_function_priority_class_names: list[str] = []
|
|
60
|
+
default_function_image_by_kind: dict[str, str] = {}
|
|
61
61
|
function_deployment_target_image_template: typing.Optional[str]
|
|
62
62
|
function_deployment_target_image_name_prefix_template: str
|
|
63
|
-
function_deployment_target_image_registries_to_enforce_prefix:
|
|
63
|
+
function_deployment_target_image_registries_to_enforce_prefix: list[str] = []
|
|
64
64
|
function_deployment_mlrun_requirement: typing.Optional[str]
|
|
65
65
|
auto_mount_type: typing.Optional[str]
|
|
66
|
-
auto_mount_params:
|
|
66
|
+
auto_mount_params: dict[str, str] = {}
|
|
67
67
|
default_artifact_path: str
|
|
68
68
|
default_function_pod_resources: Resources = Resources()
|
|
69
69
|
default_function_preemption_mode: str
|
|
70
|
-
feature_store_data_prefixes: typing.Optional[
|
|
71
|
-
allowed_artifact_path_prefixes_list:
|
|
70
|
+
feature_store_data_prefixes: typing.Optional[dict[str, str]]
|
|
71
|
+
allowed_artifact_path_prefixes_list: list[str]
|
|
72
72
|
ce: typing.Optional[dict]
|
mlrun/common/schemas/function.py
CHANGED
mlrun/common/schemas/hub.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from datetime import datetime, timezone
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Optional
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel, Extra, Field
|
|
19
19
|
|
|
@@ -56,12 +56,7 @@ class HubSource(BaseModel):
|
|
|
56
56
|
status: Optional[ObjectStatus] = ObjectStatus(state="created")
|
|
57
57
|
|
|
58
58
|
def get_full_uri(self, relative_path):
|
|
59
|
-
return "{
|
|
60
|
-
base=self.spec.path,
|
|
61
|
-
object_type=self.spec.object_type,
|
|
62
|
-
channel=self.spec.channel,
|
|
63
|
-
relative_path=relative_path,
|
|
64
|
-
)
|
|
59
|
+
return f"{self.spec.path}/{self.spec.object_type}/{self.spec.channel}/{relative_path}"
|
|
65
60
|
|
|
66
61
|
def get_catalog_uri(self):
|
|
67
62
|
return self.get_full_uri(mlrun.config.config.hub.catalog_filename)
|
|
@@ -120,7 +115,7 @@ class HubItemMetadata(HubObjectMetadata):
|
|
|
120
115
|
|
|
121
116
|
class HubItemSpec(ObjectSpec):
|
|
122
117
|
item_uri: str
|
|
123
|
-
assets:
|
|
118
|
+
assets: dict[str, str] = {}
|
|
124
119
|
|
|
125
120
|
|
|
126
121
|
class HubItem(BaseModel):
|
|
@@ -133,4 +128,4 @@ class HubItem(BaseModel):
|
|
|
133
128
|
class HubCatalog(BaseModel):
|
|
134
129
|
kind: ObjectKind = Field(ObjectKind.hub_catalog, const=True)
|
|
135
130
|
channel: str
|
|
136
|
-
catalog:
|
|
131
|
+
catalog: list[HubItem]
|
|
@@ -19,7 +19,7 @@ import pydantic
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class MostCommonObjectTypesReport(pydantic.BaseModel):
|
|
22
|
-
object_types:
|
|
22
|
+
object_types: list[tuple[str, int]]
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ObjectTypeReport(pydantic.BaseModel):
|
|
@@ -27,4 +27,4 @@ class ObjectTypeReport(pydantic.BaseModel):
|
|
|
27
27
|
sample_size: int
|
|
28
28
|
start_index: typing.Optional[int]
|
|
29
29
|
max_depth: int
|
|
30
|
-
object_report:
|
|
30
|
+
object_report: list[dict[str, typing.Any]]
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Optional, Union
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel
|
|
19
19
|
|
|
@@ -34,8 +34,8 @@ class GrafanaStringColumn(GrafanaColumn):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class GrafanaTable(BaseModel):
|
|
37
|
-
columns:
|
|
38
|
-
rows:
|
|
37
|
+
columns: list[GrafanaColumn]
|
|
38
|
+
rows: list[list[Optional[Union[float, int, str]]]] = []
|
|
39
39
|
type: str = "table"
|
|
40
40
|
|
|
41
41
|
def add_row(self, *args):
|
|
@@ -49,7 +49,7 @@ class GrafanaDataPoint(BaseModel):
|
|
|
49
49
|
|
|
50
50
|
class GrafanaTimeSeriesTarget(BaseModel):
|
|
51
51
|
target: str
|
|
52
|
-
datapoints:
|
|
52
|
+
datapoints: list[tuple[float, int]] = []
|
|
53
53
|
|
|
54
54
|
def add_data_point(self, data_point: GrafanaDataPoint):
|
|
55
55
|
self.datapoints.append((data_point.value, data_point.timestamp))
|