mlrun 1.7.2rc3__py3-none-any.whl → 1.8.0__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 (275) hide show
  1. mlrun/__init__.py +26 -22
  2. mlrun/__main__.py +15 -16
  3. mlrun/alerts/alert.py +150 -15
  4. mlrun/api/schemas/__init__.py +1 -9
  5. mlrun/artifacts/__init__.py +2 -3
  6. mlrun/artifacts/base.py +62 -19
  7. mlrun/artifacts/dataset.py +17 -17
  8. mlrun/artifacts/document.py +454 -0
  9. mlrun/artifacts/manager.py +28 -18
  10. mlrun/artifacts/model.py +91 -59
  11. mlrun/artifacts/plots.py +2 -2
  12. mlrun/common/constants.py +8 -0
  13. mlrun/common/formatters/__init__.py +1 -0
  14. mlrun/common/formatters/artifact.py +1 -1
  15. mlrun/common/formatters/feature_set.py +2 -0
  16. mlrun/common/formatters/function.py +1 -0
  17. mlrun/{model_monitoring/db/stores/v3io_kv/__init__.py → common/formatters/model_endpoint.py} +17 -0
  18. mlrun/common/formatters/pipeline.py +1 -2
  19. mlrun/common/formatters/project.py +9 -0
  20. mlrun/common/model_monitoring/__init__.py +0 -5
  21. mlrun/common/model_monitoring/helpers.py +12 -62
  22. mlrun/common/runtimes/constants.py +25 -4
  23. mlrun/common/schemas/__init__.py +9 -5
  24. mlrun/common/schemas/alert.py +114 -19
  25. mlrun/common/schemas/api_gateway.py +3 -3
  26. mlrun/common/schemas/artifact.py +22 -9
  27. mlrun/common/schemas/auth.py +8 -4
  28. mlrun/common/schemas/background_task.py +7 -7
  29. mlrun/common/schemas/client_spec.py +4 -4
  30. mlrun/common/schemas/clusterization_spec.py +2 -2
  31. mlrun/common/schemas/common.py +53 -3
  32. mlrun/common/schemas/constants.py +15 -0
  33. mlrun/common/schemas/datastore_profile.py +1 -1
  34. mlrun/common/schemas/feature_store.py +9 -9
  35. mlrun/common/schemas/frontend_spec.py +4 -4
  36. mlrun/common/schemas/function.py +10 -10
  37. mlrun/common/schemas/hub.py +1 -1
  38. mlrun/common/schemas/k8s.py +3 -3
  39. mlrun/common/schemas/memory_reports.py +3 -3
  40. mlrun/common/schemas/model_monitoring/__init__.py +4 -8
  41. mlrun/common/schemas/model_monitoring/constants.py +127 -46
  42. mlrun/common/schemas/model_monitoring/grafana.py +18 -12
  43. mlrun/common/schemas/model_monitoring/model_endpoints.py +154 -160
  44. mlrun/common/schemas/notification.py +24 -3
  45. mlrun/common/schemas/object.py +1 -1
  46. mlrun/common/schemas/pagination.py +4 -4
  47. mlrun/common/schemas/partition.py +142 -0
  48. mlrun/common/schemas/pipeline.py +3 -3
  49. mlrun/common/schemas/project.py +26 -18
  50. mlrun/common/schemas/runs.py +3 -3
  51. mlrun/common/schemas/runtime_resource.py +5 -5
  52. mlrun/common/schemas/schedule.py +1 -1
  53. mlrun/common/schemas/secret.py +1 -1
  54. mlrun/{model_monitoring/db/stores/sqldb/__init__.py → common/schemas/serving.py} +10 -1
  55. mlrun/common/schemas/tag.py +3 -3
  56. mlrun/common/schemas/workflow.py +6 -5
  57. mlrun/common/types.py +1 -0
  58. mlrun/config.py +157 -89
  59. mlrun/data_types/__init__.py +5 -3
  60. mlrun/data_types/infer.py +13 -3
  61. mlrun/data_types/spark.py +2 -1
  62. mlrun/datastore/__init__.py +59 -18
  63. mlrun/datastore/alibaba_oss.py +4 -1
  64. mlrun/datastore/azure_blob.py +4 -1
  65. mlrun/datastore/base.py +19 -24
  66. mlrun/datastore/datastore.py +10 -4
  67. mlrun/datastore/datastore_profile.py +178 -45
  68. mlrun/datastore/dbfs_store.py +4 -1
  69. mlrun/datastore/filestore.py +4 -1
  70. mlrun/datastore/google_cloud_storage.py +4 -1
  71. mlrun/datastore/hdfs.py +4 -1
  72. mlrun/datastore/inmem.py +4 -1
  73. mlrun/datastore/redis.py +4 -1
  74. mlrun/datastore/s3.py +14 -3
  75. mlrun/datastore/sources.py +89 -92
  76. mlrun/datastore/store_resources.py +7 -4
  77. mlrun/datastore/storeytargets.py +51 -16
  78. mlrun/datastore/targets.py +38 -31
  79. mlrun/datastore/utils.py +87 -4
  80. mlrun/datastore/v3io.py +4 -1
  81. mlrun/datastore/vectorstore.py +291 -0
  82. mlrun/datastore/wasbfs/fs.py +13 -12
  83. mlrun/db/base.py +286 -100
  84. mlrun/db/httpdb.py +1562 -490
  85. mlrun/db/nopdb.py +250 -83
  86. mlrun/errors.py +6 -2
  87. mlrun/execution.py +194 -50
  88. mlrun/feature_store/__init__.py +2 -10
  89. mlrun/feature_store/api.py +20 -458
  90. mlrun/feature_store/common.py +9 -9
  91. mlrun/feature_store/feature_set.py +20 -18
  92. mlrun/feature_store/feature_vector.py +105 -479
  93. mlrun/feature_store/feature_vector_utils.py +466 -0
  94. mlrun/feature_store/retrieval/base.py +15 -11
  95. mlrun/feature_store/retrieval/job.py +2 -1
  96. mlrun/feature_store/retrieval/storey_merger.py +1 -1
  97. mlrun/feature_store/steps.py +3 -3
  98. mlrun/features.py +30 -13
  99. mlrun/frameworks/__init__.py +1 -2
  100. mlrun/frameworks/_common/__init__.py +1 -2
  101. mlrun/frameworks/_common/artifacts_library.py +2 -2
  102. mlrun/frameworks/_common/mlrun_interface.py +10 -6
  103. mlrun/frameworks/_common/model_handler.py +31 -31
  104. mlrun/frameworks/_common/producer.py +3 -1
  105. mlrun/frameworks/_dl_common/__init__.py +1 -2
  106. mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
  107. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
  108. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
  109. mlrun/frameworks/_ml_common/__init__.py +1 -2
  110. mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
  111. mlrun/frameworks/_ml_common/model_handler.py +21 -21
  112. mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
  113. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
  114. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  115. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  116. mlrun/frameworks/auto_mlrun/__init__.py +1 -2
  117. mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
  118. mlrun/frameworks/huggingface/__init__.py +1 -2
  119. mlrun/frameworks/huggingface/model_server.py +9 -9
  120. mlrun/frameworks/lgbm/__init__.py +47 -44
  121. mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
  122. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
  123. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
  124. mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
  125. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
  126. mlrun/frameworks/lgbm/model_handler.py +15 -11
  127. mlrun/frameworks/lgbm/model_server.py +11 -7
  128. mlrun/frameworks/lgbm/utils.py +2 -2
  129. mlrun/frameworks/onnx/__init__.py +1 -2
  130. mlrun/frameworks/onnx/dataset.py +3 -3
  131. mlrun/frameworks/onnx/mlrun_interface.py +2 -2
  132. mlrun/frameworks/onnx/model_handler.py +7 -5
  133. mlrun/frameworks/onnx/model_server.py +8 -6
  134. mlrun/frameworks/parallel_coordinates.py +11 -11
  135. mlrun/frameworks/pytorch/__init__.py +22 -23
  136. mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
  137. mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
  138. mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
  139. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
  140. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
  141. mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
  142. mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
  143. mlrun/frameworks/pytorch/model_handler.py +21 -17
  144. mlrun/frameworks/pytorch/model_server.py +13 -9
  145. mlrun/frameworks/sklearn/__init__.py +19 -18
  146. mlrun/frameworks/sklearn/estimator.py +2 -2
  147. mlrun/frameworks/sklearn/metric.py +3 -3
  148. mlrun/frameworks/sklearn/metrics_library.py +8 -6
  149. mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
  150. mlrun/frameworks/sklearn/model_handler.py +4 -3
  151. mlrun/frameworks/tf_keras/__init__.py +11 -12
  152. mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
  153. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
  154. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
  155. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
  156. mlrun/frameworks/tf_keras/model_handler.py +17 -13
  157. mlrun/frameworks/tf_keras/model_server.py +12 -8
  158. mlrun/frameworks/xgboost/__init__.py +19 -18
  159. mlrun/frameworks/xgboost/model_handler.py +13 -9
  160. mlrun/k8s_utils.py +2 -5
  161. mlrun/launcher/base.py +3 -4
  162. mlrun/launcher/client.py +2 -2
  163. mlrun/launcher/local.py +6 -2
  164. mlrun/launcher/remote.py +1 -1
  165. mlrun/lists.py +8 -4
  166. mlrun/model.py +132 -46
  167. mlrun/model_monitoring/__init__.py +3 -5
  168. mlrun/model_monitoring/api.py +113 -98
  169. mlrun/model_monitoring/applications/__init__.py +0 -5
  170. mlrun/model_monitoring/applications/_application_steps.py +81 -50
  171. mlrun/model_monitoring/applications/base.py +467 -14
  172. mlrun/model_monitoring/applications/context.py +212 -134
  173. mlrun/model_monitoring/{db/stores/base → applications/evidently}/__init__.py +6 -2
  174. mlrun/model_monitoring/applications/evidently/base.py +146 -0
  175. mlrun/model_monitoring/applications/histogram_data_drift.py +89 -56
  176. mlrun/model_monitoring/applications/results.py +67 -15
  177. mlrun/model_monitoring/controller.py +701 -315
  178. mlrun/model_monitoring/db/__init__.py +0 -2
  179. mlrun/model_monitoring/db/_schedules.py +242 -0
  180. mlrun/model_monitoring/db/_stats.py +189 -0
  181. mlrun/model_monitoring/db/tsdb/__init__.py +33 -22
  182. mlrun/model_monitoring/db/tsdb/base.py +243 -49
  183. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +76 -36
  184. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
  185. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +213 -0
  186. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +534 -88
  187. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
  188. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +436 -106
  189. mlrun/model_monitoring/helpers.py +356 -114
  190. mlrun/model_monitoring/stream_processing.py +190 -345
  191. mlrun/model_monitoring/tracking_policy.py +11 -4
  192. mlrun/model_monitoring/writer.py +49 -90
  193. mlrun/package/__init__.py +3 -6
  194. mlrun/package/context_handler.py +2 -2
  195. mlrun/package/packager.py +12 -9
  196. mlrun/package/packagers/__init__.py +0 -2
  197. mlrun/package/packagers/default_packager.py +14 -11
  198. mlrun/package/packagers/numpy_packagers.py +16 -7
  199. mlrun/package/packagers/pandas_packagers.py +18 -18
  200. mlrun/package/packagers/python_standard_library_packagers.py +25 -11
  201. mlrun/package/packagers_manager.py +35 -32
  202. mlrun/package/utils/__init__.py +0 -3
  203. mlrun/package/utils/_pickler.py +6 -6
  204. mlrun/platforms/__init__.py +47 -16
  205. mlrun/platforms/iguazio.py +4 -1
  206. mlrun/projects/operations.py +30 -30
  207. mlrun/projects/pipelines.py +116 -47
  208. mlrun/projects/project.py +1292 -329
  209. mlrun/render.py +5 -9
  210. mlrun/run.py +57 -14
  211. mlrun/runtimes/__init__.py +1 -3
  212. mlrun/runtimes/base.py +30 -22
  213. mlrun/runtimes/daskjob.py +9 -9
  214. mlrun/runtimes/databricks_job/databricks_runtime.py +6 -5
  215. mlrun/runtimes/function_reference.py +5 -2
  216. mlrun/runtimes/generators.py +3 -2
  217. mlrun/runtimes/kubejob.py +6 -7
  218. mlrun/runtimes/mounts.py +574 -0
  219. mlrun/runtimes/mpijob/__init__.py +0 -2
  220. mlrun/runtimes/mpijob/abstract.py +7 -6
  221. mlrun/runtimes/nuclio/api_gateway.py +7 -7
  222. mlrun/runtimes/nuclio/application/application.py +11 -13
  223. mlrun/runtimes/nuclio/application/reverse_proxy.go +66 -64
  224. mlrun/runtimes/nuclio/function.py +127 -70
  225. mlrun/runtimes/nuclio/serving.py +105 -37
  226. mlrun/runtimes/pod.py +159 -54
  227. mlrun/runtimes/remotesparkjob.py +3 -2
  228. mlrun/runtimes/sparkjob/__init__.py +0 -2
  229. mlrun/runtimes/sparkjob/spark3job.py +22 -12
  230. mlrun/runtimes/utils.py +7 -6
  231. mlrun/secrets.py +2 -2
  232. mlrun/serving/__init__.py +8 -0
  233. mlrun/serving/merger.py +7 -5
  234. mlrun/serving/remote.py +35 -22
  235. mlrun/serving/routers.py +186 -240
  236. mlrun/serving/server.py +41 -10
  237. mlrun/serving/states.py +432 -118
  238. mlrun/serving/utils.py +13 -2
  239. mlrun/serving/v1_serving.py +3 -2
  240. mlrun/serving/v2_serving.py +161 -203
  241. mlrun/track/__init__.py +1 -1
  242. mlrun/track/tracker.py +2 -2
  243. mlrun/track/trackers/mlflow_tracker.py +6 -5
  244. mlrun/utils/async_http.py +35 -22
  245. mlrun/utils/clones.py +7 -4
  246. mlrun/utils/helpers.py +511 -58
  247. mlrun/utils/logger.py +119 -13
  248. mlrun/utils/notifications/notification/__init__.py +22 -19
  249. mlrun/utils/notifications/notification/base.py +39 -15
  250. mlrun/utils/notifications/notification/console.py +6 -6
  251. mlrun/utils/notifications/notification/git.py +11 -11
  252. mlrun/utils/notifications/notification/ipython.py +10 -9
  253. mlrun/utils/notifications/notification/mail.py +176 -0
  254. mlrun/utils/notifications/notification/slack.py +16 -8
  255. mlrun/utils/notifications/notification/webhook.py +24 -8
  256. mlrun/utils/notifications/notification_pusher.py +191 -200
  257. mlrun/utils/regex.py +12 -2
  258. mlrun/utils/version/version.json +2 -2
  259. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0.dist-info}/METADATA +81 -54
  260. mlrun-1.8.0.dist-info/RECORD +351 -0
  261. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0.dist-info}/WHEEL +1 -1
  262. mlrun/model_monitoring/applications/evidently_base.py +0 -137
  263. mlrun/model_monitoring/db/stores/__init__.py +0 -136
  264. mlrun/model_monitoring/db/stores/base/store.py +0 -213
  265. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -71
  266. mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -190
  267. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +0 -103
  268. mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -40
  269. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +0 -659
  270. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +0 -726
  271. mlrun/model_monitoring/model_endpoint.py +0 -118
  272. mlrun-1.7.2rc3.dist-info/RECORD +0 -351
  273. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0.dist-info}/entry_points.txt +0 -0
  274. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0.dist-info/licenses}/LICENSE +0 -0
  275. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0.dist-info}/top_level.txt +0 -0
