mlrun 1.7.0rc20__py3-none-any.whl → 1.7.0rc28__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 +10 -8
- mlrun/alerts/alert.py +55 -18
- mlrun/api/schemas/__init__.py +3 -3
- mlrun/artifacts/manager.py +26 -0
- mlrun/common/constants.py +3 -2
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/artifact.py +26 -3
- mlrun/common/formatters/base.py +44 -9
- mlrun/common/formatters/function.py +12 -7
- mlrun/common/formatters/run.py +26 -0
- mlrun/common/helpers.py +11 -0
- mlrun/common/schemas/__init__.py +4 -0
- mlrun/common/schemas/alert.py +5 -9
- mlrun/common/schemas/api_gateway.py +64 -16
- mlrun/common/schemas/artifact.py +11 -0
- mlrun/common/schemas/constants.py +3 -0
- mlrun/common/schemas/feature_store.py +58 -28
- mlrun/common/schemas/model_monitoring/constants.py +21 -12
- mlrun/common/schemas/model_monitoring/model_endpoints.py +0 -12
- mlrun/common/schemas/pipeline.py +16 -0
- mlrun/common/schemas/project.py +17 -0
- mlrun/common/schemas/runs.py +17 -0
- mlrun/common/schemas/schedule.py +1 -1
- mlrun/common/types.py +6 -0
- mlrun/config.py +17 -25
- mlrun/datastore/azure_blob.py +2 -1
- mlrun/datastore/datastore.py +3 -3
- mlrun/datastore/google_cloud_storage.py +6 -2
- mlrun/datastore/snowflake_utils.py +3 -1
- mlrun/datastore/sources.py +26 -11
- mlrun/datastore/store_resources.py +2 -0
- mlrun/datastore/targets.py +68 -16
- mlrun/db/base.py +83 -2
- mlrun/db/httpdb.py +280 -63
- mlrun/db/nopdb.py +60 -3
- mlrun/errors.py +5 -3
- mlrun/execution.py +28 -13
- mlrun/feature_store/feature_vector.py +8 -0
- mlrun/feature_store/retrieval/spark_merger.py +13 -2
- mlrun/launcher/local.py +4 -0
- mlrun/launcher/remote.py +1 -0
- mlrun/model.py +32 -3
- mlrun/model_monitoring/api.py +7 -52
- mlrun/model_monitoring/applications/base.py +5 -7
- mlrun/model_monitoring/applications/histogram_data_drift.py +1 -1
- mlrun/model_monitoring/db/stores/__init__.py +37 -24
- mlrun/model_monitoring/db/stores/base/store.py +40 -1
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +42 -87
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +27 -35
- mlrun/model_monitoring/db/tsdb/__init__.py +15 -15
- mlrun/model_monitoring/db/tsdb/base.py +1 -14
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +22 -18
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +86 -56
- mlrun/model_monitoring/helpers.py +34 -9
- mlrun/model_monitoring/stream_processing.py +12 -11
- mlrun/model_monitoring/writer.py +11 -11
- mlrun/projects/operations.py +5 -0
- mlrun/projects/pipelines.py +35 -21
- mlrun/projects/project.py +216 -107
- mlrun/render.py +10 -5
- mlrun/run.py +15 -5
- mlrun/runtimes/__init__.py +2 -0
- mlrun/runtimes/base.py +17 -4
- mlrun/runtimes/daskjob.py +8 -1
- mlrun/runtimes/databricks_job/databricks_runtime.py +1 -0
- mlrun/runtimes/local.py +23 -4
- mlrun/runtimes/nuclio/application/application.py +0 -2
- mlrun/runtimes/nuclio/function.py +31 -2
- mlrun/runtimes/nuclio/serving.py +9 -6
- mlrun/runtimes/pod.py +5 -29
- mlrun/runtimes/remotesparkjob.py +8 -2
- mlrun/serving/__init__.py +8 -1
- mlrun/serving/routers.py +75 -59
- mlrun/serving/server.py +11 -0
- mlrun/serving/states.py +80 -8
- mlrun/serving/utils.py +19 -11
- mlrun/serving/v2_serving.py +66 -39
- mlrun/utils/helpers.py +91 -11
- mlrun/utils/logger.py +36 -2
- mlrun/utils/notifications/notification/base.py +43 -7
- mlrun/utils/notifications/notification/git.py +21 -0
- mlrun/utils/notifications/notification/slack.py +9 -14
- mlrun/utils/notifications/notification/webhook.py +41 -1
- mlrun/utils/notifications/notification_pusher.py +3 -9
- mlrun/utils/regex.py +9 -0
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/METADATA +16 -9
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/RECORD +92 -91
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/WHEEL +1 -1
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc20.dist-info → mlrun-1.7.0rc28.dist-info}/top_level.txt +0 -0
mlrun/datastore/targets.py
CHANGED
|
@@ -29,7 +29,10 @@ from mergedeep import merge
|
|
|
29
29
|
import mlrun
|
|
30
30
|
import mlrun.utils.helpers
|
|
31
31
|
from mlrun.config import config
|
|
32
|
-
from mlrun.datastore.snowflake_utils import
|
|
32
|
+
from mlrun.datastore.snowflake_utils import (
|
|
33
|
+
get_snowflake_password,
|
|
34
|
+
get_snowflake_spark_options,
|
|
35
|
+
)
|
|
33
36
|
from mlrun.datastore.utils import transform_list_filters_to_tuple
|
|
34
37
|
from mlrun.model import DataSource, DataTarget, DataTargetBase, TargetPathObject
|
|
35
38
|
from mlrun.utils import logger, now_date
|
|
@@ -696,6 +699,7 @@ class BaseStoreTarget(DataTargetBase):
|
|
|
696
699
|
self.kind, self.name, self.get_target_templated_path()
|
|
697
700
|
)
|
|
698
701
|
target = self._target
|
|
702
|
+
target.attributes = self.attributes
|
|
699
703
|
target.run_id = self.run_id
|
|
700
704
|
target.status = status or target.status or "created"
|
|
701
705
|
target.updated = now_date().isoformat()
|
|
@@ -727,8 +731,18 @@ class BaseStoreTarget(DataTargetBase):
|
|
|
727
731
|
raise NotImplementedError()
|
|
728
732
|
|
|
729
733
|
def purge(self):
|
|
734
|
+
"""
|
|
735
|
+
Delete the files of the target.
|
|
736
|
+
|
|
737
|
+
Do not use this function directly from the sdk. Use FeatureSet.purge_targets.
|
|
738
|
+
"""
|
|
730
739
|
store, path_in_store, target_path = self._get_store_and_path()
|
|
731
|
-
|
|
740
|
+
if path_in_store not in ["", "/"]:
|
|
741
|
+
store.rm(path_in_store, recursive=True)
|
|
742
|
+
else:
|
|
743
|
+
raise mlrun.errors.MLRunInvalidArgumentError(
|
|
744
|
+
"Unable to delete target. Please Use purge_targets from FeatureSet object."
|
|
745
|
+
)
|
|
732
746
|
|
|
733
747
|
def as_df(
|
|
734
748
|
self,
|
|
@@ -764,6 +778,10 @@ class BaseStoreTarget(DataTargetBase):
|
|
|
764
778
|
def get_dask_options(self):
|
|
765
779
|
raise NotImplementedError()
|
|
766
780
|
|
|
781
|
+
@property
|
|
782
|
+
def source_spark_attributes(self) -> dict:
|
|
783
|
+
return {}
|
|
784
|
+
|
|
767
785
|
|
|
768
786
|
class ParquetTarget(BaseStoreTarget):
|
|
769
787
|
"""Parquet target storage driver, used to materialize feature set/vector data into parquet files.
|
|
@@ -1197,19 +1215,20 @@ class SnowflakeTarget(BaseStoreTarget):
|
|
|
1197
1215
|
warehouse: str = None,
|
|
1198
1216
|
table_name: str = None,
|
|
1199
1217
|
):
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
"
|
|
1203
|
-
|
|
1204
|
-
"
|
|
1205
|
-
|
|
1206
|
-
"
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1218
|
+
attributes = attributes or {}
|
|
1219
|
+
if url:
|
|
1220
|
+
attributes["url"] = url
|
|
1221
|
+
if user:
|
|
1222
|
+
attributes["user"] = user
|
|
1223
|
+
if database:
|
|
1224
|
+
attributes["database"] = database
|
|
1225
|
+
if db_schema:
|
|
1226
|
+
attributes["db_schema"] = db_schema
|
|
1227
|
+
if warehouse:
|
|
1228
|
+
attributes["warehouse"] = warehouse
|
|
1229
|
+
if table_name:
|
|
1230
|
+
attributes["table"] = table_name
|
|
1231
|
+
|
|
1213
1232
|
super().__init__(
|
|
1214
1233
|
name,
|
|
1215
1234
|
path,
|
|
@@ -1233,7 +1252,31 @@ class SnowflakeTarget(BaseStoreTarget):
|
|
|
1233
1252
|
return spark_options
|
|
1234
1253
|
|
|
1235
1254
|
def purge(self):
|
|
1236
|
-
|
|
1255
|
+
import snowflake.connector
|
|
1256
|
+
|
|
1257
|
+
missing = [
|
|
1258
|
+
key
|
|
1259
|
+
for key in ["database", "db_schema", "table", "url", "user", "warehouse"]
|
|
1260
|
+
if self.attributes.get(key) is None
|
|
1261
|
+
]
|
|
1262
|
+
if missing:
|
|
1263
|
+
raise mlrun.errors.MLRunRuntimeError(
|
|
1264
|
+
f"Can't purge Snowflake target, "
|
|
1265
|
+
f"some attributes are missing: {', '.join(missing)}"
|
|
1266
|
+
)
|
|
1267
|
+
account = self.attributes["url"].replace(".snowflakecomputing.com", "")
|
|
1268
|
+
|
|
1269
|
+
with snowflake.connector.connect(
|
|
1270
|
+
account=account,
|
|
1271
|
+
user=self.attributes["user"],
|
|
1272
|
+
password=get_snowflake_password(),
|
|
1273
|
+
warehouse=self.attributes["warehouse"],
|
|
1274
|
+
) as snowflake_connector:
|
|
1275
|
+
drop_statement = (
|
|
1276
|
+
f"DROP TABLE IF EXISTS {self.attributes['database']}.{self.attributes['db_schema']}"
|
|
1277
|
+
f".{self.attributes['table']}"
|
|
1278
|
+
)
|
|
1279
|
+
snowflake_connector.execute_string(drop_statement)
|
|
1237
1280
|
|
|
1238
1281
|
def as_df(
|
|
1239
1282
|
self,
|
|
@@ -1248,6 +1291,15 @@ class SnowflakeTarget(BaseStoreTarget):
|
|
|
1248
1291
|
):
|
|
1249
1292
|
raise NotImplementedError()
|
|
1250
1293
|
|
|
1294
|
+
@property
|
|
1295
|
+
def source_spark_attributes(self) -> dict:
|
|
1296
|
+
keys = ["url", "user", "database", "db_schema", "warehouse"]
|
|
1297
|
+
attributes = self.attributes or {}
|
|
1298
|
+
snowflake_dict = {key: attributes.get(key) for key in keys}
|
|
1299
|
+
table = attributes.get("table")
|
|
1300
|
+
snowflake_dict["query"] = f"SELECT * from {table}" if table else None
|
|
1301
|
+
return snowflake_dict
|
|
1302
|
+
|
|
1251
1303
|
|
|
1252
1304
|
class NoSqlBaseTarget(BaseStoreTarget):
|
|
1253
1305
|
is_table = True
|
mlrun/db/base.py
CHANGED
|
@@ -16,7 +16,10 @@ import datetime
|
|
|
16
16
|
from abc import ABC, abstractmethod
|
|
17
17
|
from typing import Optional, Union
|
|
18
18
|
|
|
19
|
+
from deprecated import deprecated
|
|
20
|
+
|
|
19
21
|
import mlrun.alerts
|
|
22
|
+
import mlrun.common
|
|
20
23
|
import mlrun.common.formatters
|
|
21
24
|
import mlrun.common.runtimes.constants
|
|
22
25
|
import mlrun.common.schemas
|
|
@@ -55,7 +58,13 @@ class RunDBInterface(ABC):
|
|
|
55
58
|
pass
|
|
56
59
|
|
|
57
60
|
@abstractmethod
|
|
58
|
-
def read_run(
|
|
61
|
+
def read_run(
|
|
62
|
+
self,
|
|
63
|
+
uid: str,
|
|
64
|
+
project: str = "",
|
|
65
|
+
iter: int = 0,
|
|
66
|
+
format_: mlrun.common.formatters.RunFormat = mlrun.common.formatters.RunFormat.full,
|
|
67
|
+
):
|
|
59
68
|
pass
|
|
60
69
|
|
|
61
70
|
@abstractmethod
|
|
@@ -102,7 +111,16 @@ class RunDBInterface(ABC):
|
|
|
102
111
|
pass
|
|
103
112
|
|
|
104
113
|
@abstractmethod
|
|
105
|
-
def read_artifact(
|
|
114
|
+
def read_artifact(
|
|
115
|
+
self,
|
|
116
|
+
key,
|
|
117
|
+
tag="",
|
|
118
|
+
iter=None,
|
|
119
|
+
project="",
|
|
120
|
+
tree=None,
|
|
121
|
+
uid=None,
|
|
122
|
+
format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
|
|
123
|
+
):
|
|
106
124
|
pass
|
|
107
125
|
|
|
108
126
|
@abstractmethod
|
|
@@ -119,6 +137,8 @@ class RunDBInterface(ABC):
|
|
|
119
137
|
kind: str = None,
|
|
120
138
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
121
139
|
tree: str = None,
|
|
140
|
+
format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
|
|
141
|
+
limit: int = None,
|
|
122
142
|
):
|
|
123
143
|
pass
|
|
124
144
|
|
|
@@ -301,6 +321,12 @@ class RunDBInterface(ABC):
|
|
|
301
321
|
) -> dict:
|
|
302
322
|
pass
|
|
303
323
|
|
|
324
|
+
# TODO: remove in 1.9.0
|
|
325
|
+
@deprecated(
|
|
326
|
+
version="1.9.0",
|
|
327
|
+
reason="'list_features' will be removed in 1.9.0, use 'list_features_v2' instead",
|
|
328
|
+
category=FutureWarning,
|
|
329
|
+
)
|
|
304
330
|
@abstractmethod
|
|
305
331
|
def list_features(
|
|
306
332
|
self,
|
|
@@ -312,6 +338,23 @@ class RunDBInterface(ABC):
|
|
|
312
338
|
) -> mlrun.common.schemas.FeaturesOutput:
|
|
313
339
|
pass
|
|
314
340
|
|
|
341
|
+
@abstractmethod
|
|
342
|
+
def list_features_v2(
|
|
343
|
+
self,
|
|
344
|
+
project: str,
|
|
345
|
+
name: str = None,
|
|
346
|
+
tag: str = None,
|
|
347
|
+
entities: list[str] = None,
|
|
348
|
+
labels: list[str] = None,
|
|
349
|
+
) -> mlrun.common.schemas.FeaturesOutputV2:
|
|
350
|
+
pass
|
|
351
|
+
|
|
352
|
+
# TODO: remove in 1.9.0
|
|
353
|
+
@deprecated(
|
|
354
|
+
version="1.9.0",
|
|
355
|
+
reason="'list_entities' will be removed in 1.9.0, use 'list_entities_v2' instead",
|
|
356
|
+
category=FutureWarning,
|
|
357
|
+
)
|
|
315
358
|
@abstractmethod
|
|
316
359
|
def list_entities(
|
|
317
360
|
self,
|
|
@@ -322,6 +365,16 @@ class RunDBInterface(ABC):
|
|
|
322
365
|
) -> mlrun.common.schemas.EntitiesOutput:
|
|
323
366
|
pass
|
|
324
367
|
|
|
368
|
+
@abstractmethod
|
|
369
|
+
def list_entities_v2(
|
|
370
|
+
self,
|
|
371
|
+
project: str,
|
|
372
|
+
name: str = None,
|
|
373
|
+
tag: str = None,
|
|
374
|
+
labels: list[str] = None,
|
|
375
|
+
) -> mlrun.common.schemas.EntitiesOutputV2:
|
|
376
|
+
pass
|
|
377
|
+
|
|
325
378
|
@abstractmethod
|
|
326
379
|
def list_feature_sets(
|
|
327
380
|
self,
|
|
@@ -837,11 +890,39 @@ class RunDBInterface(ABC):
|
|
|
837
890
|
base_period: int = 10,
|
|
838
891
|
image: str = "mlrun/mlrun",
|
|
839
892
|
deploy_histogram_data_drift_app: bool = True,
|
|
893
|
+
rebuild_images: bool = False,
|
|
894
|
+
fetch_credentials_from_sys_config: bool = False,
|
|
840
895
|
) -> None:
|
|
841
896
|
pass
|
|
842
897
|
|
|
898
|
+
@abstractmethod
|
|
899
|
+
def disable_model_monitoring(
|
|
900
|
+
self,
|
|
901
|
+
project: str,
|
|
902
|
+
delete_resources: bool = True,
|
|
903
|
+
delete_stream_function: bool = False,
|
|
904
|
+
delete_histogram_data_drift_app: bool = True,
|
|
905
|
+
delete_user_applications: bool = False,
|
|
906
|
+
user_application_list: list[str] = None,
|
|
907
|
+
) -> bool:
|
|
908
|
+
pass
|
|
909
|
+
|
|
910
|
+
@abstractmethod
|
|
911
|
+
def delete_model_monitoring_function(
|
|
912
|
+
self, project: str, functions: list[str]
|
|
913
|
+
) -> bool:
|
|
914
|
+
pass
|
|
915
|
+
|
|
843
916
|
@abstractmethod
|
|
844
917
|
def deploy_histogram_data_drift_app(
|
|
845
918
|
self, project: str, image: str = "mlrun/mlrun"
|
|
846
919
|
) -> None:
|
|
847
920
|
pass
|
|
921
|
+
|
|
922
|
+
@abstractmethod
|
|
923
|
+
def set_model_monitoring_credentials(
|
|
924
|
+
self,
|
|
925
|
+
project: str,
|
|
926
|
+
credentials: dict[str, str],
|
|
927
|
+
) -> None:
|
|
928
|
+
pass
|