mlrun 1.7.0rc4__py3-none-any.whl → 1.7.2__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 (235) hide show
  1. mlrun/__init__.py +11 -1
  2. mlrun/__main__.py +39 -121
  3. mlrun/{datastore/helpers.py → alerts/__init__.py} +2 -5
  4. mlrun/alerts/alert.py +248 -0
  5. mlrun/api/schemas/__init__.py +4 -3
  6. mlrun/artifacts/__init__.py +8 -3
  7. mlrun/artifacts/base.py +39 -254
  8. mlrun/artifacts/dataset.py +9 -190
  9. mlrun/artifacts/manager.py +73 -46
  10. mlrun/artifacts/model.py +30 -158
  11. mlrun/artifacts/plots.py +23 -380
  12. mlrun/common/constants.py +73 -1
  13. mlrun/common/db/sql_session.py +3 -2
  14. mlrun/common/formatters/__init__.py +21 -0
  15. mlrun/common/formatters/artifact.py +46 -0
  16. mlrun/common/formatters/base.py +113 -0
  17. mlrun/common/formatters/feature_set.py +44 -0
  18. mlrun/common/formatters/function.py +46 -0
  19. mlrun/common/formatters/pipeline.py +53 -0
  20. mlrun/common/formatters/project.py +51 -0
  21. mlrun/common/formatters/run.py +29 -0
  22. mlrun/common/helpers.py +11 -1
  23. mlrun/{runtimes → common/runtimes}/constants.py +32 -4
  24. mlrun/common/schemas/__init__.py +31 -4
  25. mlrun/common/schemas/alert.py +202 -0
  26. mlrun/common/schemas/api_gateway.py +196 -0
  27. mlrun/common/schemas/artifact.py +28 -1
  28. mlrun/common/schemas/auth.py +13 -2
  29. mlrun/common/schemas/client_spec.py +2 -1
  30. mlrun/common/schemas/common.py +7 -4
  31. mlrun/common/schemas/constants.py +3 -0
  32. mlrun/common/schemas/feature_store.py +58 -28
  33. mlrun/common/schemas/frontend_spec.py +8 -0
  34. mlrun/common/schemas/function.py +11 -0
  35. mlrun/common/schemas/hub.py +7 -9
  36. mlrun/common/schemas/model_monitoring/__init__.py +21 -4
  37. mlrun/common/schemas/model_monitoring/constants.py +136 -42
  38. mlrun/common/schemas/model_monitoring/grafana.py +9 -5
  39. mlrun/common/schemas/model_monitoring/model_endpoints.py +89 -41
  40. mlrun/common/schemas/notification.py +69 -12
  41. mlrun/{runtimes/mpijob/v1alpha1.py → common/schemas/pagination.py} +10 -13
  42. mlrun/common/schemas/pipeline.py +7 -0
  43. mlrun/common/schemas/project.py +67 -16
  44. mlrun/common/schemas/runs.py +17 -0
  45. mlrun/common/schemas/schedule.py +1 -1
  46. mlrun/common/schemas/workflow.py +10 -2
  47. mlrun/common/types.py +14 -1
  48. mlrun/config.py +233 -58
  49. mlrun/data_types/data_types.py +11 -1
  50. mlrun/data_types/spark.py +5 -4
  51. mlrun/data_types/to_pandas.py +75 -34
  52. mlrun/datastore/__init__.py +8 -10
  53. mlrun/datastore/alibaba_oss.py +131 -0
  54. mlrun/datastore/azure_blob.py +131 -43
  55. mlrun/datastore/base.py +107 -47
  56. mlrun/datastore/datastore.py +17 -7
  57. mlrun/datastore/datastore_profile.py +91 -7
  58. mlrun/datastore/dbfs_store.py +3 -7
  59. mlrun/datastore/filestore.py +1 -3
  60. mlrun/datastore/google_cloud_storage.py +92 -32
  61. mlrun/datastore/hdfs.py +5 -0
  62. mlrun/datastore/inmem.py +6 -3
  63. mlrun/datastore/redis.py +3 -2
  64. mlrun/datastore/s3.py +30 -12
  65. mlrun/datastore/snowflake_utils.py +45 -0
  66. mlrun/datastore/sources.py +274 -59
  67. mlrun/datastore/spark_utils.py +30 -0
  68. mlrun/datastore/store_resources.py +9 -7
  69. mlrun/datastore/storeytargets.py +151 -0
  70. mlrun/datastore/targets.py +387 -119
  71. mlrun/datastore/utils.py +68 -5
  72. mlrun/datastore/v3io.py +28 -50
  73. mlrun/db/auth_utils.py +152 -0
  74. mlrun/db/base.py +245 -20
  75. mlrun/db/factory.py +1 -4
  76. mlrun/db/httpdb.py +909 -231
  77. mlrun/db/nopdb.py +279 -14
  78. mlrun/errors.py +35 -5
  79. mlrun/execution.py +111 -38
  80. mlrun/feature_store/__init__.py +0 -2
  81. mlrun/feature_store/api.py +46 -53
  82. mlrun/feature_store/common.py +6 -11
  83. mlrun/feature_store/feature_set.py +48 -23
  84. mlrun/feature_store/feature_vector.py +13 -2
  85. mlrun/feature_store/ingestion.py +7 -6
  86. mlrun/feature_store/retrieval/base.py +9 -4
  87. mlrun/feature_store/retrieval/dask_merger.py +2 -0
  88. mlrun/feature_store/retrieval/job.py +13 -4
  89. mlrun/feature_store/retrieval/local_merger.py +2 -0
  90. mlrun/feature_store/retrieval/spark_merger.py +24 -32
  91. mlrun/feature_store/steps.py +38 -19
  92. mlrun/features.py +6 -14
  93. mlrun/frameworks/_common/plan.py +3 -3
  94. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +7 -12
  95. mlrun/frameworks/_ml_common/plan.py +1 -1
  96. mlrun/frameworks/auto_mlrun/auto_mlrun.py +2 -2
  97. mlrun/frameworks/lgbm/__init__.py +1 -1
  98. mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
  99. mlrun/frameworks/lgbm/model_handler.py +1 -1
  100. mlrun/frameworks/parallel_coordinates.py +4 -4
  101. mlrun/frameworks/pytorch/__init__.py +2 -2
  102. mlrun/frameworks/sklearn/__init__.py +1 -1
  103. mlrun/frameworks/sklearn/mlrun_interface.py +13 -3
  104. mlrun/frameworks/tf_keras/__init__.py +5 -2
  105. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +1 -1
  106. mlrun/frameworks/tf_keras/mlrun_interface.py +2 -2
  107. mlrun/frameworks/xgboost/__init__.py +1 -1
  108. mlrun/k8s_utils.py +57 -12
  109. mlrun/launcher/__init__.py +1 -1
  110. mlrun/launcher/base.py +6 -5
  111. mlrun/launcher/client.py +13 -11
  112. mlrun/launcher/factory.py +1 -1
  113. mlrun/launcher/local.py +15 -5
  114. mlrun/launcher/remote.py +10 -3
  115. mlrun/lists.py +6 -2
  116. mlrun/model.py +297 -48
  117. mlrun/model_monitoring/__init__.py +1 -1
  118. mlrun/model_monitoring/api.py +152 -357
  119. mlrun/model_monitoring/applications/__init__.py +10 -0
  120. mlrun/model_monitoring/applications/_application_steps.py +190 -0
  121. mlrun/model_monitoring/applications/base.py +108 -0
  122. mlrun/model_monitoring/applications/context.py +341 -0
  123. mlrun/model_monitoring/{evidently_application.py → applications/evidently_base.py} +27 -22
  124. mlrun/model_monitoring/applications/histogram_data_drift.py +227 -91
  125. mlrun/model_monitoring/applications/results.py +99 -0
  126. mlrun/model_monitoring/controller.py +130 -303
  127. mlrun/model_monitoring/{stores/models/sqlite.py → db/__init__.py} +5 -10
  128. mlrun/model_monitoring/db/stores/__init__.py +136 -0
  129. mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
  130. mlrun/model_monitoring/db/stores/base/store.py +213 -0
  131. mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
  132. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
  133. mlrun/model_monitoring/db/stores/sqldb/models/base.py +190 -0
  134. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +103 -0
  135. mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
  136. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +659 -0
  137. mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
  138. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +726 -0
  139. mlrun/model_monitoring/db/tsdb/__init__.py +105 -0
  140. mlrun/model_monitoring/db/tsdb/base.py +448 -0
  141. mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
  142. mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
  143. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +298 -0
  144. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +42 -0
  145. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +522 -0
  146. mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
  147. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +158 -0
  148. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +849 -0
  149. mlrun/model_monitoring/features_drift_table.py +34 -22
  150. mlrun/model_monitoring/helpers.py +177 -39
  151. mlrun/model_monitoring/model_endpoint.py +3 -2
  152. mlrun/model_monitoring/stream_processing.py +165 -398
  153. mlrun/model_monitoring/tracking_policy.py +7 -1
  154. mlrun/model_monitoring/writer.py +161 -125
  155. mlrun/package/packagers/default_packager.py +2 -2
  156. mlrun/package/packagers_manager.py +1 -0
  157. mlrun/package/utils/_formatter.py +2 -2
  158. mlrun/platforms/__init__.py +11 -10
  159. mlrun/platforms/iguazio.py +67 -228
  160. mlrun/projects/__init__.py +6 -1
  161. mlrun/projects/operations.py +47 -20
  162. mlrun/projects/pipelines.py +396 -249
  163. mlrun/projects/project.py +1176 -406
  164. mlrun/render.py +28 -22
  165. mlrun/run.py +208 -181
  166. mlrun/runtimes/__init__.py +76 -11
  167. mlrun/runtimes/base.py +54 -24
  168. mlrun/runtimes/daskjob.py +9 -2
  169. mlrun/runtimes/databricks_job/databricks_runtime.py +1 -0
  170. mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
  171. mlrun/runtimes/funcdoc.py +1 -29
  172. mlrun/runtimes/kubejob.py +34 -128
  173. mlrun/runtimes/local.py +39 -10
  174. mlrun/runtimes/mpijob/__init__.py +0 -20
  175. mlrun/runtimes/mpijob/abstract.py +8 -8
  176. mlrun/runtimes/mpijob/v1.py +1 -1
  177. mlrun/runtimes/nuclio/__init__.py +1 -0
  178. mlrun/runtimes/nuclio/api_gateway.py +769 -0
  179. mlrun/runtimes/nuclio/application/__init__.py +15 -0
  180. mlrun/runtimes/nuclio/application/application.py +758 -0
  181. mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
  182. mlrun/runtimes/nuclio/function.py +188 -68
  183. mlrun/runtimes/nuclio/serving.py +57 -60
  184. mlrun/runtimes/pod.py +191 -58
  185. mlrun/runtimes/remotesparkjob.py +11 -8
  186. mlrun/runtimes/sparkjob/spark3job.py +17 -18
  187. mlrun/runtimes/utils.py +40 -73
  188. mlrun/secrets.py +6 -2
  189. mlrun/serving/__init__.py +8 -1
  190. mlrun/serving/remote.py +2 -3
  191. mlrun/serving/routers.py +89 -64
  192. mlrun/serving/server.py +54 -26
  193. mlrun/serving/states.py +187 -56
  194. mlrun/serving/utils.py +19 -11
  195. mlrun/serving/v2_serving.py +136 -63
  196. mlrun/track/tracker.py +2 -1
  197. mlrun/track/trackers/mlflow_tracker.py +5 -0
  198. mlrun/utils/async_http.py +26 -6
  199. mlrun/utils/db.py +18 -0
  200. mlrun/utils/helpers.py +375 -105
  201. mlrun/utils/http.py +2 -2
  202. mlrun/utils/logger.py +75 -9
  203. mlrun/utils/notifications/notification/__init__.py +14 -10
  204. mlrun/utils/notifications/notification/base.py +48 -0
  205. mlrun/utils/notifications/notification/console.py +2 -0
  206. mlrun/utils/notifications/notification/git.py +24 -1
  207. mlrun/utils/notifications/notification/ipython.py +2 -0
  208. mlrun/utils/notifications/notification/slack.py +96 -21
  209. mlrun/utils/notifications/notification/webhook.py +63 -2
  210. mlrun/utils/notifications/notification_pusher.py +146 -16
  211. mlrun/utils/regex.py +9 -0
  212. mlrun/utils/retryer.py +3 -2
  213. mlrun/utils/v3io_clients.py +2 -3
  214. mlrun/utils/version/version.json +2 -2
  215. mlrun-1.7.2.dist-info/METADATA +390 -0
  216. mlrun-1.7.2.dist-info/RECORD +351 -0
  217. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.2.dist-info}/WHEEL +1 -1
  218. mlrun/feature_store/retrieval/conversion.py +0 -271
  219. mlrun/kfpops.py +0 -868
  220. mlrun/model_monitoring/application.py +0 -310
  221. mlrun/model_monitoring/batch.py +0 -974
  222. mlrun/model_monitoring/controller_handler.py +0 -37
  223. mlrun/model_monitoring/prometheus.py +0 -216
  224. mlrun/model_monitoring/stores/__init__.py +0 -111
  225. mlrun/model_monitoring/stores/kv_model_endpoint_store.py +0 -574
  226. mlrun/model_monitoring/stores/model_endpoint_store.py +0 -145
  227. mlrun/model_monitoring/stores/models/__init__.py +0 -27
  228. mlrun/model_monitoring/stores/models/base.py +0 -84
  229. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
  230. mlrun/platforms/other.py +0 -305
  231. mlrun-1.7.0rc4.dist-info/METADATA +0 -269
  232. mlrun-1.7.0rc4.dist-info/RECORD +0 -321
  233. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.2.dist-info}/LICENSE +0 -0
  234. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.2.dist-info}/entry_points.txt +0 -0
  235. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.2.dist-info}/top_level.txt +0 -0
