mlrun 1.8.0rc31__py3-none-any.whl → 1.8.0rc32__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/db/base.py CHANGED
@@ -720,7 +720,7 @@ class RunDBInterface(ABC):
720
720
  def list_model_endpoints(
721
721
  self,
722
722
  project: str,
723
- name: Optional[str] = None,
723
+ names: Optional[Union[str, list[str]]] = None,
724
724
  function_name: Optional[str] = None,
725
725
  function_tag: Optional[str] = None,
726
726
  model_name: Optional[str] = None,
mlrun/db/httpdb.py CHANGED
@@ -3765,7 +3765,7 @@ class HTTPRunDB(RunDBInterface):
3765
3765
  def list_model_endpoints(
3766
3766
  self,
3767
3767
  project: str,
3768
- name: Optional[str] = None,
3768
+ names: Optional[Union[str, list[str]]] = None,
3769
3769
  function_name: Optional[str] = None,
3770
3770
  function_tag: Optional[str] = None,
3771
3771
  model_name: Optional[str] = None,
@@ -3782,7 +3782,7 @@ class HTTPRunDB(RunDBInterface):
3782
3782
  List model endpoints with optional filtering by name, function name, model name, labels, and time range.
3783
3783
 
3784
3784
  :param project: The name of the project
3785
- :param name: The name of the model endpoint
3785
+ :param names: The name of the model endpoint, or list of names of the model endpoints
3786
3786
  :param function_name: The name of the function
3787
3787
  :param function_tag: The tag of the function
3788
3788
  :param model_name: The name of the model
@@ -3798,12 +3798,13 @@ class HTTPRunDB(RunDBInterface):
3798
3798
  """
3799
3799
  path = f"projects/{project}/model-endpoints"
3800
3800
  labels = self._parse_labels(labels)
3801
-
3801
+ if names and isinstance(names, str):
3802
+ names = [names]
3802
3803
  response = self.api_call(
3803
3804
  method=mlrun.common.types.HTTPMethod.GET,
3804
3805
  path=path,
3805
3806
  params={
3806
- "name": name,
3807
+ "name": names,
3807
3808
  "model_name": model_name,
3808
3809
  "model_tag": model_tag,
3809
3810
  "function_name": function_name,
mlrun/db/nopdb.py CHANGED
@@ -617,7 +617,7 @@ class NopDB(RunDBInterface):
617
617
  def list_model_endpoints(
618
618
  self,
619
619
  project: str,
620
- name: Optional[str] = None,
620
+ names: Optional[Union[str, list[str]]] = None,
621
621
  function_name: Optional[str] = None,
622
622
  function_tag: Optional[str] = None,
623
623
  model_name: Optional[str] = None,
@@ -28,6 +28,7 @@ import mlrun.model_monitoring.api as mm_api
28
28
  import mlrun.model_monitoring.applications.context as mm_context
29
29
  import mlrun.model_monitoring.applications.results as mm_results
30
30
  from mlrun.serving.utils import MonitoringApplicationToDict
31
+ from mlrun.utils import logger
31
32
 
32
33
 
33
34
  class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
@@ -94,7 +95,7 @@ class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
94
95
  context: "mlrun.MLClientCtx",
95
96
  sample_data: Optional[pd.DataFrame] = None,
96
97
  reference_data: Optional[pd.DataFrame] = None,
97
- endpoints: Optional[list[tuple[str, str]]] = None,
98
+ endpoints: Optional[Union[list[tuple[str, str]], list[str], str]] = None,
98
99
  start: Optional[str] = None,
99
100
  end: Optional[str] = None,
100
101
  base_period: Optional[int] = None,
@@ -137,14 +138,62 @@ class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
137
138
  }
138
139
  )
139
140
  result_key = (
140
- f"{endpoint_name}_{window_start.isoformat()}_{window_end.isoformat()}"
141
+ f"{endpoint_name}-{endpoint_id}_{window_start.isoformat()}_{window_end.isoformat()}"
141
142
  if window_start and window_end
142
- else endpoint_name
143
+ else f"{endpoint_name}-{endpoint_id}"
143
144
  )
144
145
  context.log_result(result_key, result)
145
146
  else:
146
147
  return call_do_tracking()
147
148
 
149
+ @staticmethod
150
+ def _handle_endpoints_type_evaluate(
151
+ project: str,
152
+ endpoints: Union[list[tuple[str, str]], list[str], str, None],
153
+ ) -> list[tuple[str, str]]:
154
+ if endpoints:
155
+ if isinstance(endpoints, str) or (
156
+ isinstance(endpoints, list) and isinstance(endpoints[0], str)
157
+ ):
158
+ endpoints_list = (
159
+ mlrun.get_run_db()
160
+ .list_model_endpoints(
161
+ project,
162
+ names=endpoints,
163
+ latest_only=True,
164
+ )
165
+ .endpoints
166
+ )
167
+ if endpoints_list:
168
+ list_endpoints_result = [
169
+ (endpoint.metadata.name, endpoint.metadata.uid)
170
+ for endpoint in endpoints_list
171
+ ]
172
+ retrieve_ep_names = list(
173
+ map(lambda endpoint: endpoint[0], list_endpoints_result)
174
+ )
175
+ missing = set(
176
+ [endpoints] if isinstance(endpoints, str) else endpoints
177
+ ) - set(retrieve_ep_names)
178
+ if missing:
179
+ logger.warning(
180
+ "Could not list all the required endpoints.",
181
+ missing_endpoint=missing,
182
+ endpoints=list_endpoints_result,
183
+ )
184
+ else:
185
+ raise mlrun.errors.MLRunNotFoundError(
186
+ f"Did not find any model_endpoint named ' {endpoints}'"
187
+ )
188
+
189
+ if not (
190
+ isinstance(endpoints, list) and isinstance(endpoints[0], (list, tuple))
191
+ ):
192
+ raise mlrun.errors.MLRunInvalidArgumentError(
193
+ "Could not resolve endpoints as list of [(name, uid)]"
194
+ )
195
+ return endpoints
196
+
148
197
  @staticmethod
149
198
  def _window_generator(
150
199
  start: Optional[str], end: Optional[str], base_period: Optional[int]
@@ -337,7 +386,7 @@ class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
337
386
  class_handler: Optional[str] = None,
338
387
  requirements: Optional[Union[str, list[str]]] = None,
339
388
  requirements_file: str = "",
340
- endpoints: Optional[list[tuple[str, str]]] = None,
389
+ endpoints: Optional[Union[list[tuple[str, str]], list[str], str]] = None,
341
390
  start: Optional[datetime] = None,
342
391
  end: Optional[datetime] = None,
343
392
  base_period: Optional[int] = None,
@@ -365,6 +414,9 @@ class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
365
414
  :param requirements: List of Python requirements to be installed in the image.
366
415
  :param requirements_file: Path to a Python requirements file to be installed in the image.
367
416
  :param endpoints: A list of tuples of the model endpoint (name, uid) to get the data from.
417
+ allow providing a list of model_endpoint names or name for a single model_endpoint.
418
+ Note: provide names retrieves the model all the active model endpoints using those
419
+ names (cross function model endpoints)
368
420
  If provided, and ``sample_data`` is not, you have to provide also the ``start`` and
369
421
  ``end`` times of the data to analyze from the model endpoints.
370
422
  :param start: The start time of the endpoint's data, not included.
@@ -405,6 +457,10 @@ class ModelMonitoringApplicationBase(MonitoringApplicationToDict, ABC):
405
457
 
406
458
  params: dict[str, Union[list[tuple[str, str]], str, int, None]] = {}
407
459
  if endpoints:
460
+ endpoints = cls._handle_endpoints_type_evaluate(
461
+ project=project.name,
462
+ endpoints=endpoints,
463
+ )
408
464
  params["endpoints"] = endpoints
409
465
  if sample_data is None:
410
466
  if start is None or end is None:
@@ -629,7 +629,7 @@ class _KFPRunner(_PipelineRunner):
629
629
  secret_params=notification.secret_params,
630
630
  )
631
631
 
632
- project.spec.notifications = project.notifiers.server_notifications
632
+ project.spec.notifications = project.notifiers.server_notifications
633
633
 
634
634
  run_id = _run_pipeline(
635
635
  workflow_handler,
mlrun/projects/project.py CHANGED
@@ -2155,7 +2155,7 @@ class MlrunProject(ModelObj):
2155
2155
 
2156
2156
  For example:
2157
2157
  [`app1.result-*`, `*.result1`]
2158
- will match "mep1.app1.result.result-1" and "mep1.app2.result.result1".
2158
+ will match "mep_uid1.app1.result.result-1" and "mep_uid1.app2.result.result1".
2159
2159
  A specific result_name (not a wildcard) will always create a new alert
2160
2160
  config, regardless of whether the result name exists.
2161
2161
  :param severity: Severity of the alert.
@@ -3786,7 +3786,7 @@ class MlrunProject(ModelObj):
3786
3786
 
3787
3787
  def list_model_endpoints(
3788
3788
  self,
3789
- name: Optional[str] = None,
3789
+ names: Optional[Union[str, list[str]]] = None,
3790
3790
  model_name: Optional[str] = None,
3791
3791
  model_tag: Optional[str] = None,
3792
3792
  function_name: Optional[str] = None,
@@ -3816,7 +3816,7 @@ class MlrunProject(ModelObj):
3816
3816
  In addition, this functions provides a facade for listing endpoint related metrics. This facade is time-based
3817
3817
  and depends on the 'start' and 'end' parameters.
3818
3818
 
3819
- :param name: The name of the model to filter by
3819
+ :param names: The name of the model to filter by
3820
3820
  :param model_name: The name of the model to filter by
3821
3821
  :param function_name: The name of the function to filter by
3822
3822
  :param function_tag: The tag of the function to filter by
@@ -3837,7 +3837,7 @@ class MlrunProject(ModelObj):
3837
3837
  db = mlrun.db.get_run_db(secrets=self._secrets)
3838
3838
  return db.list_model_endpoints(
3839
3839
  project=self.name,
3840
- name=name,
3840
+ names=names,
3841
3841
  model_name=model_name,
3842
3842
  model_tag=model_tag,
3843
3843
  function_name=function_name,
@@ -1,4 +1,4 @@
1
1
  {
2
- "git_commit": "d59051b8a82bcd6d655bf0194284070a4a7c6341",
3
- "version": "1.8.0-rc31"
2
+ "git_commit": "c816b6df64e933458e71286173355dc766e50e68",
3
+ "version": "1.8.0-rc32"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mlrun
3
- Version: 1.8.0rc31
3
+ Version: 1.8.0rc32
4
4
  Summary: Tracking and config of machine learning runs
5
5
  Home-page: https://github.com/mlrun/mlrun
6
6
  Author: Yaron Haviv
@@ -108,10 +108,10 @@ mlrun/datastore/wasbfs/__init__.py,sha256=s5Ul-0kAhYqFjKDR2X0O2vDGDbLQQduElb32Ev
108
108
  mlrun/datastore/wasbfs/fs.py,sha256=ge8NK__5vTcFT-krI155_8RDUywQw4SIRX6BWATXy9Q,6299
109
109
  mlrun/db/__init__.py,sha256=WqJ4x8lqJ7ZoKbhEyFqkYADd9P6E3citckx9e9ZLcIU,1163
110
110
  mlrun/db/auth_utils.py,sha256=hpg8D2r82oN0BWabuWN04BTNZ7jYMAF242YSUpK7LFM,5211
111
- mlrun/db/base.py,sha256=jVM_M5_K0EyOSEwxQokGTM6dKKsMcy5LnFGDtVpKkgc,30678
111
+ mlrun/db/base.py,sha256=pFf33ey6vlTN7cEr8EpsSQhdydDhSXtDz5ukK5o25f8,30697
112
112
  mlrun/db/factory.py,sha256=yP2vVmveUE7LYTCHbS6lQIxP9rW--zdISWuPd_I3d_4,2111
113
- mlrun/db/httpdb.py,sha256=I_UiwFtwF5kUvyS1aJyF67vCCQ1oPey4J6yo2ApRtW0,230195
114
- mlrun/db/nopdb.py,sha256=dtyUqnleBN7i59xfgjMB4e-aGM_Oj6ONOIzMKxG3UlM,27113
113
+ mlrun/db/httpdb.py,sha256=Pl9BdXDUJRLfwLdOYgbh-Bs-wxUoE-9v5l2gXWH7Mec,230329
114
+ mlrun/db/nopdb.py,sha256=h_tgZDWr-7ri_gbgD3FOb9i4X_W9e4rr7va7S10kInI,27132
115
115
  mlrun/feature_store/__init__.py,sha256=AVnY2AFUNc2dKxLLUMx2K3Wo1eGviv0brDcYlDnmtf4,1506
116
116
  mlrun/feature_store/api.py,sha256=qkojZpzqGAn3r9ww0ynBRKOs8ji8URaK4DSYD4SE-CE,50395
117
117
  mlrun/feature_store/common.py,sha256=Z7USI-d1fo0iwBMsqMBtJflJfyuiV3BLoDXQPSAoBAs,12826
@@ -226,7 +226,7 @@ mlrun/model_monitoring/tracking_policy.py,sha256=PBIGrUYWrwcE5gwXupBIVzOb0QRRwPJ
226
226
  mlrun/model_monitoring/writer.py,sha256=vbL7bqTyNu8q4bNcebX72sUMybVDAoTWg-CXq4fov3Y,8429
227
227
  mlrun/model_monitoring/applications/__init__.py,sha256=QYvzgCutFdAkzqKPD3mvkX_3c1X4tzd-kW8ojUOE9ic,889
228
228
  mlrun/model_monitoring/applications/_application_steps.py,sha256=97taCEkfGx-QO-gD9uKnRF1PDIxQhY7sjPg85GxgIpA,6628
229
- mlrun/model_monitoring/applications/base.py,sha256=9mRnykWqWnKrtJ6qrov1t6sjEz56YaID9_eh_5Cq7EA,21334
229
+ mlrun/model_monitoring/applications/base.py,sha256=c8sYo58iAYNP42Ov4PHJR1UxTpFwXY19vdywGXrfEZQ,23870
230
230
  mlrun/model_monitoring/applications/context.py,sha256=xqbKS61iXE6jBekyW8zjo_E3lxe2D8VepuXG_BA5y2k,14931
231
231
  mlrun/model_monitoring/applications/evidently_base.py,sha256=hRjXuXf6xf8sbjGt9yYfGDUGnvS5rV3W7tkJroF3QJA,5098
232
232
  mlrun/model_monitoring/applications/histogram_data_drift.py,sha256=G26_4gQfcwDZe3S6SIZ4Uc_qyrHAJ6lDTFOQGkbfQR8,14455
@@ -267,8 +267,8 @@ mlrun/platforms/__init__.py,sha256=ZuyeHCHHUxYEoZRmaJqzFSfwhaTyUdBZXMeVp75ql1w,3
267
267
  mlrun/platforms/iguazio.py,sha256=6VBTq8eQ3mzT96tzjYhAtcMQ2VjF4x8LpIPW5DAcX2Q,13749
268
268
  mlrun/projects/__init__.py,sha256=0Krf0WIKfnZa71WthYOg0SoaTodGg3sV_hK3f_OlTPI,1220
269
269
  mlrun/projects/operations.py,sha256=VXUlMrouFTls-I-bMhdN5pPfQ34TR7bFQ-NUSWNvl84,20029
270
- mlrun/projects/pipelines.py,sha256=iSFSklUqhhR_0fvnG9AS4jWgt8kR3NrKo7vW9ehX4uo,48259
271
- mlrun/projects/project.py,sha256=f1tNPVc_jqeXV0BnyYHEvQC1PZSQOydPvop-6_NlJBg,234476
270
+ mlrun/projects/pipelines.py,sha256=QH2nEhaJxhafJdT0AXPzpDhTniyHtc0Cg74Spdz6Oeg,48255
271
+ mlrun/projects/project.py,sha256=89fKq2kdfV1mtMMj0EIT55eI_F3IUKk_dCeAk7S-5AA,234506
272
272
  mlrun/runtimes/__init__.py,sha256=J9Sy2HiyMlztNv6VUurMzF5H2XzttNil8nRsWDsqLyg,8923
273
273
  mlrun/runtimes/base.py,sha256=aAEGZKPkcFs30UzURS7al3xYEDDARpJQ8kFhtBKUhik,37845
274
274
  mlrun/runtimes/daskjob.py,sha256=JwuGvOiPsxEDHHMMUS4Oie4hLlYYIZwihAl6DjroTY0,19521
@@ -338,11 +338,11 @@ mlrun/utils/notifications/notification/mail.py,sha256=ZyJ3eqd8simxffQmXzqd3bgbAq
338
338
  mlrun/utils/notifications/notification/slack.py,sha256=eQvmctTh6wIG5xVOesLLV9S1-UUCu5UEQ9JIJOor3ts,7183
339
339
  mlrun/utils/notifications/notification/webhook.py,sha256=NeyIMSBojjjTJaUHmPbxMByp34GxYkl1-16NqzU27fU,4943
340
340
  mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
341
- mlrun/utils/version/version.json,sha256=SaPAMx9h5srPLn9C27u30d_vVEwOOn2ZKxNhEF1-k-k,89
341
+ mlrun/utils/version/version.json,sha256=Tm_MnhrvV-ygaHPbOywgCjTbNQUZ0lblX2agecVqT1w,89
342
342
  mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
343
- mlrun-1.8.0rc31.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
344
- mlrun-1.8.0rc31.dist-info/METADATA,sha256=Dm4rCBBu0WElji39X7P0nCB0-HEGwzx4vLKY7UUWeiM,25985
345
- mlrun-1.8.0rc31.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
346
- mlrun-1.8.0rc31.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
347
- mlrun-1.8.0rc31.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
348
- mlrun-1.8.0rc31.dist-info/RECORD,,
343
+ mlrun-1.8.0rc32.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
344
+ mlrun-1.8.0rc32.dist-info/METADATA,sha256=fXIsyQiNvixypLDBHlMSCp6SSQ1exll98yKjLGxawbM,25985
345
+ mlrun-1.8.0rc32.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
346
+ mlrun-1.8.0rc32.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
347
+ mlrun-1.8.0rc32.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
348
+ mlrun-1.8.0rc32.dist-info/RECORD,,