mlrun/db/base.py CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import datetime
16
16
  from abc import ABC, abstractmethod
17
- from typing import Optional, Union
17
+ from typing import Literal, Optional, Union
18
18
 
19
19
  from deprecated import deprecated
20
20
 
@@ -23,6 +23,8 @@ import mlrun.common
23
23
  import mlrun.common.formatters
24
24
  import mlrun.common.runtimes.constants
25
25
  import mlrun.common.schemas
26
+ import mlrun.common.schemas.model_monitoring.constants as mm_constants
27
+ import mlrun.common.schemas.model_monitoring.model_endpoints as mm_endpoints
26
28
  import mlrun.model_monitoring
27
29
 
28
30
 
@@ -57,6 +59,27 @@ class RunDBInterface(ABC):
57
59
  def abort_run(self, uid, project="", iter=0, timeout=45, status_text=""):
58
60
  pass
59
61
 
62
+ @abstractmethod
63
+ def push_run_notifications(
64
+ self,
65
+ uid,
66
+ project="",
67
+ timeout=45,
68
+ ):
69
+ pass
70
+
71
+ def refresh_smtp_configuration(self):
72
+ pass
73
+
74
+ def push_pipeline_notifications(
75
+ self,
76
+ pipeline_id,
77
+ project="",
78
+ notifications=None,
79
+ timeout=45,
80
+ ):
81
+ pass
82
+
60
83
  @abstractmethod