mlrun/db/base.py CHANGED
@@ -16,8 +16,14 @@ import datetime
16
16
  from abc import ABC, abstractmethod
17
17
  from typing import Optional, Union
18
18
 
19
+ from deprecated import deprecated
20
+
21
+ import mlrun.alerts
22
+ import mlrun.common
23
+ import mlrun.common.formatters
24
+ import mlrun.common.runtimes.constants
19
25
  import mlrun.common.schemas
20
- import mlrun.model_monitoring.model_endpoint
26
+ import mlrun.model_monitoring
21
27
 
22
28
 
23
29
  class RunDBError(Exception):
@@ -52,7 +58,13 @@ class RunDBInterface(ABC):
52
58
  pass
53
59
 
54
60
  @abstractmethod
55
- def read_run(self, uid, project="", iter=0):
61
+ def read_run(
62
+ self,
63
+ uid: str,
64
+ project: str = "",
65
+ iter: int = 0,
66
+ format_: mlrun.common.formatters.RunFormat = mlrun.common.formatters.RunFormat.full,
67
+ ):
56
68
  pass
57
69
 
58
70
  @abstractmethod
@@ -62,7 +74,10 @@ class RunDBInterface(ABC):
62
74
  uid: Optional[Union[str, list[str]]] = None,
63
75
  project: Optional[str] = None,
