mlrun 1.7.0rc14__py3-none-any.whl → 1.7.0rc22__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 +10 -1
- mlrun/__main__.py +23 -111
- mlrun/alerts/__init__.py +15 -0
- mlrun/alerts/alert.py +169 -0
- mlrun/api/schemas/__init__.py +4 -3
- mlrun/artifacts/__init__.py +8 -3
- mlrun/artifacts/base.py +36 -253
- mlrun/artifacts/dataset.py +9 -190
- mlrun/artifacts/manager.py +46 -42
- mlrun/artifacts/model.py +9 -141
- mlrun/artifacts/plots.py +14 -375
- mlrun/common/constants.py +65 -3
- mlrun/common/formatters/__init__.py +19 -0
- mlrun/{runtimes/mpijob/v1alpha1.py → common/formatters/artifact.py} +6 -14
- mlrun/common/formatters/base.py +113 -0
- mlrun/common/formatters/function.py +46 -0
- mlrun/common/formatters/pipeline.py +53 -0
- mlrun/common/formatters/project.py +51 -0
- mlrun/{runtimes → common/runtimes}/constants.py +32 -4
- mlrun/common/schemas/__init__.py +10 -5
- mlrun/common/schemas/alert.py +92 -11
- mlrun/common/schemas/api_gateway.py +56 -0
- mlrun/common/schemas/artifact.py +15 -5
- mlrun/common/schemas/auth.py +2 -0
- mlrun/common/schemas/client_spec.py +1 -0
- mlrun/common/schemas/frontend_spec.py +1 -0
- mlrun/common/schemas/function.py +4 -0
- mlrun/common/schemas/model_monitoring/__init__.py +15 -3
- mlrun/common/schemas/model_monitoring/constants.py +58 -7
- mlrun/common/schemas/model_monitoring/grafana.py +9 -5
- mlrun/common/schemas/model_monitoring/model_endpoints.py +86 -2
- mlrun/common/schemas/pipeline.py +0 -9
- mlrun/common/schemas/project.py +5 -11
- mlrun/common/types.py +1 -0
- mlrun/config.py +30 -9
- mlrun/data_types/to_pandas.py +9 -9
- mlrun/datastore/base.py +41 -9
- mlrun/datastore/datastore.py +6 -2
- mlrun/datastore/datastore_profile.py +56 -4
- mlrun/datastore/inmem.py +2 -2
- mlrun/datastore/redis.py +2 -2
- mlrun/datastore/s3.py +5 -0
- mlrun/datastore/sources.py +147 -7
- mlrun/datastore/store_resources.py +7 -7
- mlrun/datastore/targets.py +110 -42
- mlrun/datastore/utils.py +42 -0
- mlrun/db/base.py +54 -10
- mlrun/db/httpdb.py +282 -79
- mlrun/db/nopdb.py +52 -10
- mlrun/errors.py +11 -0
- mlrun/execution.py +26 -9
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +12 -47
- mlrun/feature_store/feature_set.py +9 -0
- mlrun/feature_store/feature_vector.py +8 -0
- mlrun/feature_store/ingestion.py +7 -6
- mlrun/feature_store/retrieval/base.py +9 -4
- mlrun/feature_store/retrieval/conversion.py +9 -9
- mlrun/feature_store/retrieval/dask_merger.py +2 -0
- mlrun/feature_store/retrieval/job.py +9 -3
- mlrun/feature_store/retrieval/local_merger.py +2 -0
- mlrun/feature_store/retrieval/spark_merger.py +16 -0
- mlrun/frameworks/__init__.py +6 -0
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +7 -12
- mlrun/frameworks/parallel_coordinates.py +2 -1
- mlrun/frameworks/tf_keras/__init__.py +4 -1
- mlrun/k8s_utils.py +10 -11
- mlrun/launcher/base.py +4 -3
- mlrun/launcher/client.py +5 -3
- mlrun/launcher/local.py +12 -2
- mlrun/launcher/remote.py +9 -2
- mlrun/lists.py +6 -2
- mlrun/model.py +47 -21
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +42 -18
- mlrun/model_monitoring/application.py +5 -305
- mlrun/model_monitoring/applications/__init__.py +11 -0
- mlrun/model_monitoring/applications/_application_steps.py +157 -0
- mlrun/model_monitoring/applications/base.py +280 -0
- mlrun/model_monitoring/applications/context.py +214 -0
- mlrun/model_monitoring/applications/evidently_base.py +211 -0
- mlrun/model_monitoring/applications/histogram_data_drift.py +132 -91
- mlrun/model_monitoring/applications/results.py +99 -0
- mlrun/model_monitoring/controller.py +3 -1
- mlrun/model_monitoring/db/__init__.py +2 -0
- mlrun/model_monitoring/db/stores/__init__.py +0 -2
- mlrun/model_monitoring/db/stores/base/store.py +22 -37
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +43 -21
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +39 -8
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +27 -7
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +5 -0
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +246 -224
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +232 -216
- mlrun/model_monitoring/db/tsdb/__init__.py +100 -0
- mlrun/model_monitoring/db/tsdb/base.py +316 -0
- mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
- mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +240 -0
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +45 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +401 -0
- mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +117 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +658 -0
- mlrun/model_monitoring/evidently_application.py +6 -118
- mlrun/model_monitoring/helpers.py +63 -1
- mlrun/model_monitoring/model_endpoint.py +3 -2
- mlrun/model_monitoring/stream_processing.py +57 -216
- mlrun/model_monitoring/writer.py +134 -124
- mlrun/package/__init__.py +13 -1
- mlrun/package/packagers/__init__.py +6 -1
- mlrun/package/utils/_formatter.py +2 -2
- mlrun/platforms/__init__.py +10 -9
- mlrun/platforms/iguazio.py +21 -202
- mlrun/projects/operations.py +24 -12
- mlrun/projects/pipelines.py +79 -102
- mlrun/projects/project.py +271 -103
- mlrun/render.py +15 -14
- mlrun/run.py +16 -46
- mlrun/runtimes/__init__.py +6 -3
- mlrun/runtimes/base.py +14 -7
- mlrun/runtimes/daskjob.py +1 -0
- mlrun/runtimes/databricks_job/databricks_runtime.py +1 -0
- mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
- mlrun/runtimes/funcdoc.py +0 -28
- mlrun/runtimes/kubejob.py +2 -1
- mlrun/runtimes/local.py +12 -3
- mlrun/runtimes/mpijob/__init__.py +0 -20
- mlrun/runtimes/mpijob/v1.py +1 -1
- mlrun/runtimes/nuclio/api_gateway.py +194 -84
- mlrun/runtimes/nuclio/application/application.py +170 -8
- mlrun/runtimes/nuclio/function.py +39 -49
- mlrun/runtimes/pod.py +16 -36
- mlrun/runtimes/remotesparkjob.py +9 -3
- mlrun/runtimes/sparkjob/spark3job.py +1 -1
- mlrun/runtimes/utils.py +6 -45
- mlrun/serving/__init__.py +8 -1
- mlrun/serving/server.py +2 -1
- mlrun/serving/states.py +51 -8
- mlrun/serving/utils.py +19 -11
- mlrun/serving/v2_serving.py +5 -1
- mlrun/track/tracker.py +2 -1
- mlrun/utils/async_http.py +25 -5
- mlrun/utils/helpers.py +157 -83
- mlrun/utils/logger.py +39 -7
- mlrun/utils/notifications/notification/__init__.py +14 -9
- mlrun/utils/notifications/notification/base.py +1 -1
- mlrun/utils/notifications/notification/slack.py +34 -7
- mlrun/utils/notifications/notification/webhook.py +1 -1
- mlrun/utils/notifications/notification_pusher.py +147 -16
- mlrun/utils/regex.py +9 -0
- mlrun/utils/v3io_clients.py +0 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/METADATA +14 -6
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/RECORD +158 -138
- mlrun/kfpops.py +0 -865
- mlrun/platforms/other.py +0 -305
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright 2024 Iguazio
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .v3io_connector import V3IOTSDBConnector
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Copyright 2024 Iguazio
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
import mlrun.feature_store.steps
|
|
17
|
+
from mlrun.common.schemas.model_monitoring import (
|
|
18
|
+
EventFieldType,
|
|
19
|
+
EventKeyMetrics,
|
|
20
|
+
EventLiveStats,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ProcessBeforeTSDB(mlrun.feature_store.steps.MapClass):
|
|
25
|
+
def __init__(self, **kwargs):
|
|
26
|
+
"""
|
|
27
|
+
Process the data before writing to TSDB. This step creates a dictionary that includes 3 different dictionaries
|
|
28
|
+
that each one of them contains important details and stats about the events:
|
|
29
|
+
1. base_metrics: stats about the average latency and the amount of predictions over time. It is based on
|
|
30
|
+
storey.AggregateByKey which was executed in step 5.
|
|
31
|
+
2. endpoint_features: feature names and values along with the prediction names and value.
|
|
32
|
+
3. custom_metric (opt): optional metrics provided by the user.
|
|
33
|
+
:returns: Dictionary of 2-3 dictionaries that contains stats and details about the events.
|
|
34
|
+
"""
|
|
35
|
+
super().__init__(**kwargs)
|
|
36
|
+
|
|
37
|
+
def do(self, event):
|
|
38
|
+
# Compute prediction per second
|
|
39
|
+
event[EventLiveStats.PREDICTIONS_PER_SECOND] = (
|
|
40
|
+
float(event[EventLiveStats.PREDICTIONS_COUNT_5M]) / 300
|
|
41
|
+
)
|
|
42
|
+
base_fields = [
|
|
43
|
+
EventFieldType.TIMESTAMP,
|
|
44
|
+
EventFieldType.ENDPOINT_ID,
|
|
45
|
+
EventFieldType.ENDPOINT_TYPE,
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
# Getting event timestamp and endpoint_id
|
|
49
|
+
base_event = {k: event[k] for k in base_fields}
|
|
50
|
+
|
|
51
|
+
# base_metrics includes the stats about the average latency and the amount of predictions over time
|
|
52
|
+
base_metrics = {
|
|
53
|
+
EventFieldType.RECORD_TYPE: EventKeyMetrics.BASE_METRICS,
|
|
54
|
+
EventLiveStats.PREDICTIONS_PER_SECOND: event[
|
|
55
|
+
EventLiveStats.PREDICTIONS_PER_SECOND
|
|
56
|
+
],
|
|
57
|
+
EventLiveStats.PREDICTIONS_COUNT_5M: event[
|
|
58
|
+
EventLiveStats.PREDICTIONS_COUNT_5M
|
|
59
|
+
],
|
|
60
|
+
EventLiveStats.PREDICTIONS_COUNT_1H: event[
|
|
61
|
+
EventLiveStats.PREDICTIONS_COUNT_1H
|
|
62
|
+
],
|
|
63
|
+
EventLiveStats.LATENCY_AVG_5M: event[EventLiveStats.LATENCY_AVG_5M],
|
|
64
|
+
EventLiveStats.LATENCY_AVG_1H: event[EventLiveStats.LATENCY_AVG_1H],
|
|
65
|
+
**base_event,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# endpoint_features includes the event values of each feature and prediction
|
|
69
|
+
endpoint_features = {
|
|
70
|
+
EventFieldType.RECORD_TYPE: EventKeyMetrics.ENDPOINT_FEATURES,
|
|
71
|
+
**event[EventFieldType.NAMED_PREDICTIONS],
|
|
72
|
+
**event[EventFieldType.NAMED_FEATURES],
|
|
73
|
+
**base_event,
|
|
74
|
+
}
|
|
75
|
+
# Create a dictionary that includes both base_metrics and endpoint_features
|
|
76
|
+
processed = {
|
|
77
|
+
EventKeyMetrics.BASE_METRICS: base_metrics,
|
|
78
|
+
EventKeyMetrics.ENDPOINT_FEATURES: endpoint_features,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# If metrics provided, add another dictionary if custom_metrics values
|
|
82
|
+
if event[EventFieldType.METRICS]:
|
|
83
|
+
processed[EventKeyMetrics.CUSTOM_METRICS] = {
|
|
84
|
+
EventFieldType.RECORD_TYPE: EventKeyMetrics.CUSTOM_METRICS,
|
|
85
|
+
**event[EventFieldType.METRICS],
|
|
86
|
+
**base_event,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return processed
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class FilterAndUnpackKeys(mlrun.feature_store.steps.MapClass):
|
|
93
|
+
def __init__(self, keys, **kwargs):
|
|
94
|
+
"""
|
|
95
|
+
Create unpacked event dictionary based on provided key metrics (base_metrics, endpoint_features,
|
|
96
|
+
or custom_metric). Please note that the next step of the TSDB target requires an unpacked dictionary.
|
|
97
|
+
:param keys: list of key metrics.
|
|
98
|
+
:returns: An unpacked dictionary of event filtered by the provided key metrics.
|
|
99
|
+
"""
|
|
100
|
+
super().__init__(**kwargs)
|
|
101
|
+
self.keys = keys
|
|
102
|
+
|
|
103
|
+
def do(self, event):
|
|
104
|
+
# Keep only the relevant dictionary based on the provided keys
|
|
105
|
+
new_event = {}
|
|
106
|
+
for key in self.keys:
|
|
107
|
+
if key in event:
|
|
108
|
+
new_event[key] = event[key]
|
|
109
|
+
|
|
110
|
+
# Create unpacked dictionary
|
|
111
|
+
unpacked = {}
|
|
112
|
+
for key in new_event.keys():
|
|
113
|
+
if key in self.keys:
|
|
114
|
+
unpacked = {**unpacked, **new_event[key]}
|
|
115
|
+
else:
|
|
116
|
+
unpacked[key] = new_event[key]
|
|
117
|
+
return unpacked if unpacked else None
|