61
84
  def read_run(
62
85
  self,
@@ -73,18 +96,19 @@ class RunDBInterface(ABC):
73
96
  name: Optional[str] = None,
74
97
  uid: Optional[Union[str, list[str]]] = None,
75
98
  project: Optional[str] = None,
76
- labels: Optional[Union[str, list[str]]] = None,
99
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
77
100
  state: Optional[
78
101
  mlrun.common.runtimes.constants.RunStates
79
102
  ] = None, # Backward compatibility
80
103
  states: Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
81
104
  sort: bool = True,
82
- last: int = 0,
83
105
  iter: bool = False,
84
- start_time_from: datetime.datetime = None,
85
- start_time_to: datetime.datetime = None,
86
- last_update_time_from: datetime.datetime = None,
87
- last_update_time_to: datetime.datetime = None,
106
+ start_time_from: Optional[datetime.datetime] = None,
107
+ start_time_to: Optional[datetime.datetime] = None,
108
+ last_update_time_from: Optional[datetime.datetime] = None,
109
+ last_update_time_to: Optional[datetime.datetime] = None,
110
+ end_time_from: Optional[datetime.datetime] = None,
111
+ end_time_to: Optional[datetime.datetime] = None,
88
112
  partition_by: Union[mlrun.common.schemas.RunPartitionByField, str] = None,
89
113
  rows_per_partition: int = 1,
90
114
  partition_sort_by: Union[mlrun.common.schemas.SortField, str] = None,
@@ -96,17 +120,41 @@ class RunDBInterface(ABC):
96
120
  ):
