mlrun 1.10.0rc5__py3-none-any.whl → 1.10.0rc7__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.

Files changed (47) hide show
  1. mlrun/__main__.py +47 -4
  2. mlrun/artifacts/base.py +0 -27
  3. mlrun/artifacts/dataset.py +0 -8
  4. mlrun/artifacts/model.py +3 -10
  5. mlrun/artifacts/plots.py +0 -13
  6. mlrun/common/schemas/model_monitoring/__init__.py +1 -0
  7. mlrun/common/schemas/model_monitoring/constants.py +14 -2
  8. mlrun/common/schemas/model_monitoring/functions.py +66 -0
  9. mlrun/common/schemas/project.py +3 -0
  10. mlrun/config.py +3 -3
  11. mlrun/db/base.py +13 -20
  12. mlrun/db/httpdb.py +48 -65
  13. mlrun/db/nopdb.py +12 -13
  14. mlrun/launcher/base.py +1 -0
  15. mlrun/launcher/client.py +24 -0
  16. mlrun/launcher/local.py +4 -0
  17. mlrun/model_monitoring/applications/_application_steps.py +23 -39
  18. mlrun/model_monitoring/applications/base.py +167 -32
  19. mlrun/model_monitoring/db/tsdb/base.py +30 -0
  20. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +118 -50
  21. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +117 -24
  22. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +106 -15
  23. mlrun/model_monitoring/helpers.py +0 -3
  24. mlrun/projects/operations.py +11 -24
  25. mlrun/projects/project.py +81 -83
  26. mlrun/runtimes/base.py +0 -27
  27. mlrun/runtimes/daskjob.py +6 -4
  28. mlrun/runtimes/databricks_job/databricks_runtime.py +0 -2
  29. mlrun/runtimes/kubejob.py +5 -8
  30. mlrun/runtimes/mpijob/abstract.py +2 -2
  31. mlrun/runtimes/mpijob/v1.py +2 -2
  32. mlrun/runtimes/nuclio/application/application.py +0 -5
  33. mlrun/runtimes/nuclio/function.py +2 -11
  34. mlrun/runtimes/nuclio/serving.py +46 -6
  35. mlrun/runtimes/pod.py +4 -3
  36. mlrun/runtimes/remotesparkjob.py +2 -2
  37. mlrun/runtimes/sparkjob/spark3job.py +2 -2
  38. mlrun/serving/server.py +97 -3
  39. mlrun/serving/states.py +16 -18
  40. mlrun/utils/helpers.py +15 -4
  41. mlrun/utils/version/version.json +2 -2
  42. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/METADATA +3 -2
  43. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/RECORD +47 -46
  44. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/WHEEL +0 -0
  45. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/entry_points.txt +0 -0
  46. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/licenses/LICENSE +0 -0
  47. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/top_level.txt +0 -0
mlrun/__main__.py CHANGED
@@ -23,6 +23,7 @@ from ast import literal_eval
23
23
  from base64 import b64decode
24
24
  from os import environ, path, remove
25
25
  from pprint import pprint
26
+ from typing import Optional
26
27
 
27
28
  import click
28
29
  import dotenv
@@ -199,6 +200,13 @@ def main():
199
200
  multiple=True,
200
201
  help="Logging configurations for the handler's returning values",
201
202
  )
