mlrun 1.7.2__py3-none-any.whl → 1.8.0rc1__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 (222) hide show
  1. mlrun/__init__.py +14 -12
  2. mlrun/__main__.py +3 -3
  3. mlrun/alerts/alert.py +19 -12
  4. mlrun/artifacts/__init__.py +0 -2
  5. mlrun/artifacts/base.py +34 -11
  6. mlrun/artifacts/dataset.py +16 -16
  7. mlrun/artifacts/manager.py +13 -13
  8. mlrun/artifacts/model.py +66 -53
  9. mlrun/common/constants.py +6 -0
  10. mlrun/common/formatters/__init__.py +1 -0
  11. mlrun/common/formatters/feature_set.py +1 -0
  12. mlrun/common/formatters/function.py +1 -0
  13. mlrun/common/formatters/model_endpoint.py +30 -0
  14. mlrun/common/formatters/pipeline.py +1 -2
  15. mlrun/common/model_monitoring/__init__.py +0 -3
  16. mlrun/common/model_monitoring/helpers.py +1 -1
  17. mlrun/common/runtimes/constants.py +1 -2
  18. mlrun/common/schemas/__init__.py +4 -2
  19. mlrun/common/schemas/artifact.py +0 -6
  20. mlrun/common/schemas/common.py +50 -0
  21. mlrun/common/schemas/model_monitoring/__init__.py +8 -1
  22. mlrun/common/schemas/model_monitoring/constants.py +62 -12
  23. mlrun/common/schemas/model_monitoring/model_endpoint_v2.py +149 -0
  24. mlrun/common/schemas/model_monitoring/model_endpoints.py +21 -5
  25. mlrun/common/schemas/partition.py +122 -0
  26. mlrun/config.py +43 -15
  27. mlrun/data_types/__init__.py +0 -2
  28. mlrun/data_types/data_types.py +0 -1
  29. mlrun/data_types/infer.py +3 -1
  30. mlrun/data_types/spark.py +4 -4
  31. mlrun/data_types/to_pandas.py +2 -11
  32. mlrun/datastore/__init__.py +0 -2
  33. mlrun/datastore/alibaba_oss.py +4 -1
  34. mlrun/datastore/azure_blob.py +4 -1
  35. mlrun/datastore/base.py +12 -4
  36. mlrun/datastore/datastore.py +9 -3
  37. mlrun/datastore/datastore_profile.py +1 -1
  38. mlrun/datastore/dbfs_store.py +4 -1
  39. mlrun/datastore/filestore.py +4 -1
  40. mlrun/datastore/google_cloud_storage.py +4 -1
  41. mlrun/datastore/hdfs.py +4 -1
  42. mlrun/datastore/inmem.py +4 -1
  43. mlrun/datastore/redis.py +4 -1
  44. mlrun/datastore/s3.py +4 -1
  45. mlrun/datastore/sources.py +51 -49
  46. mlrun/datastore/store_resources.py +0 -2
  47. mlrun/datastore/targets.py +22 -23
  48. mlrun/datastore/utils.py +2 -2
  49. mlrun/datastore/v3io.py +4 -1
  50. mlrun/datastore/wasbfs/fs.py +13 -12
  51. mlrun/db/base.py +126 -62
  52. mlrun/db/factory.py +3 -0
  53. mlrun/db/httpdb.py +767 -231
  54. mlrun/db/nopdb.py +126 -57
  55. mlrun/errors.py +2 -2
  56. mlrun/execution.py +55 -29
  57. mlrun/feature_store/__init__.py +0 -2
  58. mlrun/feature_store/api.py +40 -40
  59. mlrun/feature_store/common.py +9 -9
  60. mlrun/feature_store/feature_set.py +20 -18
  61. mlrun/feature_store/feature_vector.py +27 -24
  62. mlrun/feature_store/retrieval/base.py +14 -9
  63. mlrun/feature_store/retrieval/job.py +2 -1
  64. mlrun/feature_store/steps.py +2 -2
  65. mlrun/features.py +30 -13
  66. mlrun/frameworks/__init__.py +1 -2
  67. mlrun/frameworks/_common/__init__.py +1 -2
  68. mlrun/frameworks/_common/artifacts_library.py +2 -2
  69. mlrun/frameworks/_common/mlrun_interface.py +10 -6
  70. mlrun/frameworks/_common/model_handler.py +29 -27
  71. mlrun/frameworks/_common/producer.py +3 -1
  72. mlrun/frameworks/_dl_common/__init__.py +1 -2
  73. mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
  74. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
  75. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
  76. mlrun/frameworks/_ml_common/__init__.py +1 -2
  77. mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
  78. mlrun/frameworks/_ml_common/model_handler.py +21 -21
  79. mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
  80. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
  81. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  82. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  83. mlrun/frameworks/auto_mlrun/__init__.py +1 -2
  84. mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
  85. mlrun/frameworks/huggingface/__init__.py +1 -2
  86. mlrun/frameworks/huggingface/model_server.py +9 -9
  87. mlrun/frameworks/lgbm/__init__.py +47 -44
  88. mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
  89. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
  90. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
  91. mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
  92. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
  93. mlrun/frameworks/lgbm/model_handler.py +15 -11
  94. mlrun/frameworks/lgbm/model_server.py +11 -7
  95. mlrun/frameworks/lgbm/utils.py +2 -2
  96. mlrun/frameworks/onnx/__init__.py +1 -2
  97. mlrun/frameworks/onnx/dataset.py +3 -3
  98. mlrun/frameworks/onnx/mlrun_interface.py +2 -2
  99. mlrun/frameworks/onnx/model_handler.py +7 -5
  100. mlrun/frameworks/onnx/model_server.py +8 -6
  101. mlrun/frameworks/parallel_coordinates.py +11 -11
  102. mlrun/frameworks/pytorch/__init__.py +22 -23
  103. mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
  104. mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
  105. mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
  106. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
  107. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
  108. mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
  109. mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
  110. mlrun/frameworks/pytorch/model_handler.py +21 -17
  111. mlrun/frameworks/pytorch/model_server.py +13 -9
  112. mlrun/frameworks/sklearn/__init__.py +19 -18
  113. mlrun/frameworks/sklearn/estimator.py +2 -2
  114. mlrun/frameworks/sklearn/metric.py +3 -3
  115. mlrun/frameworks/sklearn/metrics_library.py +8 -6
  116. mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
  117. mlrun/frameworks/sklearn/model_handler.py +4 -3
  118. mlrun/frameworks/tf_keras/__init__.py +11 -12
  119. mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
  120. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
  121. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
  122. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
  123. mlrun/frameworks/tf_keras/model_handler.py +17 -13
  124. mlrun/frameworks/tf_keras/model_server.py +12 -8
  125. mlrun/frameworks/xgboost/__init__.py +19 -18
  126. mlrun/frameworks/xgboost/model_handler.py +13 -9
  127. mlrun/launcher/base.py +3 -4
  128. mlrun/launcher/local.py +1 -1
  129. mlrun/launcher/remote.py +1 -1
  130. mlrun/lists.py +4 -3
  131. mlrun/model.py +108 -44
  132. mlrun/model_monitoring/__init__.py +1 -2
  133. mlrun/model_monitoring/api.py +6 -6
  134. mlrun/model_monitoring/applications/_application_steps.py +13 -15
  135. mlrun/model_monitoring/applications/histogram_data_drift.py +41 -15
  136. mlrun/model_monitoring/applications/results.py +55 -3
  137. mlrun/model_monitoring/controller.py +185 -223
  138. mlrun/model_monitoring/db/_schedules.py +156 -0
  139. mlrun/model_monitoring/db/_stats.py +189 -0
  140. mlrun/model_monitoring/db/stores/__init__.py +1 -1
  141. mlrun/model_monitoring/db/stores/base/store.py +6 -65
  142. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -25
  143. mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -97
  144. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +2 -58
  145. mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -15
  146. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +6 -257
  147. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +9 -271
  148. mlrun/model_monitoring/db/tsdb/base.py +74 -22
  149. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +66 -35
  150. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
  151. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +284 -51
  152. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
  153. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +35 -17
  154. mlrun/model_monitoring/helpers.py +97 -1
  155. mlrun/model_monitoring/model_endpoint.py +4 -2
  156. mlrun/model_monitoring/stream_processing.py +2 -2
  157. mlrun/model_monitoring/tracking_policy.py +10 -3
  158. mlrun/model_monitoring/writer.py +47 -26
  159. mlrun/package/__init__.py +3 -6
  160. mlrun/package/context_handler.py +1 -1
  161. mlrun/package/packager.py +12 -9
  162. mlrun/package/packagers/__init__.py +0 -2
  163. mlrun/package/packagers/default_packager.py +14 -11
  164. mlrun/package/packagers/numpy_packagers.py +16 -7
  165. mlrun/package/packagers/pandas_packagers.py +18 -18
  166. mlrun/package/packagers/python_standard_library_packagers.py +25 -11
  167. mlrun/package/packagers_manager.py +31 -14
  168. mlrun/package/utils/__init__.py +0 -3
  169. mlrun/package/utils/_pickler.py +6 -6
  170. mlrun/platforms/__init__.py +3 -3
  171. mlrun/platforms/iguazio.py +4 -1
  172. mlrun/projects/__init__.py +1 -6
  173. mlrun/projects/operations.py +27 -27
  174. mlrun/projects/pipelines.py +85 -215
  175. mlrun/projects/project.py +444 -158
  176. mlrun/run.py +9 -9
  177. mlrun/runtimes/__init__.py +1 -3
  178. mlrun/runtimes/base.py +13 -10
  179. mlrun/runtimes/daskjob.py +9 -9
  180. mlrun/runtimes/generators.py +2 -1
  181. mlrun/runtimes/kubejob.py +4 -5
  182. mlrun/runtimes/mpijob/__init__.py +0 -2
  183. mlrun/runtimes/mpijob/abstract.py +7 -6
  184. mlrun/runtimes/nuclio/api_gateway.py +7 -7
  185. mlrun/runtimes/nuclio/application/application.py +11 -11
  186. mlrun/runtimes/nuclio/function.py +14 -14
  187. mlrun/runtimes/nuclio/serving.py +9 -9
  188. mlrun/runtimes/pod.py +74 -29
  189. mlrun/runtimes/remotesparkjob.py +3 -2
  190. mlrun/runtimes/sparkjob/__init__.py +0 -2
  191. mlrun/runtimes/sparkjob/spark3job.py +21 -11
  192. mlrun/runtimes/utils.py +6 -5
  193. mlrun/serving/merger.py +6 -4
  194. mlrun/serving/remote.py +18 -17
  195. mlrun/serving/routers.py +27 -27
  196. mlrun/serving/server.py +1 -1
  197. mlrun/serving/states.py +76 -71
  198. mlrun/serving/utils.py +13 -2
  199. mlrun/serving/v1_serving.py +3 -2
  200. mlrun/serving/v2_serving.py +4 -4
  201. mlrun/track/__init__.py +1 -1
  202. mlrun/track/tracker.py +2 -2
  203. mlrun/track/trackers/mlflow_tracker.py +6 -5
  204. mlrun/utils/async_http.py +1 -1
  205. mlrun/utils/helpers.py +72 -28
  206. mlrun/utils/logger.py +104 -2
  207. mlrun/utils/notifications/notification/base.py +23 -4
  208. mlrun/utils/notifications/notification/console.py +1 -1
  209. mlrun/utils/notifications/notification/git.py +6 -6
  210. mlrun/utils/notifications/notification/ipython.py +5 -4
  211. mlrun/utils/notifications/notification/slack.py +1 -1
  212. mlrun/utils/notifications/notification/webhook.py +13 -17
  213. mlrun/utils/notifications/notification_pusher.py +23 -19
  214. mlrun/utils/regex.py +1 -1
  215. mlrun/utils/version/version.json +2 -2
  216. {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/METADATA +187 -199
  217. mlrun-1.8.0rc1.dist-info/RECORD +356 -0
  218. {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/WHEEL +1 -1
  219. mlrun-1.7.2.dist-info/RECORD +0 -351
  220. {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/LICENSE +0 -0
  221. {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/entry_points.txt +0 -0
  222. {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/top_level.txt +0 -0
mlrun/db/base.py CHANGED
@@ -73,7 +73,7 @@ class RunDBInterface(ABC):
73
73
  name: Optional[str] = None,
74
74
  uid: Optional[Union[str, list[str]]] = None,
75
75
  project: Optional[str] = None,
76
- labels: Optional[Union[str, list[str]]] = None,
76
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
77
77
  state: Optional[
78
78
  mlrun.common.runtimes.constants.RunStates
79
79
  ] = None, # Backward compatibility
@@ -81,10 +81,10 @@ class RunDBInterface(ABC):
81
81
  sort: bool = True,
82
82
  last: int = 0,
83
83
  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,
84
+ start_time_from: Optional[datetime.datetime] = None,
85
+ start_time_to: Optional[datetime.datetime] = None,
86
+ last_update_time_from: Optional[datetime.datetime] = None,
87
+ last_update_time_to: Optional[datetime.datetime] = None,
88
88
  partition_by: Union[mlrun.common.schemas.RunPartitionByField, str] = None,
89
89
  rows_per_partition: int = 1,
90
90
  partition_sort_by: Union[mlrun.common.schemas.SortField, str] = None,
@@ -96,12 +96,30 @@ class RunDBInterface(ABC):
96
96
  ):
97
97
  pass
98
98
 
99
+ @abstractmethod
100
+ def paginated_list_runs(
101
+ self,
102
+ *args,
103
+ page: Optional[int] = None,
104
+ page_size: Optional[int] = None,
105
+ page_token: Optional[str] = None,
106
+ **kwargs,
107
+ ):
108
+ pass
109
+
99
110
  @abstractmethod
100
111
  def del_run(self, uid, project="", iter=0):
101
112
  pass
102
113
 
103
114
  @abstractmethod
104
- def del_runs(self, name="", project="", labels=None, state="", days_ago=0):
115
+ def del_runs(
116
+ self,
117
+ name: str = "",
118
+ project: str = "",
119
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
120
+ state: Optional[mlrun.common.runtimes.constants.RunStates] = None,
121
+ days_ago: int = 0,
122
+ ):
105
123
  pass
106
124
 
107
125
  @abstractmethod
@@ -126,19 +144,30 @@ class RunDBInterface(ABC):
126
144
  @abstractmethod
127
145
  def list_artifacts(
128
146
  self,
129
- name="",
130
- project="",
131
- tag="",
132
- labels=None,
147
+ name: Optional[str] = "",
148
+ project: Optional[str] = "",
149
+ tag: Optional[str] = "",
150
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
133
151
  since=None,
134
152
  until=None,
135
- iter: int = None,
153
+ iter: Optional[int] = None,
136
154
  best_iteration: bool = False,
137
- kind: str = None,
155
+ kind: Optional[str] = None,
138
156
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
139
- tree: str = None,
157
+ tree: Optional[str] = None,
140
158
  format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
141
- limit: int = None,
159
+ limit: Optional[int] = None,
160
+ ):
161
+ pass
162
+
163
+ @abstractmethod
164
+ def paginated_list_artifacts(
165
+ self,
166
+ *args,
167
+ page: Optional[int] = None,
168
+ page_size: Optional[int] = None,
169
+ page_token: Optional[str] = None,
170
+ **kwargs,
142
171
  ):
143
172
  pass
144
173
 
@@ -153,13 +182,19 @@ class RunDBInterface(ABC):
153
182
  deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
154
183
  mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
155
184
  ),
156
- secrets: dict = None,
185
+ secrets: Optional[dict] = None,
157
186
  iter=None,
158
187
  ):
159
188
  pass
160
189
 
161
190
  @abstractmethod
162
- def del_artifacts(self, name="", project="", tag="", labels=None):
191
+ def del_artifacts(
192
+ self,
193
+ name: Optional[str] = "",
194
+ project: Optional[str] = "",
195
+ tag: Optional[str] = "",
196
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
197
+ ):
163
198
  pass
164
199
 
165
200
  @abstractmethod
@@ -176,7 +211,24 @@ class RunDBInterface(ABC):
176
211
 
177
212
  @abstractmethod
178
213
  def list_functions(
179
- self, name=None, project="", tag="", labels=None, since=None, until=None
214
+ self,
215
+ name: Optional[str] = None,
216
+ project: Optional[str] = "",
217
+ tag: Optional[str] = "",
218
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
219
+ since=None,
220
+ until=None,
221
+ ):
222
+ pass
223
+
224
+ @abstractmethod
225
+ def paginated_list_functions(
226
+ self,
227
+ *args,
228
+ page: Optional[int] = None,
229
+ page_size: Optional[int] = None,
230
+ page_token: Optional[str] = None,
231
+ **kwargs,
180
232
  ):
181
233
  pass
182
234
 
@@ -289,9 +341,9 @@ class RunDBInterface(ABC):
289
341
  @abstractmethod
290
342
  def list_projects(
291
343
  self,
292
- owner: str = None,
344
+ owner: Optional[str] = None,
293
345
  format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
294
- labels: list[str] = None,
346
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
295
347
  state: mlrun.common.schemas.ProjectState = None,
296
348
  ) -> mlrun.common.schemas.ProjectsOutput:
297
349
  pass
@@ -319,7 +371,11 @@ class RunDBInterface(ABC):
319
371
 
320
372
  @abstractmethod
321
373
  def get_feature_set(
322
- self, name: str, project: str = "", tag: str = None, uid: str = None
374
+ self,
375
+ name: str,
376
+ project: str = "",
377
+ tag: Optional[str] = None,
378
+ uid: Optional[str] = None,
323
379
  ) -> dict:
324
380
  pass
325
381
 
@@ -333,10 +389,10 @@ class RunDBInterface(ABC):
333
389
  def list_features(
334
390
  self,
335
391
  project: str,
336
- name: str = None,
337
- tag: str = None,
338
- entities: list[str] = None,
339
- labels: list[str] = None,
392
+ name: Optional[str] = None,
393
+ tag: Optional[str] = None,
394
+ entities: Optional[list[str]] = None,
395
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
340
396
  ) -> mlrun.common.schemas.FeaturesOutput:
341
397
  pass
342
398
 
@@ -344,10 +400,10 @@ class RunDBInterface(ABC):
344
400
  def list_features_v2(
345
401
  self,
346
402
  project: str,
347
- name: str = None,
348
- tag: str = None,
349
- entities: list[str] = None,
350
- labels: list[str] = None,
403
+ name: Optional[str] = None,
404
+ tag: Optional[str] = None,
405
+ entities: Optional[list[str]] = None,
406
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
351
407
  ) -> mlrun.common.schemas.FeaturesOutputV2:
352
408
  pass
353
409
 
@@ -361,9 +417,9 @@ class RunDBInterface(ABC):
361
417
  def list_entities(
362
418
  self,
363
419
  project: str,
364
- name: str = None,
365
- tag: str = None,
366
- labels: list[str] = None,
420
+ name: Optional[str] = None,
421
+ tag: Optional[str] = None,
422
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
367
423
  ) -> mlrun.common.schemas.EntitiesOutput:
368
424
  pass
369
425
 
@@ -371,9 +427,9 @@ class RunDBInterface(ABC):
371
427
  def list_entities_v2(
372
428
  self,
373
429
  project: str,
374
- name: str = None,
375
- tag: str = None,
376
- labels: list[str] = None,
430
+ name: Optional[str] = None,
431
+ tag: Optional[str] = None,
432
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
377
433
  ) -> mlrun.common.schemas.EntitiesOutputV2:
378
434
  pass
379
435
 
@@ -381,12 +437,12 @@ class RunDBInterface(ABC):
381
437
  def list_feature_sets(
382
438
  self,
383
439
  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,
440
+ name: Optional[str] = None,
441
+ tag: Optional[str] = None,
442
+ state: Optional[str] = None,
443
+ entities: Optional[list[str]] = None,
444
+ features: Optional[list[str]] = None,
445
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
390
446
  partition_by: Union[
391
447
  mlrun.common.schemas.FeatureStorePartitionByField, str
392
448
  ] = None,
@@ -442,7 +498,11 @@ class RunDBInterface(ABC):
442
498
 
443
499
  @abstractmethod
444
500
  def get_feature_vector(
445
- self, name: str, project: str = "", tag: str = None, uid: str = None
501
+ self,
502
+ name: str,
503
+ project: str = "",
504
+ tag: Optional[str] = None,
505
+ uid: Optional[str] = None,
446
506
  ) -> dict:
447
507
  pass
448
508
 
@@ -450,10 +510,10 @@ class RunDBInterface(ABC):
450
510
  def list_feature_vectors(
451
511
  self,
452
512
  project: str = "",
453
- name: str = None,
454
- tag: str = None,
455
- state: str = None,
456
- labels: list[str] = None,
513
+ name: Optional[str] = None,
514
+ tag: Optional[str] = None,
515
+ state: Optional[str] = None,
516
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
457
517
  partition_by: Union[
458
518
  mlrun.common.schemas.FeatureStorePartitionByField, str
459
519
  ] = None,
@@ -499,12 +559,12 @@ class RunDBInterface(ABC):
499
559
  def get_pipeline(
500
560
  self,
501
561
  run_id: str,
502
- namespace: str = None,
562
+ namespace: Optional[str] = None,
503
563
  timeout: int = 30,
504
564
  format_: Union[
505
565
  str, mlrun.common.formatters.PipelineFormat
506
566
  ] = mlrun.common.formatters.PipelineFormat.summary,
507
- project: str = None,
567
+ project: Optional[str] = None,
508
568
  ):
509
569
  pass
510
570
 
@@ -512,14 +572,14 @@ class RunDBInterface(ABC):
512
572
  def list_pipelines(
513
573
  self,
514
574
  project: str,
515
- namespace: str = None,
575
+ namespace: Optional[str] = None,
516
576
  sort_by: str = "",
517
577
  page_token: str = "",
518
578
  filter_: str = "",
519
579
  format_: Union[
520
580
  str, mlrun.common.formatters.PipelineFormat
521
581
  ] = mlrun.common.formatters.PipelineFormat.metadata_only,
522
- page_size: int = None,
582
+ page_size: Optional[int] = None,
523
583
  ) -> mlrun.common.schemas.PipelinesOutput:
524
584
  pass
525
585
 
@@ -530,7 +590,7 @@ class RunDBInterface(ABC):
530
590
  provider: Union[
531
591
  str, mlrun.common.schemas.SecretProviderName
532
592
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
533
- secrets: dict = None,
593
+ secrets: Optional[dict] = None,
534
594
  ):
535
595
  pass
536
596
 
@@ -542,7 +602,7 @@ class RunDBInterface(ABC):
542
602
  provider: Union[
543
603
  str, mlrun.common.schemas.SecretProviderName
544
604
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
545
- secrets: list[str] = None,
605
+ secrets: Optional[list[str]] = None,
546
606
  ) -> mlrun.common.schemas.SecretsData:
547
607
  pass
548
608
 
@@ -553,7 +613,7 @@ class RunDBInterface(ABC):
553
613
  provider: Union[
554
614
  str, mlrun.common.schemas.SecretProviderName
555
615
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
556
- token: str = None,
616
+ token: Optional[str] = None,
557
617
  ) -> mlrun.common.schemas.SecretKeysData:
558
618
  pass
559
619
 
@@ -564,7 +624,7 @@ class RunDBInterface(ABC):
564
624
  provider: Union[
565
625
  str, mlrun.common.schemas.SecretProviderName
566
626
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
567
- secrets: list[str] = None,
627
+ secrets: Optional[list[str]] = None,
568
628
  ):
569
629
  pass
570
630
 
@@ -575,7 +635,7 @@ class RunDBInterface(ABC):
575
635
  provider: Union[
576
636
  str, mlrun.common.schemas.SecretProviderName
577
637
  ] = mlrun.common.schemas.SecretProviderName.vault,
578
- secrets: dict = None,
638
+ secrets: Optional[dict] = None,
579
639
  ):
580
640
  pass
581
641
 
@@ -602,7 +662,7 @@ class RunDBInterface(ABC):
602
662
  project: str,
603
663
  model: Optional[str] = None,
604
664
  function: Optional[str] = None,
605
- labels: list[str] = None,
665
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
606
666
  start: str = "now-1h",
607
667
  end: str = "now",
608
668
  metrics: Optional[list[str]] = None,
@@ -665,8 +725,8 @@ class RunDBInterface(ABC):
665
725
  def get_hub_catalog(
666
726
  self,
667
727
  source_name: str,
668
- version: str = None,
669
- tag: str = None,
728
+ version: Optional[str] = None,
729
+ tag: Optional[str] = None,
670
730
  force_refresh: bool = False,
671
731
  ):
672
732
  pass
@@ -676,7 +736,7 @@ class RunDBInterface(ABC):
676
736
  self,
677
737
  source_name: str,
678
738
  item_name: str,
679
- version: str = None,
739
+ version: Optional[str] = None,
680
740
  tag: str = "latest",
681
741
  force_refresh: bool = False,
682
742
  ):
@@ -744,6 +804,7 @@ class RunDBInterface(ABC):
744
804
  alert_name: str,
745
805
  alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
746
806
  project="",
807
+ force_reset: bool = False,
747
808
  ):
748
809
  pass
749
810
 
@@ -779,6 +840,7 @@ class RunDBInterface(ABC):
779
840
  logs: bool = True,
780
841
  last_log_timestamp: float = 0.0,
781
842
  verbose: bool = False,
843
+ events_offset: int = 0,
782
844
  ):