97
121
  pass
98
122
 
123
+ @abstractmethod
124
+ def paginated_list_runs(
125
+ self,
126
+ *args,
127
+ page: Optional[int] = None,
128
+ page_size: Optional[int] = None,
129
+ page_token: Optional[str] = None,
130
+ **kwargs,
131
+ ):
132
+ pass
133
+
99
134
  @abstractmethod
100
135
  def del_run(self, uid, project="", iter=0):
101
136
  pass
102
137
 
103
138
  @abstractmethod
104
- def del_runs(self, name="", project="", labels=None, state="", days_ago=0):
139
+ def del_runs(
140
+ self,
141
+ name: str = "",
142
+ project: str = "",
143
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
144
+ state: Optional[mlrun.common.runtimes.constants.RunStates] = None,
145
+ days_ago: int = 0,
146
+ ):
105
147
  pass
106
148
 
107
149
  @abstractmethod
108
150
  def store_artifact(
109
- self, key, artifact, uid=None, iter=None, tag="", project="", tree=None
151
+ self,
152
+ key,
153
+ artifact,
154
+ iter=None,
155
+ tag="",
156
+ project="",
157
+ tree=None,
110
158
  ):
111
159
  pass
112
160
 
@@ -126,19 +174,40 @@ class RunDBInterface(ABC):
126
174
  @abstractmethod
127
175
  def list_artifacts(
128
176
  self,
129
- name="",
130
- project="",
131
- tag="",
132
- labels=None,
177
+ name: Optional[str] = "",
178
+ project: Optional[str] = "",
179
+ tag: Optional[str] = "",
180
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
133
181
  since=None,
134
182
  until=None,
135
- iter: int = None,
183
+ iter: Optional[int] = None,
136
184
  best_iteration: bool = False,
137
- kind: str = None,
185
+ kind: Optional[str] = None,
138
186
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
139
- tree: str = None,
187
+ tree: Optional[str] = None,
140
188
  format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
141
- limit: int = None,
189
+ limit: Optional[int] = None,
190
+ partition_by: Optional[
191
+ Union[mlrun.common.schemas.ArtifactPartitionByField, str]
192
+ ] = None,
193
+ rows_per_partition: int = 1,
194
+ partition_sort_by: Optional[
195
+ Union[mlrun.common.schemas.SortField, str]
196
+ ] = mlrun.common.schemas.SortField.updated,
197
+ partition_order: Union[
198
+ mlrun.common.schemas.OrderType, str
199
+ ] = mlrun.common.schemas.OrderType.desc,
200
+ ):
201
+ pass
202
+
203
+ @abstractmethod
204
+ def paginated_list_artifacts(
205
+ self,
206
+ *args,
207
+ page: Optional[int] = None,
208
+ page_size: Optional[int] = None,
209
+ page_token: Optional[str] = None,
210
+ **kwargs,
142
211
  ):