64
76
  labels: Optional[Union[str, list[str]]] = None,
65
- state: Optional[str] = None,
77
+ state: Optional[
78
+ mlrun.common.runtimes.constants.RunStates
79
+ ] = None, # Backward compatibility
80
+ states: Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
66
81
  sort: bool = True,
67
82
  last: int = 0,
68
83
  iter: bool = False,
@@ -96,7 +111,16 @@ class RunDBInterface(ABC):
96
111
  pass
97
112
 
98
113
  @abstractmethod
99
- def read_artifact(self, key, tag="", iter=None, project="", tree=None, uid=None):
114
+ def read_artifact(
115
+ self,
116
+ key,
117
+ tag="",
118
+ iter=None,
119
+ project="",
120
+ tree=None,
121
+ uid=None,
122
+ format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
123
+ ):
100
124
  pass
101
125
 
102
126
  @abstractmethod
@@ -113,11 +137,25 @@ class RunDBInterface(ABC):
113
137
  kind: str = None,
114
138
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
115
139
  tree: str = None,
140
+ format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
141
+ limit: int = None,
116
142
  ):
117
143
  pass
118
144
 
119
145
  @abstractmethod
120
- def del_artifact(self, key, tag="", project="", tree=None, uid=None):
146
+ def del_artifact(
147
+ self,
148
+ key,
149
+ tag="",
150
+ project="",
151
+ tree=None,
152
+ uid=None,
153
+ deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
154
+ mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
155
+ ),
156
+ secrets: dict = None,
157
+ iter=None,
158
+ ):
121
159
  pass