203
+ @click.option(
204
+ "--allow-cross-project",
205
+ is_flag=True,
206
+ default=True, # TODO: remove this default in 1.11
207
+ help="Override the loaded project name. This flag ensures awareness of loading an existing project yaml "
208
+ "as a baseline for a new project with a different name",
209
+ )
202
210
  def run(
203
211
  url,
204
212
  param,
@@ -242,6 +250,7 @@ def run(
242
250
  run_args,
243
251
  ensure_project,
244
252
  returns,
253
+ allow_cross_project,
245
254
  ):
246
255
  """Execute a task and inject parameters."""
247
256
 
@@ -293,10 +302,11 @@ def run(
293
302
  mlrun.get_or_create_project(
294
303
  name=project,
295
304
  context="./",
305
+ allow_cross_project=allow_cross_project,
296
306
  )
297
307
  if func_url or kind:
298
308
  if func_url:
299
- runtime = func_url_to_runtime(func_url, ensure_project)
309
+ runtime = func_url_to_runtime(func_url, ensure_project, allow_cross_project)
300
310
  kind = get_in(runtime, "kind", kind or "job")
301
311
  if runtime is None:
302
312
  exit(1)
@@ -494,6 +504,13 @@ def run(
494
504
  default="/tmp/fullimage",
495
505
  help="path to file with full image data",
496
506
  )
507
+ @click.option(
508
+ "--allow-cross-project",
509
+ is_flag=True,
510
+ default=True, # TODO: remove this default in 1.11
511
+ help="Override the loaded project name. This flag ensures awareness of loading an existing project yaml "
512
+ "as a baseline for a new project with a different name",
513
+ )
497
514
  def build(
498
515
  func_url,
499
516
  name,
@@ -516,6 +533,7 @@ def build(
516
533
  state_file_path,
517
534
  image_file_path,
518
535
  full_image_file_path,
536
+ allow_cross_project,
519
537
  ):
520
538
  """Build a container image from code and requirements."""
521
539
 
@@ -591,6 +609,7 @@ def build(
591
609
  mlrun.get_or_create_project(
592
610
  name=project,
593
611
  context="./",
612
+ allow_cross_project=allow_cross_project,
594
613
  )
595
614
 
596
615
  if hasattr(func, "deploy"):
@@ -644,6 +663,13 @@ def build(
644
663
  is_flag=True,
645
664
  help="ensure the project exists, if not, create project",
646
665
  )
666
+ @click.option(
667
+ "--allow-cross-project",
668
+ is_flag=True,
669
+ default=True, # TODO: remove this default in 1.11
670
+ help="Override the loaded project name. This flag ensures awareness of loading an existing project yaml "
671
+ "as a baseline for a new project with a different name",
672
+ )
647
673
  def deploy(
648
674
  spec,
649
675
  source,
@@ -656,6 +682,7 @@ def deploy(
656
682
  verbose,
657
683
  env_file,
658
684
  ensure_project,
685
+ allow_cross_project,
659
686
  ):
660
687
  """Deploy model or function"""
661
688
  if env_file:
@@ -665,10 +692,11 @@ def deploy(
665
692
  mlrun.get_or_create_project(
666
693
  name=project,
667
694
  context="./",
695
+ allow_cross_project=allow_cross_project,
668
696
  )
669
697
 
670
698
  if func_url:
671
- runtime = func_url_to_runtime(func_url, ensure_project)
699
+ runtime = func_url_to_runtime(func_url, ensure_project, allow_cross_project)
672
700
  if runtime is None:
673
701
  exit(1)
674
702
  elif spec:
@@ -971,6 +999,13 @@ def logs(uid, project, offset, db):
971
999
  "destination define: file=notification.json or a "
972
1000
  'dictionary configuration e.g \'{"slack":{"webhook":"<webhook>"}}\'',
973
1001
  )
1002
+ @click.option(
1003
+ "--allow-cross-project",
1004
+ is_flag=True,
1005
+ default=True, # TODO: remove this default in 1.11
1006
+ help="Override the loaded project name. This flag ensures awareness of loading an existing project yaml "
1007
+ "as a baseline for a new project with a different name",
1008
+ )
974
1009
  def project(
975
1010
  context,
976
1011
  name,
@@ -998,6 +1033,7 @@ def project(
998
1033
  notifications,
999
1034
  save_secrets,
1000
1035
  save,
1036
+ allow_cross_project,
1001
1037
  ):
1002
1038
  """load and/or run a project"""
1003
1039
  if env_file:
@@ -1024,6 +1060,7 @@ def project(
1024
1060
  clone=clone,
1025
1061
  save=save,
1026
1062
  parameters=parameters,
1063
+ allow_cross_project=allow_cross_project,
1027
1064
  )
1028
1065
  url_str = " from " + url if url else ""
1029
1066
  print(f"Loading project {proj.name}{url_str} into {context}:\n")
@@ -1337,7 +1374,11 @@ def dict_to_str(struct: dict):
1337
1374
  return ",".join([f"{k}={v}" for k, v in struct.items()])
1338
1375
 
1339
1376
 
1340
- def func_url_to_runtime(func_url, ensure_project: bool = False):
1377
+ def func_url_to_runtime(
1378
+ func_url,
1379
+ ensure_project: bool = False,
1380
+ allow_cross_project: Optional[bool] = None,
1381
+ ):
1341
1382
  try:
1342
1383
  if func_url.startswith("db://"):
1343
1384
  func_url = func_url[5:]
@@ -1348,7 +1389,9 @@ def func_url_to_runtime(func_url, ensure_project: bool = False):
1348
1389
  func_url = "function.yaml" if func_url == "." else func_url
1349
1390
  runtime = import_function_to_dict(func_url, {})
1350
1391
  else:
1351
- mlrun_project = load_project(".", save=ensure_project)
1392
+ mlrun_project = load_project(
1393
+ ".", save=ensure_project, allow_cross_project=allow_cross_project
1394
+ )
1352
1395
  function = mlrun_project.get_function(func_url, enrich=True)
1353
1396
  if function.kind == "local":
1354
1397
  command, function = load_func_code(function)
mlrun/artifacts/base.py CHANGED
@@ -223,28 +223,9 @@ class Artifact(ModelObj):
223
223
  target_path=None,
224
224
  project=None,
225
225
  src_path: typing.Optional[str] = None,
226
- # All params up until here are legacy params for compatibility with legacy artifacts.
227
- # TODO: remove them in 1.10.0.
228
226
  metadata: ArtifactMetadata = None,
229
227
  spec: ArtifactSpec = None,
230
228
  ):
231
- if (
232
- key
233
- or body
234
- or viewer
235
- or is_inline
236
- or format
237
- or size
238
- or target_path
239
- or project
240
- or src_path
241
- ):
242
- warnings.warn(
243
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
244
- "Use the metadata and spec parameters instead.",
245
- DeprecationWarning,
246
- )
247
-
248
229
  self._metadata = None
249
230
  self.metadata = metadata
250
231
  self._spec = None
@@ -769,17 +750,9 @@ class LinkArtifact(Artifact):
769
750
  link_key=None,
770
751
  link_tree=None,
771
752
  project=None,
772
- # All params up until here are legacy params for compatibility with legacy artifacts.
773
- # TODO: remove them in 1.10.0.
774
753
  metadata: ArtifactMetadata = None,
775
754
  spec: LinkArtifactSpec = None,
776
755
  ):
777
- if key or target_path or link_iteration or link_key or link_tree or project:
778
- warnings.warn(
779
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
780
- "Use the metadata and spec parameters instead.",
781
- DeprecationWarning,
782
- )
783
756
  super().__init__(
784
757
  key, target_path=target_path, project=project, metadata=metadata, spec=spec
785
758
  )
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
  import os
15
15
  import pathlib
16
- import warnings
17
16
  from io import StringIO
18
17
  from typing import Optional
19
18
 
@@ -161,13 +160,6 @@ class DatasetArtifact(Artifact):
161
160
  label_column: Optional[str] = None,
162
161
  **kwargs,
163
162
  ):
164
- if key or format or target_path:
165
- warnings.warn(
166
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
167
- "Use the metadata and spec parameters instead.",
168
- DeprecationWarning,
169
- )
170
-
171
163
  format = (format or "").lower()
172
164
  super().__init__(key, None, format=format, target_path=target_path)
173
165
  if format and format not in self.SUPPORTED_FORMATS:
mlrun/artifacts/model.py CHANGED
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import tempfile
16
- import warnings
17
16
  from os import path
18
17
  from typing import Any, Optional, Union
19
18
 
@@ -187,14 +186,8 @@ class ModelArtifact(Artifact):
187
186
  :param model_url: Remote model url.
188
187
  :param default_config: Default configuration for client building
189
188
  Saved as a sub-dictionary under the parameter.
190
- :param kwargs:
189
+ :param kwargs: Arguments to pass to the artifact class.
191
190
  """
192
- if key or body or format or target_path:
193
- warnings.warn(
194
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
195
- "Use the metadata and spec parameters instead.",
196
- DeprecationWarning,
197
- )
198
191
  super().__init__(key, body, format=format, target_path=target_path, **kwargs)
199
192
  model_file = str(model_file or "")
200
193
  if model_file and model_url:
@@ -366,7 +359,7 @@ class ModelArtifact(Artifact):
366
359
  def before_log(self):
367
360
  if not self.spec.model_file and not self.spec.model_url:
368
361
  raise ValueError(
369
- "ModelArtifact must have either model_file or model_url attributes"
362
+ "ModelArtifact must have either 'model_file' or 'model_url' attributes"
370
363
  )
371
364
 
372
365
  super().before_log()
@@ -479,7 +472,7 @@ def get_model(
479
472
  ] = None,
480
473
  suffix="",
481
474
  ) -> (str, ModelArtifact, dict):
482
- """return model file, model spec object, and dictionary of extra data items
475
+ """Return model file, model spec object, and dictionary of extra data items
483
476
 
484
477
  this function will get the model file, metadata, and extra data
485
478
  the returned model file is always local, when using remote urls
mlrun/artifacts/plots.py CHANGED
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
  import base64
15
15
  import typing
16
- import warnings
17
16
  from io import BytesIO
18
17
 
19
18
  import mlrun
@@ -35,12 +34,6 @@ class PlotArtifact(Artifact):
35
34
  def __init__(
36
35
  self, key=None, body=None, is_inline=False, target_path=None, title=None
37
36
  ):
38
- if key or body or is_inline or target_path:
39
- warnings.warn(
40
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
41
- "Use the metadata and spec parameters instead.",
42
- DeprecationWarning,
43
- )
44
37
  super().__init__(key, body, format="html", target_path=target_path)
45
38
  self.metadata.description = title
46
39
 
@@ -94,12 +87,6 @@ class PlotlyArtifact(Artifact):
94
87
  :param key: Key for the artifact to be stored in the database.
95
88
  :param target_path: Path to save the artifact.
96
89
  """
97
- if key or target_path:
98
- warnings.warn(
99
- "Artifact constructor parameters are deprecated in 1.7.0 and will be removed in 1.10.0. "
100
- "Use the metadata and spec parameters instead.",
101
- DeprecationWarning,
102
- )
103
90
  # Validate the plotly package:
104
91
  try:
105
92
  from plotly.graph_objs import Figure
@@ -43,6 +43,7 @@ from .constants import (
43
43
  WriterEvent,
44
44
  WriterEventKind,
45
45
  )
46
+ from .functions import FunctionsType, FunctionSummary
46
47
  from .grafana import (
47
48
  GrafanaColumn,
48
49
  GrafanaColumnType,
@@ -416,14 +416,22 @@ class ResultStatusApp(IntEnum):
416
416
  detected = 2
417
417
 
418
418
 
419
- class ModelMonitoringAppLabel:
419
+ class ModelMonitoringLabel:
420
420
  KEY = mlrun.common.constants.MLRunInternalLabels.mlrun_type
421
- VAL = "mlrun__model-monitoring-application"
421
+ VAL = ""
422
422
 
423
423
  def __str__(self) -> str:
424
424
  return f"{self.KEY}={self.VAL}"
425
425
 
426
426
 
427
+ class ModelMonitoringAppLabel(ModelMonitoringLabel):
428
+ VAL = "mlrun__model-monitoring-application"
429
+
430
+
431
+ class ModelMonitoringInfraLabel(ModelMonitoringLabel):
432
+ VAL = "mlrun__model-monitoring-infra"
433
+
434
+
427
435
  class HistogramDataDriftApplicationConstants:
428
436
  NAME = "histogram-data-drift"
429
437
  GENERAL_RESULT_NAME = "general_drift"
@@ -438,6 +446,10 @@ class SpecialApps:
438
446
  MLRUN_INFRA = "mlrun-infra"
439
447
 
440
448
 
449
+ class ModelMonitoringLabels:
450
+ MLRUN_MODEL_MONITORING_INFRA = "mlrun-model-monitoring-infra"
451
+
452
+
441
453
  _RESERVED_FUNCTION_NAMES = MonitoringFunctionNames.list() + [SpecialApps.MLRUN_INFRA]
442
454
 
443
455
 
@@ -0,0 +1,66 @@
1
+ # Copyright 2025 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
+ import enum
16
+ from datetime import datetime
17
+ from typing import Optional
18
+
19
+ from pydantic.v1 import BaseModel
20
+
21
+
22
+ class FunctionsType(enum.Enum):
23
+ APPLICATION = "application"
24
+ INFRA = "infra"
25
+
26
+
27
+ class FunctionSummary(BaseModel):
28
+ """
29
+ Function summary model. Includes metadata about the function, such as its name, as well as statistical
30
+ metrics such as the number of detections and possible detections. A function summary can be from either a
31
+ model monitoring application (type "application") or an infrastructure function (type "infra").
32
+ """
33
+
34
+ type: FunctionsType
35
+ name: str
36
+ application_class: str
37
+ updated_time: datetime
38
+ status: Optional[str] = None
39
+ base_period: Optional[int] = None
40
+ stats: Optional[dict] = None
41
+
42
+ @classmethod
43
+ def from_function_dict(
44
+ cls,
45
+ func_dict: dict,
46
+ func_type=FunctionsType.APPLICATION,
47
+ base_period: Optional[int] = None,
48
+ stats: Optional[dict] = None,
49
+ ):
50
+ """
51
+ Create a FunctionSummary instance from a dictionary.
52
+ """
53
+
54
+ return cls(
55
+ type=func_type,
56
+ name=func_dict["metadata"]["name"],
57
+ application_class=""
58
+ if func_type != FunctionsType.APPLICATION
59
+ else func_dict["spec"]["graph"]["steps"]["PushToMonitoringWriter"]["after"][
60
+ 0
61
+ ],
62
+ updated_time=func_dict["metadata"].get("updated"),
63
+ status=func_dict["status"].get("state"),
64
+ base_period=base_period,
65
+ stats=stats,
66
+ )
@@ -145,6 +145,9 @@ class ProjectSummary(pydantic.v1.BaseModel):
145
145
  endpoint_alerts_count: int = 0
146
146
  job_alerts_count: int = 0
147
147
  other_alerts_count: int = 0
148
+ datasets_count: int = 0
149
+ documents_count: int = 0
150
+ llm_prompts_count: int = 0
148
151
 
149
152
 
150
153
  class IguazioProject(pydantic.v1.BaseModel):
mlrun/config.py CHANGED
@@ -78,12 +78,12 @@ default_config = {
78
78
  "vendor_images_registry": "",
79
79
  # comma separated list of images that are in the specified images_registry, and therefore will be enriched with this
80
80
  # registry when used. default to mlrun/* which means any image which is of the mlrun repository (mlrun/mlrun,
81
- # mlrun/ml-base, etc...)
81
+ # mlrun/mlrun-kfp, etc...)
82
82
  "images_to_enrich_registry": "^mlrun/*,^python:3.(9|11)$",
83
83
  "kfp_url": "",
84
84
  "kfp_ttl": "14400", # KFP ttl in sec, after that completed PODs will be deleted
85
85
  "kfp_image": "mlrun/mlrun-kfp", # image to use for KFP runner
86
- "dask_kfp_image": "mlrun/ml-base", # image to use for dask KFP runner
86
+ "dask_kfp_image": "mlrun/mlrun", # image to use for dask KFP runner
87
87
  "igz_version": "", # the version of the iguazio system the API is running on
88
88
  "iguazio_api_url": "", # the url to iguazio api
89
89
  "spark_app_image": "", # image to use for spark operator app runtime
@@ -287,7 +287,7 @@ default_config = {
287
287
  "serving": "mlrun/mlrun",
288
288
  "nuclio": "mlrun/mlrun",
289
289
  "remote": "mlrun/mlrun",
290
- "dask": "mlrun/ml-base",
290
+ "dask": "mlrun/mlrun",
291
291
  "mpijob": "mlrun/mlrun",
292
292
  "application": "python",
293
293
  },
mlrun/db/base.py CHANGED
@@ -97,9 +97,6 @@ class RunDBInterface(ABC):
97
97
  uid: Optional[Union[str, list[str]]] = None,
98
98
  project: Optional[str] = None,
99
99
  labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
100
- state: Optional[
101
- mlrun.common.runtimes.constants.RunStates
102
- ] = None, # Backward compatibility
103
100
  states: Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
104
101
  sort: bool = True,
105
102
  iter: bool = False,
@@ -442,23 +439,6 @@ class RunDBInterface(ABC):
442
439
  ) -> dict:
443
440
  pass
444
441
 
445
- # TODO: remove in 1.10.0
446
- @deprecated(
447
- version="1.7.0",
448
- reason="'list_features' will be removed in 1.10.0, use 'list_features_v2' instead",
449
- category=FutureWarning,
450
- )
451
- @abstractmethod
452
- def list_features(
453
- self,
454
- project: str,
455
- name: Optional[str] = None,
456
- tag: Optional[str] = None,
457
- entities: Optional[list[str]] = None,
458
- labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
459
- ) -> mlrun.common.schemas.FeaturesOutput:
460
- pass
461
-
462
442
  @abstractmethod
463
443
  def list_features_v2(
464
444
  self,
@@ -1119,6 +1099,19 @@ class RunDBInterface(ABC):
1119
1099
  ) -> None:
1120
1100
  pass
1121
1101
 
1102
+ @abstractmethod
1103
+ def get_monitoring_function_summaries(
1104
+ self,
1105
+ project: str,
1106
+ start: Optional[datetime.datetime] = None,
1107
+ end: Optional[datetime.datetime] = None,
1108
+ names: Optional[Union[list[str], str]] = None,
1109
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
1110
+ include_stats: bool = False,
1111
+ include_infra: bool = True,
1112
+ ) -> list[mlrun.common.schemas.model_monitoring.FunctionSummary]:
1113
+ pass
1114
+
1122
1115
  @abstractmethod
1123
1116
  def get_project_summary(self, project: str) -> mlrun.common.schemas.ProjectSummary:
1124
1117
  pass
mlrun/db/httpdb.py CHANGED
@@ -50,6 +50,7 @@ from mlrun_pipelines.utils import compile_pipeline
50
50
 
51
51
  from ..artifacts import Artifact
52
52
  from ..common.schemas import AlertActivations
53
+ from ..common.schemas.model_monitoring import FunctionSummary
53
54
  from ..config import config
54
55
  from ..datastore.datastore_profile import DatastoreProfile2Json
55
56
  from ..feature_store import FeatureSet, FeatureVector
@@ -900,9 +901,6 @@ class HTTPRunDB(RunDBInterface):
900
901
  uid: Optional[Union[str, list[str]]] = None,
901
902
  project: Optional[str] = None,
902
903
  labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
903
- state: Optional[
904
- mlrun.common.runtimes.constants.RunStates
905
- ] = None, # Backward compatibility
906
904
  states: typing.Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
907
905
  sort: bool = True,
908
906
  iter: bool = False,
@@ -947,7 +945,6 @@ class HTTPRunDB(RunDBInterface):
947
945
  or just `"label"` for key existence.
948
946
  - A comma-separated string formatted as `"label1=value1,label2"` to match entities with
949
947
  the specified key-value pairs or key existence.
950
- :param state: Deprecated - List only runs whose state is specified (will be removed in 1.10.0)
951
948
  :param states: List only runs whose state is one of the provided states.
952
949
  :param sort: Whether to sort the result according to their start time. Otherwise, results will be
953
950
  returned by their internal order in the DB (order will not be guaranteed).
@@ -975,7 +972,6 @@ class HTTPRunDB(RunDBInterface):
975
972
  uid=uid,
976
973
  project=project,
977
974
  labels=labels,
978
- state=state,
979
975
  states=states,
980
976
  sort=sort,
981
977
  iter=iter,
@@ -2482,50 +2478,6 @@ class HTTPRunDB(RunDBInterface):
2482
2478
  resp = self.api_call("GET", path, error_message)
2483
2479
  return FeatureSet.from_dict(resp.json())
2484
2480
 
2485
- def list_features(
2486
- self,
2487
- project: Optional[str] = None,
2488
- name: Optional[str] = None,
2489
- tag: Optional[str] = None,
2490
- entities: Optional[list[str]] = None,
2491
- labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
2492
- ) -> list[dict]:
2493
- """List feature-sets which contain specific features. This function may return multiple versions of the same
2494
- feature-set if a specific tag is not requested. Note that the various filters of this function actually
2495
- refer to the feature-set object containing the features, not to the features themselves.
2496
-
2497
- :param project: Project which contains these features.
2498
- :param name: Name of the feature to look for. The name is used in a like query, and is not case-sensitive. For
2499
- example, looking for ``feat`` will return features which are named ``MyFeature`` as well as ``defeat``.
2500
- :param tag: Return feature-sets which contain the features looked for, and are tagged with the specific tag.
2501
- :param entities: Return only feature-sets which contain an entity whose name is contained in this list.
2502
- :param labels: Filter feature-sets by label key-value pairs or key existence. This can be provided as:
2503
- - A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
2504
- or `{"label": None}` to check for key existence.
2505
- - A list of strings formatted as `"label=value"` to match specific label key-value pairs,
2506
- or just `"label"` for key existence.
2507
- - A comma-separated string formatted as `"label1=value1,label2"` to match entities with
2508
- the specified key-value pairs or key existence.
2509
- :returns: A list of mapping from feature to a digest of the feature-set, which contains the feature-set
2510
- meta-data. Multiple entries may be returned for any specific feature due to multiple tags or versions
2511
- of the feature-set.
2512
- """
2513
-
2514
- project = project or config.active_project
2515
- labels = self._parse_labels(labels)
2516
- params = {
2517
- "name": name,
2518
- "tag": tag,
2519
- "entity": entities or [],
2520
- "label": labels,
2521
- }
2522
-
2523
- path = f"projects/{project}/features"
2524
-
2525
- error_message = f"Failed listing features, project: {project}, query: {params}"
2526
- resp = self.api_call("GET", path, error_message, params=params)
2527
- return resp.json()["features"]
2528
-
2529
2481
  def list_features_v2(
2530
2482
  self,
2531
2483
  project: Optional[str] = None,
@@ -4118,6 +4070,52 @@ class HTTPRunDB(RunDBInterface):
4118
4070
  params={**credentials, "replace_creds": replace_creds},
4119
4071
  )
4120
4072
 
4073
+ def get_monitoring_function_summaries(
4074
+ self,
4075
+ project: str,
4076
+ start: Optional[datetime] = None,
4077
+ end: Optional[datetime] = None,
4078
+ names: Optional[Union[list[str], str]] = None,
4079
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
4080
+ include_stats: bool = False,
4081
+ include_infra: bool = True,
4082
+ ) -> list[FunctionSummary]:
4083
+ """
4084
+ Get monitoring function summaries for the specified project.
4085
+
4086
+ :param project: The name of the project.
4087
+ :param start: Start time for filtering the results (optional).
4088
+ :param end: End time for filtering the results (optional).
4089
+ :param names: List of function names to filter by (optional).
4090
+ :param labels: Labels to filter by (optional).
4091
+ :param include_stats: Whether to include statistics in the response (default is False).
4092
+ :param include_infra: whether to include model monitoring infrastructure functions (default is True).
4093
+
4094
+ :return: A list of FunctionSummary objects containing information about the monitoring functions.
4095
+ """
4096
+
4097
+ path = f"projects/{project}/model-monitoring/function-summaries"
4098
+ labels = self._parse_labels(labels)
4099
+ if names and isinstance(names, str):
4100
+ names = [names]
4101
+ response = self.api_call(
4102
+ method=mlrun.common.types.HTTPMethod.GET,
4103
+ path=path,
4104
+ params={
4105
+ "start": datetime_to_iso(start),
4106
+ "end": datetime_to_iso(end),
4107
+ "name": names,
4108
+ "label": labels,
4109
+ "include-stats": include_stats,
4110
+ "include-infra": include_infra,
4111
+ },
4112
+ )
4113
+
4114
+ results = []
4115
+ for item in response.json():
4116
+ results.append(FunctionSummary(**item))
4117
+ return results
4118
+
4121
4119
  def create_hub_source(
4122
4120
  self, source: Union[dict, mlrun.common.schemas.IndexedHubSource]
4123
4121
  ):
@@ -5216,9 +5214,6 @@ class HTTPRunDB(RunDBInterface):
5216
5214
  uid: Optional[Union[str, list[str]]] = None,
5217
5215
  project: Optional[str] = None,
5218
5216
  labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
5219
- state: Optional[
5220
- mlrun.common.runtimes.constants.RunStates
5221
- ] = None, # Backward compatibility
5222
5217
  states: typing.Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
5223
5218
  sort: bool = True,
5224
5219
  iter: bool = False,
@@ -5252,20 +5247,12 @@ class HTTPRunDB(RunDBInterface):
5252
5247
  "using the `with_notifications` flag."
5253
5248
  )
5254
5249
 
5255
- if state:
5256
- # TODO: Remove this in 1.10.0
5257
- warnings.warn(
5258
- "'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
5259
- FutureWarning,
5260
- )
5261
-
5262
5250
  labels = self._parse_labels(labels)
5263
5251
 
5264
5252
  if (
5265
5253
  not name
5266
5254
  and not uid
5267
5255
  and not labels
5268
- and not state
5269
5256
  and not states
5270
5257
  and not start_time_from
5271
5258
  and not start_time_to
@@ -5286,11 +5273,7 @@ class HTTPRunDB(RunDBInterface):
5286
5273
  "name": name,
5287
5274
  "uid": uid,
5288
5275
  "label": labels,
5289
- "state": (
5290
- mlrun.utils.helpers.as_list(state)
5291
- if state is not None
5292
- else states or None
5293
- ),
5276
+ "states": states or None,
5294
5277
  "sort": bool2str(sort),
5295
5278
  "iter": bool2str(iter),
5296
5279
  "start_time_from": datetime_to_iso(start_time_from),