143
212
  pass
144
213
 
@@ -153,13 +222,19 @@ class RunDBInterface(ABC):
153
222
  deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
154
223
  mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
155
224
  ),
156
- secrets: dict = None,
225
+ secrets: Optional[dict] = None,
157
226
  iter=None,
158
227
  ):
159
228
  pass
160
229
 
161
230
  @abstractmethod
162
- def del_artifacts(self, name="", project="", tag="", labels=None):
231
+ def del_artifacts(
232
+ self,
233
+ name: Optional[str] = "",
234
+ project: Optional[str] = "",
235
+ tag: Optional[str] = "",
236
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
237
+ ):
163
238
  pass
164
239
 
165
240
  @abstractmethod
@@ -176,7 +251,27 @@ class RunDBInterface(ABC):
176
251
 
177
252
  @abstractmethod
178
253
  def list_functions(
179
- self, name=None, project="", tag="", labels=None, since=None, until=None
254
+ self,
255
+ name: Optional[str] = None,
256
+ project: Optional[str] = None,
257
+ tag: Optional[str] = None,
258
+ kind: Optional[str] = None,
259
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
260
+ states: Optional[list[mlrun.common.schemas.FunctionState]] = None,
261
+ format_: mlrun.common.formatters.FunctionFormat = mlrun.common.formatters.FunctionFormat.full,
262
+ since: Optional[datetime.datetime] = None,
263
+ until: Optional[datetime.datetime] = None,
264
+ ):
265
+ pass
266
+
267
+ @abstractmethod
268
+ def paginated_list_functions(
269
+ self,
270
+ *args,
271
+ page: Optional[int] = None,
272
+ page_size: Optional[int] = None,
273
+ page_token: Optional[str] = None,
274
+ **kwargs,
180
275
  ):
181
276
  pass
182
277
 
@@ -254,6 +349,23 @@ class RunDBInterface(ABC):
254
349
  kind="artifact", identifiers=artifact_identifiers
255
350
  )
256
351
 
352
+ def get_model_endpoint_monitoring_metrics(
353
+ self,
354
+ project: str,
355
+ endpoint_id: str,
356
+ type: Literal["results", "metrics", "all"] = "all",
357
+ ) -> list[mm_endpoints.ModelEndpointMonitoringMetric]:
358
+ pass
359
+
360
+ def get_metrics_by_multiple_endpoints(
361
+ self,
362
+ project: str,
363
+ endpoint_ids: Union[str, list[str]],
364
+ type: Literal["results", "metrics", "all"] = "all",
365
+ events_format: mm_constants.GetEventsFormat = mm_constants.GetEventsFormat.SEPARATION,
366
+ ) -> dict[str, list[mm_endpoints.ModelEndpointMonitoringMetric]]:
367
+ pass
368
+
257
369
  @abstractmethod
