mlrun 1.7.0rc12__py3-none-any.whl → 1.7.0rc13__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.

@@ -49,7 +49,7 @@ class Event(pydantic.BaseModel):
49
49
  kind: EventKind
50
50
  timestamp: Union[str, datetime] = None # occurrence time
51
51
  entity: EventEntity
52
- value: Optional[Union[float, str]] = None
52
+ value_dict: Optional[dict] = pydantic.Field(default_factory=dict)
53
53
 
54
54
  def is_valid(self):
55
55
  return self.entity.kind in _event_kind_entity_map[self.kind]
mlrun/config.py CHANGED
@@ -552,6 +552,7 @@ default_config = {
552
552
  "nosql": "v3io:///projects/{project}/FeatureStore/{name}/nosql",
553
553
  # "authority" is optional and generalizes [userinfo "@"] host [":" port]
554
554
  "redisnosql": "redis://{authority}/projects/{project}/FeatureStore/{name}/nosql",
555
+ "dsnosql": "ds://{ds_profile_name}/projects/{project}/FeatureStore/{name}/nosql",
555
556
  },
556
557
  "default_targets": "parquet,nosql",
557
558
  "default_job_image": "mlrun/mlrun",
@@ -83,14 +83,28 @@ class DatastoreProfileBasic(DatastoreProfile):
83
83
  class DatastoreProfileKafkaTarget(DatastoreProfile):
84
84
  type: str = pydantic.Field("kafka_target")
85
85
  _private_attributes = "kwargs_private"
86
- bootstrap_servers: str
87
- brokers: str
86
+ bootstrap_servers: typing.Optional[str] = None
87
+ brokers: typing.Optional[str] = None
88
88
  topic: str
89
89
  kwargs_public: typing.Optional[dict]
90
90
  kwargs_private: typing.Optional[dict]
91
91
 
92
- def __pydantic_post_init__(self):
92
+ def __init__(self, **kwargs):
93
+ super().__init__(**kwargs)
94
+
95
+ if not self.brokers and not self.bootstrap_servers:
96
+ raise mlrun.errors.MLRunInvalidArgumentError(
97
+ "DatastoreProfileKafkaTarget requires the 'brokers' field to be set"
98
+ )
99
+
93
100
  if self.bootstrap_servers:
101
+ if self.brokers:
102
+ raise mlrun.errors.MLRunInvalidArgumentError(
103
+ "DatastoreProfileKafkaTarget cannot be created with both 'brokers' and 'bootstrap_servers'"
104
+ )
105
+ else:
106
+ self.brokers = self.bootstrap_servers
107
+ self.bootstrap_servers = None
94
108
  warnings.warn(
95
109
  "'bootstrap_servers' parameter is deprecated in 1.7.0 and will be removed in 1.9.0, "
96
110
  "use 'brokers' instead.",
@@ -253,3 +253,10 @@ def calculate_inputs_statistics(
253
253
  )
254
254
 
255
255
  return inputs_statistics
256
+
257
+
258
+ def get_endpoint_record(project: str, endpoint_id: str):
259
+ model_endpoint_store = mlrun.model_monitoring.get_store_object(
260
+ project=project,
261
+ )
262
+ return model_endpoint_store.get_model_endpoint(endpoint_id=endpoint_id)
@@ -40,6 +40,7 @@ from mlrun.common.schemas.model_monitoring.constants import (
40
40
  ProjectSecretKeys,
41
41
  PrometheusEndpoints,
42
42
  )
43
+ from mlrun.model_monitoring.helpers import get_endpoint_record
43
44
  from mlrun.utils import logger
44
45
 
45
46
 
@@ -1233,13 +1234,6 @@ def update_endpoint_record(
1233
1234
  )
1234
1235
 
1235
1236
 
1236
- def get_endpoint_record(project: str, endpoint_id: str):
1237
- model_endpoint_store = mlrun.model_monitoring.get_store_object(
1238
- project=project,
1239
- )
1240
- return model_endpoint_store.get_model_endpoint(endpoint_id=endpoint_id)
1241
-
1242
-
1243
1237
  def update_monitoring_feature_set(
1244
1238
  endpoint_record: dict[str, typing.Any],
1245
1239
  feature_names: list[str],
@@ -27,8 +27,13 @@ import mlrun.common.schemas.alert as alert_constants
27
27
  import mlrun.model_monitoring
28
28
  import mlrun.model_monitoring.db.stores
29
29
  import mlrun.utils.v3io_clients
30
- from mlrun.common.schemas.model_monitoring.constants import ResultStatusApp, WriterEvent
30
+ from mlrun.common.schemas.model_monitoring.constants import (
31
+ EventFieldType,
32
+ ResultStatusApp,
33
+ WriterEvent,
34
+ )
31
35
  from mlrun.common.schemas.notification import NotificationKind, NotificationSeverity
36
+ from mlrun.model_monitoring.helpers import get_endpoint_record
32
37
  from mlrun.serving.utils import StepToDict
33
38
  from mlrun.utils import logger
34
39
  from mlrun.utils.notifications.notification_pusher import CustomNotificationPusher
@@ -112,6 +117,7 @@ class ModelMonitoringWriter(StepToDict):
112
117
  notification_types=[NotificationKind.slack]
113
118
  )
114
119
  self._create_tsdb_table()
120
+ self._endpoints_records = {}
115
121
 
116
122
  @staticmethod
117
123
  def get_v3io_container(project_name: str) -> str:
@@ -174,7 +180,7 @@ class ModelMonitoringWriter(StepToDict):
174
180
 
175
181
  @staticmethod
176
182
  def _generate_event_on_drift(
177
- uid: str, drift_status: str, drift_value: float, project_name: str
183
+ uid: str, drift_status: str, event_value: dict, project_name: str
178
184
  ):
179
185
  if (
180
186
  drift_status == ResultStatusApp.detected
@@ -191,7 +197,7 @@ class ModelMonitoringWriter(StepToDict):
191
197
  else alert_constants.EventKind.DRIFT_SUSPECTED
192
198
  )
193
199
  event_data = mlrun.common.schemas.Event(
194
- kind=event_kind, entity=entity, value=drift_value
200
+ kind=event_kind, entity=entity, value_dict=event_value
195
201
  )
196
202
  mlrun.get_run_db().generate_event(event_kind, event_data)
197
203
 
@@ -227,10 +233,22 @@ class ModelMonitoringWriter(StepToDict):
227
233
  _Notifier(event=event, notification_pusher=self._custom_notifier).notify()
228
234
 
229
235
  if mlrun.mlconf.alerts.mode == mlrun.common.schemas.alert.AlertsModes.enabled:
236
+ endpoint_id = event[WriterEvent.ENDPOINT_ID]
237
+ endpoint_record = self._endpoints_records.setdefault(
238
+ endpoint_id,
239
+ get_endpoint_record(project=self.project, endpoint_id=endpoint_id),
240
+ )
241
+ event_value = {
242
+ "app_name": event[WriterEvent.APPLICATION_NAME],
243
+ "model": endpoint_record.get(EventFieldType.MODEL),
244
+ "model_endpoint_id": event[WriterEvent.ENDPOINT_ID],
245
+ "result_name": event[WriterEvent.RESULT_NAME],
246
+ "result_value": event[WriterEvent.RESULT_VALUE],
247
+ }
230
248
  self._generate_event_on_drift(
231
249
  event[WriterEvent.ENDPOINT_ID],
232
250
  event[WriterEvent.RESULT_STATUS],
233
- event[WriterEvent.RESULT_VALUE],
251
+ event_value,
234
252
  self.project,
235
253
  )
236
254
  logger.info("Completed event DB writes")
@@ -116,8 +116,12 @@ class SlackNotification(NotificationBase):
116
116
  self._get_slack_row(f"*Project:*\n{alert.project}"),
117
117
  self._get_slack_row(f"*UID:*\n{event_data.entity.id}"),
118
118
  ]