122
160
 
123
161
  @abstractmethod
@@ -137,7 +175,9 @@ class RunDBInterface(ABC):
137
175
  pass
138
176
 
139
177
  @abstractmethod
140
- def list_functions(self, name=None, project="", tag="", labels=None):
178
+ def list_functions(
179
+ self, name=None, project="", tag="", labels=None, since=None, until=None
180
+ ):
141
181
  pass
142
182
 
143
183
  @abstractmethod
@@ -202,9 +242,8 @@ class RunDBInterface(ABC):
202
242
  )
203
243
  artifact_identifiers.append(
204
244
  mlrun.common.schemas.ArtifactIdentifier(
205
- key=mlrun.utils.get_in_artifact(artifact_obj, "key"),
206
- # we are passing tree as uid when storing an artifact, so if uid is not defined,
207
- # pass the tree as uid
245
+ # we pass the db_key and not the key so the API will be able to find the artifact in the db
246
+ key=mlrun.utils.get_in_artifact(artifact_obj, "db_key"),
208
247
  uid=mlrun.utils.get_in_artifact(artifact_obj, "uid"),
209
248
  producer_id=mlrun.utils.get_in_artifact(artifact_obj, "tree"),
210
249
  kind=mlrun.utils.get_in_artifact(artifact_obj, "kind"),
@@ -251,7 +290,7 @@ class RunDBInterface(ABC):
251
290
  def list_projects(
252
291
  self,
253
292
  owner: str = None,
254
- format_: mlrun.common.schemas.ProjectsFormat = mlrun.common.schemas.ProjectsFormat.name_only,
293
+ format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
255
294
  labels: list[str] = None,
256
295
  state: mlrun.common.schemas.ProjectState = None,
257
296
  ) -> mlrun.common.schemas.ProjectsOutput:
@@ -284,6 +323,12 @@ class RunDBInterface(ABC):
284
323
  ) -> dict:
285
324
  pass
286
325
 
326
+ # TODO: remove in 1.9.0
327
+ @deprecated(
328
+ version="1.9.0",
329
+ reason="'list_features' will be removed in 1.9.0, use 'list_features_v2' instead",
330
+ category=FutureWarning,
331
+ )
287
332
  @abstractmethod
288
333
  def list_features(
289
334
  self,
@@ -295,6 +340,23 @@ class RunDBInterface(ABC):
295
340
  ) -> mlrun.common.schemas.FeaturesOutput:
296
341
  pass
297
342
 
343
+ @abstractmethod
344
+ def list_features_v2(
345
+ self,
346
+ project: str,
347
+ name: str = None,
348
+ tag: str = None,
349
+ entities: list[str] = None,
350
+ labels: list[str] = None,
351
+ ) -> mlrun.common.schemas.FeaturesOutputV2:
352
+ pass
353
+
354
+ # TODO: remove in 1.9.0
355
+ @deprecated(
356
+ version="1.9.0",
357
+ reason="'list_entities' will be removed in 1.9.0, use 'list_entities_v2' instead",
358
+ category=FutureWarning,
359
+ )
298
360
  @abstractmethod
299
361
  def list_entities(
300
362
  self,
@@ -305,6 +367,16 @@ class RunDBInterface(ABC):
305
367
  ) -> mlrun.common.schemas.EntitiesOutput:
306
368
  pass
307
369
 
370
+ @abstractmethod
371
+ def list_entities_v2(
372
+ self,
373
+ project: str,
374
+ name: str = None,
375
+ tag: str = None,
376
+ labels: list[str] = None,
377
+ ) -> mlrun.common.schemas.EntitiesOutputV2:
378
+ pass
379
+
308
380
  @abstractmethod
309
381
  def list_feature_sets(
310
382
  self,
@@ -323,6 +395,9 @@ class RunDBInterface(ABC):
323
395
  partition_order: Union[
324
396
  mlrun.common.schemas.OrderType, str
325
397
  ] = mlrun.common.schemas.OrderType.desc,
398
+ format_: Union[
399
+ str, mlrun.common.formatters.FeatureSetFormat
400
+ ] = mlrun.common.formatters.FeatureSetFormat.full,
326
401
  ) -> list[dict]:
327
402
  pass
328
403
 
@@ -427,8 +502,8 @@ class RunDBInterface(ABC):
427
502
  namespace: str = None,
428
503
  timeout: int = 30,
429
504
  format_: Union[
430
- str, mlrun.common.schemas.PipelinesFormat
431
- ] = mlrun.common.schemas.PipelinesFormat.summary,
505
+ str, mlrun.common.formatters.PipelineFormat
506
+ ] = mlrun.common.formatters.PipelineFormat.summary,
432
507
  project: str = None,