258
370
  def delete_project(
259
371
  self,
@@ -289,15 +401,17 @@ class RunDBInterface(ABC):
289
401
  @abstractmethod
290
402
  def list_projects(
291
403
  self,
292
- owner: str = None,
404
+ owner: Optional[str] = None,
293
405
  format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
294
- labels: list[str] = None,
406
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
295
407
  state: mlrun.common.schemas.ProjectState = None,
296
408
  ) -> mlrun.common.schemas.ProjectsOutput:
297
409
  pass
298
410
 
299
411
  @abstractmethod
300
- def get_project(self, name: str) -> mlrun.common.schemas.Project:
412
+ def get_project(
413
+ self, name: str
414
+ ) -> Union[mlrun.common.schemas.Project, "mlrun.MlrunProject"]:
301
415
  pass
302
416
 
303
417
  @abstractmethod
@@ -319,24 +433,28 @@ class RunDBInterface(ABC):
319
433
 
320
434
  @abstractmethod
321
435
  def get_feature_set(
322
- self, name: str, project: str = "", tag: str = None, uid: str = None
436
+ self,
437
+ name: str,
438
+ project: str = "",
439
+ tag: Optional[str] = None,
440
+ uid: Optional[str] = None,
323
441
  ) -> dict:
324
442
  pass
325
443
 
326
- # TODO: remove in 1.9.0
444
+ # TODO: remove in 1.10.0
327
445
  @deprecated(
328
- version="1.9.0",
329
- reason="'list_features' will be removed in 1.9.0, use 'list_features_v2' instead",
446
+ version="1.7.0",
447
+ reason="'list_features' will be removed in 1.10.0, use 'list_features_v2' instead",
330
448
  category=FutureWarning,
331
449
  )
332
450
  @abstractmethod
333
451
  def list_features(
334
452
  self,
335
453
  project: str,
336
- name: str = None,
337
- tag: str = None,
338
- entities: list[str] = None,
339
- labels: list[str] = None,
454
+ name: Optional[str] = None,
455
+ tag: Optional[str] = None,
456
+ entities: Optional[list[str]] = None,
457
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
340
458
  ) -> mlrun.common.schemas.FeaturesOutput:
341
459
  pass
342
460
 
@@ -344,26 +462,26 @@ class RunDBInterface(ABC):
344
462
  def list_features_v2(
345
463
  self,
346
464
  project: str,
347
- name: str = None,
348
- tag: str = None,
349
- entities: list[str] = None,
350
- labels: list[str] = None,
465
+ name: Optional[str] = None,
466
+ tag: Optional[str] = None,
467
+ entities: Optional[list[str]] = None,
468
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
351
469
  ) -> mlrun.common.schemas.FeaturesOutputV2:
352
470
  pass
353
471
 
354
- # TODO: remove in 1.9.0
472
+ # TODO: remove in 1.10.0
355
473
  @deprecated(
356
- version="1.9.0",
357
- reason="'list_entities' will be removed in 1.9.0, use 'list_entities_v2' instead",
474
+ version="1.7.0",
475
+ reason="'list_entities' will be removed in 1.10.0, use 'list_entities_v2' instead",
358
476
  category=FutureWarning,
359
477
  )
360
478
  @abstractmethod
361
479
  def list_entities(
362
480
  self,
363
481
  project: str,
364
- name: str = None,
365
- tag: str = None,
366
- labels: list[str] = None,
482
+ name: Optional[str] = None,
483
+ tag: Optional[str] = None,
484
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
367
485
  ) -> mlrun.common.schemas.EntitiesOutput:
368
486
  pass
369
487
 
@@ -371,9 +489,9 @@ class RunDBInterface(ABC):
371
489
  def list_entities_v2(
372
490
  self,
373
491
  project: str,
374
- name: str = None,
375
- tag: str = None,
376
- labels: list[str] = None,
492
+ name: Optional[str] = None,
493
+ tag: Optional[str] = None,
494
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
377
495
  ) -> mlrun.common.schemas.EntitiesOutputV2:
378
496
  pass
379
497
 
@@ -381,12 +499,12 @@ class RunDBInterface(ABC):
381
499
  def list_feature_sets(
382
500
  self,
383
501
  project: str = "",
384
- name: str = None,
385
- tag: str = None,
386
- state: str = None,
387
- entities: list[str] = None,
388
- features: list[str] = None,
389
- labels: list[str] = None,
502
+ name: Optional[str] = None,
503
+ tag: Optional[str] = None,
504
+ state: Optional[str] = None,
505
+ entities: Optional[list[str]] = None,
506
+ features: Optional[list[str]] = None,
507
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
390
508
  partition_by: Union[
391
509
  mlrun.common.schemas.FeatureStorePartitionByField, str
392
510
  ] = None,
@@ -442,7 +560,11 @@ class RunDBInterface(ABC):
442
560
 
443
561
  @abstractmethod
444
562
  def get_feature_vector(
445
- self, name: str, project: str = "", tag: str = None, uid: str = None
563
+ self,
564
+ name: str,
565
+ project: str = "",
566
+ tag: Optional[str] = None,
567
+ uid: Optional[str] = None,
446
568
  ) -> dict:
447
569
  pass
448
570
 
@@ -450,10 +572,10 @@ class RunDBInterface(ABC):
450
572
  def list_feature_vectors(
451
573
  self,
452
574
  project: str = "",
453
- name: str = None,
454
- tag: str = None,
455
- state: str = None,
456
- labels: list[str] = None,
575
+ name: Optional[str] = None,
576
+ tag: Optional[str] = None,
577
+ state: Optional[str] = None,
578
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
457
579
  partition_by: Union[
458
580
  mlrun.common.schemas.FeatureStorePartitionByField, str
459
581
  ] = None,
@@ -499,12 +621,12 @@ class RunDBInterface(ABC):
499
621
  def get_pipeline(
500
622
  self,
501
623
  run_id: str,
502
- namespace: str = None,
624
+ namespace: Optional[str] = None,
503
625
  timeout: int = 30,
504
626
  format_: Union[
505
627
  str, mlrun.common.formatters.PipelineFormat
506
628
  ] = mlrun.common.formatters.PipelineFormat.summary,
507
- project: str = None,
629
+ project: Optional[str] = None,
508
630
  ):
509
631
  pass
510
632
 
@@ -512,14 +634,14 @@ class RunDBInterface(ABC):
512
634
  def list_pipelines(
513
635
  self,
514
636
  project: str,
515
- namespace: str = None,
637
+ namespace: Optional[str] = None,
516
638
  sort_by: str = "",
517
639
  page_token: str = "",
518
640
  filter_: str = "",
519
641
  format_: Union[
520
642
  str, mlrun.common.formatters.PipelineFormat
521
643
  ] = mlrun.common.formatters.PipelineFormat.metadata_only,
522
- page_size: int = None,
644
+ page_size: Optional[int] = None,
523
645
  ) -> mlrun.common.schemas.PipelinesOutput:
524
646
  pass
525
647
 
@@ -530,7 +652,7 @@ class RunDBInterface(ABC):
530
652
  provider: Union[
531
653
  str, mlrun.common.schemas.SecretProviderName
532
654
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
533
- secrets: dict = None,
655
+ secrets: Optional[dict] = None,
534
656
  ):
535
657
  pass
536
658
 
@@ -542,7 +664,7 @@ class RunDBInterface(ABC):
542
664
  provider: Union[
543
665
  str, mlrun.common.schemas.SecretProviderName
544
666
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
545
- secrets: list[str] = None,
667
+ secrets: Optional[list[str]] = None,
546
668
  ) -> mlrun.common.schemas.SecretsData:
547
669
  pass
548
670
 
@@ -553,7 +675,7 @@ class RunDBInterface(ABC):
553
675
  provider: Union[
554
676
  str, mlrun.common.schemas.SecretProviderName
555
677
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
556
- token: str = None,
678
+ token: Optional[str] = None,
557
679
  ) -> mlrun.common.schemas.SecretKeysData:
558
680
  pass
559
681
 
@@ -564,7 +686,7 @@ class RunDBInterface(ABC):
564
686
  provider: Union[
565
687
  str, mlrun.common.schemas.SecretProviderName
566
688
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
567
- secrets: list[str] = None,
689
+ secrets: Optional[list[str]] = None,
568
690
  ):
569
691
  pass
570
692
 
@@ -575,24 +697,28 @@ class RunDBInterface(ABC):
575
697
  provider: Union[
576
698
  str, mlrun.common.schemas.SecretProviderName
577
699
  ] = mlrun.common.schemas.SecretProviderName.vault,
578
- secrets: dict = None,
700
+ secrets: Optional[dict] = None,
579
701
  ):
580
702
  pass
581
703
 
582
704
  @abstractmethod
583
705
  def create_model_endpoint(
584
706
  self,
585
- project: str,
586
- endpoint_id: str,
587
- model_endpoint: Union[mlrun.model_monitoring.ModelEndpoint, dict],
588
- ):
707
+ model_endpoint: mlrun.common.schemas.ModelEndpoint,
708
+ creation_strategy: Optional[
709
+ mm_constants.ModelEndpointCreationStrategy
710
+ ] = mm_constants.ModelEndpointCreationStrategy.INPLACE,
711
+ ) -> mlrun.common.schemas.ModelEndpoint:
589
712
  pass
590
713
 
591
714
  @abstractmethod
592
715
  def delete_model_endpoint(
593
716
  self,
717
+ name: str,
594
718
  project: str,
595
- endpoint_id: str,
719
+ function_name: Optional[str] = None,
720
+ function_tag: Optional[str] = None,
721
+ endpoint_id: Optional[str] = None,
596
722
  ):
597
723
  pass
598
724
 
@@ -600,34 +726,46 @@ class RunDBInterface(ABC):
600
726
  def list_model_endpoints(
601
727
  self,
602
728
  project: str,
603
- model: Optional[str] = None,
604
- function: Optional[str] = None,
605
- labels: list[str] = None,
606
- start: str = "now-1h",
607
- end: str = "now",
608
- metrics: Optional[list[str]] = None,
609
- ):
729
+ names: Optional[Union[str, list[str]]] = None,
730
+ function_name: Optional[str] = None,
731
+ function_tag: Optional[str] = None,
732
+ model_name: Optional[str] = None,
733
+ model_tag: Optional[str] = None,
734
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
735
+ start: Optional[datetime.datetime] = None,
736
+ end: Optional[datetime.datetime] = None,
737
+ tsdb_metrics: bool = False,
738
+ metric_list: Optional[list[str]] = None,
739
+ top_level: bool = False,
740
+ uids: Optional[list[str]] = None,
741
+ latest_only: bool = False,
742
+ ) -> mlrun.common.schemas.ModelEndpointList:
610
743
  pass