119
- if event_data.value is not None:
120
- line.append(self._get_slack_row(f"*Event data:*\n{event_data.value}"))
119
+ if event_data.value_dict:
120
+ data_lines = []
121
+ for key, value in event_data.value_dict.items():
122
+ data_lines.append(f"{key}: {value}")
123
+ data_text = "\n".join(data_lines)
124
+ line.append(self._get_slack_row(f"*Event data:*\n{data_text}"))
121
125
 
122
126
  if url := mlrun.utils.helpers.get_ui_url(alert.project, event_data.entity.id):
123
127
  line.append(self._get_slack_row(f"*Overview:*\n<{url}|*Job overview*>"))
@@ -56,7 +56,7 @@ class WebhookNotification(NotificationBase):
56
56
  if alert:
57
57
  request_body["alert"] = alert.dict()
58
58
  if event_data:
59
- request_body["value"] = event_data.value
59
+ request_body["value"] = event_data.value_dict
60
60
  request_body["id"] = event_data.entity.id
61
61
 
62
62
  if custom_html:
@@ -1,4 +1,4 @@
1
1
  {
2
- "git_commit": "d99c139a3045c51860077414b2076ea95b77a46c",
3
- "version": "1.7.0-rc12"
2
+ "git_commit": "3bba8f5664d7a3ff4639a3437811fa5972883b2f",
3
+ "version": "1.7.0-rc13"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlrun
3
- Version: 1.7.0rc12
3
+ Version: 1.7.0rc13
4
4
  Summary: Tracking and config of machine learning runs
5
5
  Home-page: https://github.com/mlrun/mlrun
6
6
  Author: Yaron Haviv
@@ -1,6 +1,6 @@
1
1
  mlrun/__init__.py,sha256=rxnxHjb5Rq_EnHv77irxah9zKL89AjZZpjQyx3W5izQ,7249
2
2
  mlrun/__main__.py,sha256=LKskOWulg04o0IFm33Pfmokuxo6P9wLSl3ZHkiS9eZc,49326
3
- mlrun/config.py,sha256=D0nTbeVyNlV2cT5VcL7l5W5V70O8kqYNMWo_S7hWC18,64041
3
+ mlrun/config.py,sha256=i1yOBX-_h_zaHKnTUrx0heYeL7_-PeYF30Jyo6jfalw,64135
4
4
  mlrun/errors.py,sha256=HmOAdfpL0bCDisZMUoJPOumneq71ko49Ph-XBL-A4xA,7080
5
5
  mlrun/execution.py,sha256=F45o_rJI3Q8epQefTksvyjmgZr4ZxKmUxXbKW5UZOaY,40891
6
6
  mlrun/features.py,sha256=m17K_3l9Jktwb9dOwlHLTAPTlemsWrRF7dJhXUX0iJU,15429
@@ -28,7 +28,7 @@ mlrun/common/db/sql_session.py,sha256=Znc8KE2oLy4lg3_vRki1sVlNx59TgDSOTCXfU561hB
28
28
  mlrun/common/model_monitoring/__init__.py,sha256=x0EMEvxVjHsm858J1t6IEA9dtKTdFpJ9sKhss10ld8A,721
29
29
  mlrun/common/model_monitoring/helpers.py,sha256=1CpxIDQPumFnpUB1eqcvCpLlyPFVeW2sL6prM-N5A1A,4405
30
30
  mlrun/common/schemas/__init__.py,sha256=JGyxf4eM8ZuVVCASsKZS6lo_Y7VzAuCC8zXZACRAyks,5119
31
- mlrun/common/schemas/alert.py,sha256=zh80OYRcB3oPHoqowl2Qeu7VYmlUx3vT0Ar9GYnxM_g,3157
31
+ mlrun/common/schemas/alert.py,sha256=F-ZQbfBdrSm-PYESjlQ_IjnzKs0OrilOhBdCWzNZOe8,3181
32
32
  mlrun/common/schemas/api_gateway.py,sha256=mw47rpTBAVIRV6TdMQ_A6rIgnEHOUweU7iT3VbINvBE,2519
33
33
  mlrun/common/schemas/artifact.py,sha256=d6srME_eWn2MpGuqvPQZtePRFkjDfNJgQ6JDd51qVrI,2796
34
34
  mlrun/common/schemas/auth.py,sha256=VNvMDdeQxYpnNxxuftI7O47bOaKzvYaiov2I6TnSFvM,6204
@@ -72,7 +72,7 @@ mlrun/datastore/alibaba_oss.py,sha256=OfQ9AbsJNBFF9DFgUdq38TvKw6qwnHmEcnH-nze6ZZ
72
72
  mlrun/datastore/azure_blob.py,sha256=NpkEoIie7mH171tOwlrwpEwzRYGoo9SF3FAAegEENhU,9019
73
73
  mlrun/datastore/base.py,sha256=wWE0lEjOWx_pGbxKQWQFhNvpdtR-WMCML-CiAHjhyzI,24403
74
74
  mlrun/datastore/datastore.py,sha256=GGo8XPnKVWWgY0b-18D93V1g8DJgeBNafa6knnHEabw,9111
75
- mlrun/datastore/datastore_profile.py,sha256=ttyqRWPGJui-0q_rihGk6H7g7aJFDpPCEdFcJZz7Z60,16549
75
+ mlrun/datastore/datastore_profile.py,sha256=CTS22aaCy3IqzjJWTzSJnulxFYJ5LStqPOB4Py1py2U,17186
76
76
  mlrun/datastore/dbfs_store.py,sha256=5IkxnFQXkW0fdx-ca5jjQnUdTsTfNdJzMvV31ZpDNrM,6634
77
77
  mlrun/datastore/filestore.py,sha256=nS3Ie6jG41NDiW_as9tF8Nu5maaSVEKYKUr1IQtPhuA,3767
78
78
  mlrun/datastore/google_cloud_storage.py,sha256=Du5qYYUCSkLt9acQDeQ-PgEjttsE7D2eAoLebO43kiw,6110
@@ -207,12 +207,12 @@ mlrun/model_monitoring/controller.py,sha256=saz_EsiNARf4wkK6AePax82j3z10Fe5qbH-K
207
207
  mlrun/model_monitoring/controller_handler.py,sha256=J9Y9ppLsQaxyYRl21165Rr7QuI9EM-mk-5veAqs4Bi0,1336
208
208
  mlrun/model_monitoring/evidently_application.py,sha256=o9PsDsjyRfcbuC1X1gb2ww5nzWCsR_KheabtpxKZ5yY,4824
209
209
  mlrun/model_monitoring/features_drift_table.py,sha256=c6GpKtpOJbuT1u5uMWDL_S-6N4YPOmlktWMqPme3KFY,25308
210
- mlrun/model_monitoring/helpers.py,sha256=gEgj5rCU1q8NRtmpFBpzfpOaeDmdf1Aa0WPiHKtnjfo,9095
210
+ mlrun/model_monitoring/helpers.py,sha256=oo_QZnx_M-b7QdVntwuFS4Y5p8pZRulCc44mwtqK8vM,9329
211
211
  mlrun/model_monitoring/model_endpoint.py,sha256=BBtxdY5ciormI_al4zshmIp0GN7hGhOCn-hLgpCXek0,3938
212
212
  mlrun/model_monitoring/prometheus.py,sha256=cUR4y73GutJB_pA_VCBDl9YtK4PcIJp2wj2rnLVmYi4,7578
213
- mlrun/model_monitoring/stream_processing.py,sha256=SbxH9NcwZymXiPSa51HRmyghxgSbPCzYgWarRa8iJx4,49264
213
+ mlrun/model_monitoring/stream_processing.py,sha256=7p9ILBEI0opn1yf0AwHvucVRVjaJQItWq-Xr1uOG8Y4,49093
214
214
  mlrun/model_monitoring/tracking_policy.py,sha256=sQq956akAQpntkrJwIgFWcEq-JpyVcg0FxgNa4h3V70,5502
215
- mlrun/model_monitoring/writer.py,sha256=6l6no2xBwYAZxrs8ryaCdhFEf3aAicHWNuw6zrxYo-E,8555
215
+ mlrun/model_monitoring/writer.py,sha256=zDdGC9BtMKz23IEYJA2rCX_bGi9vA5esjJ34lf2bMco,9294
216
216
  mlrun/model_monitoring/applications/__init__.py,sha256=6CsTXAxeLbbf8yfCADTaxmiavqwrLEdYFJ-qc5kgDAY,569
217
217
  mlrun/model_monitoring/applications/histogram_data_drift.py,sha256=RIBY2tqbbYuBgcpkMmR_IjtZjUr8ZSwfMlgszd9KuUc,11701
218
218
  mlrun/model_monitoring/db/__init__.py,sha256=sXYc6CF2I_HMJyUoY_4VueQf3OL-vhEAuWHxQvuoGRs,662
@@ -319,14 +319,14 @@ mlrun/utils/notifications/notification/base.py,sha256=sq6ICoboUeVwNPhMenaTFDEFnu
319
319
  mlrun/utils/notifications/notification/console.py,sha256=MAVk7v5PJ52vdGRv76YcEPixWgV0licBPWGpR01uR40,2643
320
320
  mlrun/utils/notifications/notification/git.py,sha256=ELZ-ZmbFDb39A0OUIhtvuSbqJoVfF_o_IOxMD5eBlv4,5351
321
321
  mlrun/utils/notifications/notification/ipython.py,sha256=ZtVL30B_Ha0VGoo4LxO-voT1U41IYwyytovv5X_LsI4,2066
322
- mlrun/utils/notifications/notification/slack.py,sha256=sLuSPOZmipVHnvzjljE3WBY1ejvmEiiRpvK4NCD61Z8,5112
323
- mlrun/utils/notifications/notification/webhook.py,sha256=zy9QfcyfKrWs9O-0oHfMv3rTkykdAJErJhkyvMapk4U,2743
322
+ mlrun/utils/notifications/notification/slack.py,sha256=1-_lQ6GnSFMMOKMcVrvfd6LgbKJ22vhkBV92ZUzRsV8,5286
323
+ mlrun/utils/notifications/notification/webhook.py,sha256=m6q7zhIUPjqzHwYXOQf_SjRXB7vQ5snE__gTHP9gRU8,2748
324
324
  mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
325
- mlrun/utils/version/version.json,sha256=aWxUZS9PsSKh4bgra14brpJVJsvWpWqpM1AN9BuLwcE,89
325
+ mlrun/utils/version/version.json,sha256=-jcRFJhvdBZzvie_QvhQm7zYeqjbPb1wo9f24sGuhSM,89
326
326
  mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
327
- mlrun-1.7.0rc12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
328
- mlrun-1.7.0rc12.dist-info/METADATA,sha256=8WBtbHlAToh9ctqQ3hcotqMbaElPXndWA3PZYcvYyn0,18800
329
- mlrun-1.7.0rc12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
330
- mlrun-1.7.0rc12.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
331
- mlrun-1.7.0rc12.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
332
- mlrun-1.7.0rc12.dist-info/RECORD,,
327
+ mlrun-1.7.0rc13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
328
+ mlrun-1.7.0rc13.dist-info/METADATA,sha256=ngG2rsX5doAJG3DNh889Yih1WjSl4uXqTXqkmK06P74,18800
329
+ mlrun-1.7.0rc13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
330
+ mlrun-1.7.0rc13.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
331
+ mlrun-1.7.0rc13.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
332
+ mlrun-1.7.0rc13.dist-info/RECORD,,