433
508
  ):
434
509
  pass
@@ -442,8 +517,8 @@ class RunDBInterface(ABC):
442
517
  page_token: str = "",
443
518
  filter_: str = "",
444
519
  format_: Union[
445
- str, mlrun.common.schemas.PipelinesFormat
446
- ] = mlrun.common.schemas.PipelinesFormat.metadata_only,
520
+ str, mlrun.common.formatters.PipelineFormat
521
+ ] = mlrun.common.formatters.PipelineFormat.metadata_only,
447
522
  page_size: int = None,
448
523
  ) -> mlrun.common.schemas.PipelinesOutput:
449
524
  pass
@@ -509,9 +584,7 @@ class RunDBInterface(ABC):
509
584
  self,
510
585
  project: str,
511
586
  endpoint_id: str,
512
- model_endpoint: Union[
513
- mlrun.model_monitoring.model_endpoint.ModelEndpoint, dict
514
- ],
587
+ model_endpoint: Union[mlrun.model_monitoring.ModelEndpoint, dict],
515
588
  ):
516
589
  pass
517
590
 
@@ -545,7 +618,7 @@ class RunDBInterface(ABC):
545
618
  end: Optional[str] = None,
546
619
  metrics: Optional[list[str]] = None,
547
620
  features: bool = False,