783
845
  pass
784
846
 
@@ -805,7 +867,7 @@ class RunDBInterface(ABC):
805
867
  self,
806
868
  notification_objects: list[mlrun.model.Notification],
807
869
  run_uid: str,
808
- project: str = None,
870
+ project: Optional[str] = None,
809
871
  mask_params: bool = True,
810
872
  ):
811
873
  pass
@@ -859,7 +921,9 @@ class RunDBInterface(ABC):
859
921
 
860
922
  @abstractmethod
861
923
  def start_function(
862
- self, func_url: str = None, function: "mlrun.runtimes.BaseRuntime" = None
924
+ self,
925
+ func_url: Optional[str] = None,
926
+ function: "mlrun.runtimes.BaseRuntime" = None,
863
927
  ):
864
928
  pass
865
929
 
@@ -878,7 +942,7 @@ class RunDBInterface(ABC):
878
942
  source: Optional[str] = None,
879
943
  run_name: Optional[str] = None,
880
944
  namespace: Optional[str] = None,
881
- notifications: list["mlrun.model.Notification"] = None,
945
+ notifications: Optional[list["mlrun.model.Notification"]] = None,
882
946
  ) -> "mlrun.common.schemas.WorkflowResponse":
883
947
  pass
884
948
 
@@ -911,7 +975,7 @@ class RunDBInterface(ABC):
911
975
  delete_stream_function: bool = False,
912
976
  delete_histogram_data_drift_app: bool = True,
913
977
  delete_user_applications: bool = False,
914
- user_application_list: list[str] = None,
978
+ user_application_list: Optional[list[str]] = None,
915
979
  ) -> bool:
916
980
  pass
917
981
 
mlrun/db/factory.py CHANGED
@@ -54,6 +54,9 @@ 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.
57
60
  self._run_db = self._rundb_container.run_db(url)
58
61
 
59
62
  self._run_db.connect(secrets=secrets)