611
744
 
612
745
  @abstractmethod
613
746
  def get_model_endpoint(
614
747
  self,
748
+ name: str,
615
749
  project: str,
616
- endpoint_id: str,
617
- start: Optional[str] = None,
618
- end: Optional[str] = None,
619
- metrics: Optional[list[str]] = None,
620
- features: bool = False,
621
- ) -> mlrun.model_monitoring.ModelEndpoint:
750
+ function_name: Optional[str] = None,
751
+ function_tag: Optional[str] = None,
752
+ endpoint_id: Optional[str] = None,
753
+ tsdb_metrics: bool = True,
754
+ metric_list: Optional[list[str]] = None,
755
+ feature_analysis: bool = False,
756
+ ) -> mlrun.common.schemas.ModelEndpoint:
622
757
  pass
623
758
 
624
759
  @abstractmethod
625
760
  def patch_model_endpoint(
626
761
  self,
762
+ name: str,
627
763
  project: str,
628
- endpoint_id: str,
629
764
  attributes: dict,
630
- ):
765
+ function_name: Optional[str] = None,
766
+ function_tag: Optional[str] = None,
767
+ endpoint_id: Optional[str] = None,
768
+ ) -> mlrun.common.schemas.ModelEndpoint:
631
769
  pass
632
770
 
633
771
  @abstractmethod
@@ -665,8 +803,8 @@ class RunDBInterface(ABC):
665
803
  def get_hub_catalog(
666
804
  self,
667
805
  source_name: str,
668
- version: str = None,
669
- tag: str = None,
806
+ version: Optional[str] = None,
807
+ tag: Optional[str] = None,
670
808
  force_refresh: bool = False,
671
809
  ):
672
810
  pass
@@ -676,7 +814,7 @@ class RunDBInterface(ABC):
676
814
  self,
677
815
  source_name: str,
678
816
  item_name: str,
679
- version: str = None,
817
+ version: Optional[str] = None,
680
818
  tag: str = "latest",
681
819
  force_refresh: bool = False,
682
820
  ):
@@ -744,6 +882,7 @@ class RunDBInterface(ABC):
744
882
  alert_name: str,
745
883
  alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
746
884
  project="",
885
+ force_reset: bool = False,
747
886
  ):