548
- ):
621
+ ) -> mlrun.model_monitoring.ModelEndpoint:
549
622
  pass
550
623
 
551
624
  @abstractmethod
@@ -616,6 +689,89 @@ class RunDBInterface(ABC):
616
689
  ):
617
690
  pass
618
691
 
692
+ @abstractmethod
693
+ def store_api_gateway(
694
+ self,
695
+ api_gateway: Union[
696
+ mlrun.common.schemas.APIGateway,
697
+ "mlrun.runtimes.nuclio.api_gateway.APIGateway",
698
+ ],
699
+ project: Optional[str] = None,
700
+ ):
701
+ pass
702
+
703
+ @abstractmethod
704
+ def list_api_gateways(self, project=None) -> mlrun.common.schemas.APIGatewaysOutput:
705
+ pass
706
+
707
+ @abstractmethod
708
+ def get_api_gateway(self, name, project=None) -> mlrun.common.schemas.APIGateway:
709
+ pass
710
+
711
+ @abstractmethod
712
+ def delete_api_gateway(self, name, project=None):
713
+ pass
714
+
715
+ @abstractmethod
716
+ def remote_builder(
717
+ self,
718
+ func: "mlrun.runtimes.BaseRuntime",
719
+ with_mlrun: bool,
720
+ mlrun_version_specifier: Optional[str] = None,
721
+ skip_deployed: bool = False,
722
+ builder_env: Optional[dict] = None,
723
+ force_build: bool = False,
724
+ ):
725
+ pass
726
+
727
+ @abstractmethod
728
+ def deploy_nuclio_function(
729
+ self,
730
+ func: "mlrun.runtimes.RemoteRuntime",
731
+ builder_env: Optional[dict] = None,
732
+ ):
733
+ pass
734
+
735
+ @abstractmethod
736
+ def generate_event(
737
+ self, name: str, event_data: Union[dict, mlrun.common.schemas.Event], project=""
738
+ ):
739
+ pass
740
+
741
+ @abstractmethod
742
+ def store_alert_config(
743
+ self,
744
+ alert_name: str,
745
+ alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
746
+ project="",
747
+ ):
748
+ pass
749
+
750
+ @abstractmethod
751
+ def get_alert_config(self, alert_name: str, project=""):
752
+ pass
753
+
754
+ @abstractmethod
755
+ def list_alerts_configs(self, project=""):
756
+ pass
757
+
758
+ @abstractmethod
759
+ def delete_alert_config(self, alert_name: str, project=""):
760
+ pass
761
+
762
+ @abstractmethod
763
+ def reset_alert_config(self, alert_name: str, project=""):
764
+ pass
765
+
766
+ @abstractmethod
767
+ def get_alert_template(self, template_name: str):
768
+ pass
769
+
770
+ @abstractmethod
771
+ def list_alert_templates(self):
772
+ pass
773
+
774
+ @abstractmethod
619
775
  def get_builder_status(
620
776
  self,
621
777
  func: "mlrun.runtimes.BaseRuntime",
@@ -626,6 +782,16 @@ class RunDBInterface(ABC):
626
782
  ):