748
887
  pass
749
888
 
@@ -752,7 +891,9 @@ class RunDBInterface(ABC):
752
891
  pass
753
892
 
754
893
  @abstractmethod
755
- def list_alerts_configs(self, project=""):
894
+ def list_alerts_configs(
895
+ self, project="", limit: Optional[int] = None, offset: Optional[int] = None
896
+ ):
756
897
  pass
757
898
 
758
899
  @abstractmethod
@@ -771,6 +912,51 @@ class RunDBInterface(ABC):
771
912
  def list_alert_templates(self):
772
913
  pass
773
914
 
915
+ @abstractmethod
916
+ def list_alert_activations(
917
+ self,
918
+ project: Optional[str] = None,
919
+ name: Optional[str] = None,
920
+ since: Optional[datetime.datetime] = None,
921
+ until: Optional[datetime.datetime] = None,
922
+ entity: Optional[str] = None,
923
+ severity: Optional[
924
+ list[Union[mlrun.common.schemas.alert.AlertSeverity, str]]
925
+ ] = None,
926
+ entity_kind: Optional[
927
+ Union[mlrun.common.schemas.alert.EventEntityKind, str]
928
+ ] = None,
929
+ event_kind: Optional[Union[mlrun.common.schemas.alert.EventKind, str]] = None,
930
+ ):
931
+ pass
932
+
933
+ @abstractmethod
934
+ def paginated_list_alert_activations(
935
+ self,
936
+ *args,
937
+ page: Optional[int] = None,
938
+ page_size: Optional[int] = None,
939
+ page_token: Optional[str] = None,
940
+ **kwargs,
941
+ ):
942
+ pass
943
+
944
+ @abstractmethod
945
+ def get_alert_activation(
946
+ self,
947
+ project,
948
+ activation_id,
949
+ ) -> mlrun.common.schemas.AlertActivation:
950
+ pass
951
+
952
+ def update_alert_activation(
953
+ self,
954
+ activation_id: int,
955
+ activation_time: datetime.datetime,
956
+ notifications_states,
957
+ ):
958
+ pass
959
+
774
960
  @abstractmethod
775
961
  def get_builder_status(
776
962
  self,
@@ -779,6 +965,7 @@ class RunDBInterface(ABC):
779
965
  logs: bool = True,
780
966
  last_log_timestamp: float = 0.0,
781
967
  verbose: bool = False,
968
+ events_offset: int = 0,
782
969
  ):
783
970
  pass
784
971
 
@@ -805,7 +992,7 @@ class RunDBInterface(ABC):
805
992
  self,
806
993
  notification_objects: list[mlrun.model.Notification],
807
994
  run_uid: str,
808
- project: str = None,
995
+ project: Optional[str] = None,
809
996
  mask_params: bool = True,
810
997
  ):
811
998
  pass
@@ -859,7 +1046,9 @@ class RunDBInterface(ABC):
859
1046
 
860
1047
  @abstractmethod
861
1048
  def start_function(
862
- self, func_url: str = None, function: "mlrun.runtimes.BaseRuntime" = None
1049
+ self,
1050
+ func_url: Optional[str] = None,
1051
+ function: "mlrun.runtimes.BaseRuntime" = None,
863
1052
  ):
864
1053
  pass
865
1054
 
@@ -878,7 +1067,7 @@ class RunDBInterface(ABC):
878
1067
  source: Optional[str] = None,
879
1068
  run_name: Optional[str] = None,
880
1069
  namespace: Optional[str] = None,
881
- notifications: list["mlrun.model.Notification"] = None,
1070
+ notifications: Optional[list["mlrun.model.Notification"]] = None,
882
1071
  ) -> "mlrun.common.schemas.WorkflowResponse":
883
1072
  pass
884
1073
 
@@ -898,7 +1087,6 @@ class RunDBInterface(ABC):
898
1087
  base_period: int = 10,
899
1088
  image: str = "mlrun/mlrun",
900
1089
  deploy_histogram_data_drift_app: bool = True,
901
- rebuild_images: bool = False,
902
1090
  fetch_credentials_from_sys_config: bool = False,
903
1091
  ) -> None:
904
1092
  pass
@@ -911,7 +1099,7 @@ class RunDBInterface(ABC):
911
1099
  delete_stream_function: bool = False,
912
1100
  delete_histogram_data_drift_app: bool = True,
913
1101
  delete_user_applications: bool = False,
914
- user_application_list: list[str] = None,
1102
+ user_application_list: Optional[list[str]] = None,
915
1103
  ) -> bool:
916
1104
  pass
917
1105
 
@@ -921,17 +1109,15 @@ class RunDBInterface(ABC):
921
1109
  ) -> bool:
922
1110
  pass
923
1111
 
924
- @abstractmethod
925
- def deploy_histogram_data_drift_app(
926
- self, project: str, image: str = "mlrun/mlrun"
927
- ) -> None:
928
- pass
929
-
930
1112
  @abstractmethod
931
1113
  def set_model_monitoring_credentials(
932
1114
  self,
933
1115
  project: str,
934
- credentials: dict[str, str],
1116
+ credentials: dict[str, Optional[str]],
935
1117
  replace_creds: bool,
936
1118
  ) -> None:
937
1119
  pass
1120
+
1121
+ @abstractmethod
1122
+ def get_project_summary(self, project: str) -> mlrun.common.schemas.ProjectSummary:
1123
+ pass