627
783
  pass
628
784
 
785
+ @abstractmethod
786
+ def get_nuclio_deploy_status(
787
+ self,
788
+ func: "mlrun.runtimes.RemoteRuntime",
789
+ last_log_timestamp: float = 0.0,
790
+ verbose: bool = False,
791
+ ):
792
+ pass
793
+
794
+ @abstractmethod
629
795
  def set_run_notifications(
630
796
  self,
631
797
  project: str,
@@ -634,6 +800,7 @@ class RunDBInterface(ABC):
634
800
  ):
635
801
  pass
636
802
 
803
+ @abstractmethod
637
804
  def store_run_notifications(
638
805
  self,
639
806
  notification_objects: list[mlrun.model.Notification],
@@ -643,40 +810,60 @@ class RunDBInterface(ABC):
643
810
  ):
644
811
  pass
645
812
 
813
+ @abstractmethod
646
814
  def get_log_size(self, uid, project=""):
647
815
  pass
648
816
 
817
+ @abstractmethod
818
+ def store_alert_notifications(
819
+ self,
820
+ session,
821
+ notification_objects: list[mlrun.model.Notification],
822
+ alert_id: str,
823
+ project: str,
824
+ mask_params: bool = True,
825
+ ):
826
+ pass
827
+
828
+ @abstractmethod
649
829
  def watch_log(self, uid, project="", watch=True, offset=0):
650
830
  pass
651
831
 
832
+ @abstractmethod
652
833
  def get_datastore_profile(
653
834
  self, name: str, project: str
654
835
  ) -> Optional[mlrun.common.schemas.DatastoreProfile]:
655
836
  pass
656
837
 
838
+ @abstractmethod
657
839
  def delete_datastore_profile(
658
840
  self, name: str, project: str
659
841
  ) -> mlrun.common.schemas.DatastoreProfile:
660
842
  pass
661
843
 
844
+ @abstractmethod
662
845
  def list_datastore_profiles(
663
846
  self, project: str
664
847
  ) -> list[mlrun.common.schemas.DatastoreProfile]:
665
848
  pass
666
849
 
850
+ @abstractmethod
667
851
  def store_datastore_profile(
668
852
  self, profile: mlrun.common.schemas.DatastoreProfile, project: str
669
853
  ):
670
854
  pass
671
855
 
856
+ @abstractmethod
672
857
  def function_status(self, project, name, kind, selector):
673
858
  pass
674
859
 
860
+ @abstractmethod
675
861
  def start_function(
676
862
  self, func_url: str = None, function: "mlrun.runtimes.BaseRuntime" = None
677
863
  ):
678
864
  pass
679
865
 
866
+ @abstractmethod
680
867
  def submit_workflow(
681
868
  self,
682
869
  project: str,
@@ -695,18 +882,56 @@ class RunDBInterface(ABC):
695
882
  ) -> "mlrun.common.schemas.WorkflowResponse":
696
883
  pass
697
884
 
885
+ @abstractmethod
698
886
  def update_model_monitoring_controller(
699
887
  self,
700
888
  project: str,
701
889
  base_period: int = 10,
702
890
  image: str = "mlrun/mlrun",
703
- ):
891
+ ) -> None:
704
892
  pass
705
893
 
894
+ @abstractmethod
706
895
  def enable_model_monitoring(
707
896
  self,
708
897
  project: str,
709
898
  base_period: int = 10,
710
899
  image: str = "mlrun/mlrun",
711
- ):
900
+ deploy_histogram_data_drift_app: bool = True,
901
+ rebuild_images: bool = False,
902
+ fetch_credentials_from_sys_config: bool = False,
903
+ ) -> None:
904
+ pass
905
+
906
+ @abstractmethod
907
+ def disable_model_monitoring(
908
+ self,
909
+ project: str,
910
+ delete_resources: bool = True,
911
+ delete_stream_function: bool = False,
912
+ delete_histogram_data_drift_app: bool = True,
913
+ delete_user_applications: bool = False,
914
+ user_application_list: list[str] = None,
915
+ ) -> bool:
916
+ pass
917
+
918
+ @abstractmethod
919
+ def delete_model_monitoring_function(
920
+ self, project: str, functions: list[str]
921
+ ) -> bool:
922
+ pass
923
+
924
+ @abstractmethod
925
+ def deploy_histogram_data_drift_app(
926
+ self, project: str, image: str = "mlrun/mlrun"
927
+ ) -> None:
928
+ pass
929
+
930
+ @abstractmethod
931
+ def set_model_monitoring_credentials(
932
+ self,
933
+ project: str,
934
+ credentials: dict[str, str],
935
+ replace_creds: bool,
936
+ ) -> None:
712
937
  pass
mlrun/db/factory.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2023 MLRun Authors
1
+ # Copyright 2023 Iguazio
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -54,9 +54,6 @@ class RunDBFactory(
54
54
  self._run_db = self._rundb_container.nop(url)
55
55
 
56
56
  else:
57
- # TODO: this practically makes the SQLRunDB a singleton, which mean that its session is shared, needs
58
- # to be refreshed frequently and cannot be used concurrently.
59
- # The SQLRunDB should always get its session from the FastAPI dependency injection.
60
57
  self._run_db = self._rundb_container.run_db(url)
61
58
 
62
59
  self._run_db.connect(secrets=secrets)