mlrun 1.7.2rc4__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.2rc4.dist-info → mlrun-1.8.0.dist-info}/METADATA +69 -54
  260. mlrun-1.8.0.dist-info/RECORD +351 -0
  261. {mlrun-1.7.2rc4.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.2rc4.dist-info/RECORD +0 -351
  273. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/entry_points.txt +0 -0
  274. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info/licenses}/LICENSE +0 -0
  275. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/top_level.txt +0 -0
mlrun/db/nopdb.py CHANGED
@@ -20,8 +20,10 @@ import mlrun.alerts
20
20
  import mlrun.common.formatters
21
21
  import mlrun.common.runtimes.constants
22
22
  import mlrun.common.schemas
23
+ import mlrun.common.schemas.model_monitoring.constants as mm_constants
23
24
  import mlrun.errors
24
25
  import mlrun.lists
26
+ import mlrun.model_monitoring
25
27
 
26
28
  from ..config import config
27
29
  from ..utils import logger
@@ -74,6 +76,26 @@ class NopDB(RunDBInterface):
74
76
  def abort_run(self, uid, project="", iter=0, timeout=45, status_text=""):
75
77
  pass
76
78
 
79
+ def push_run_notifications(
80
+ self,
81
+ uid,
82
+ project="",
83
+ timeout=45,
84
+ ):
85
+ pass
86
+
87
+ def refresh_smtp_configuration(self):
88
+ pass
89
+
90
+ def push_pipeline_notifications(
91
+ self,
92
+ pipeline_id,
93
+ project="",
94
+ notifications=None,
95
+ timeout=45,
96
+ ):
97
+ pass
98
+
77
99
  def list_runtime_resources(
78
100
  self,
79
101
  project: Optional[str] = None,
@@ -104,18 +126,19 @@ class NopDB(RunDBInterface):
104
126
  name: Optional[str] = None,
105
127
  uid: Optional[Union[str, list[str]]] = None,
106
128
  project: Optional[str] = None,
107
- labels: Optional[Union[str, list[str]]] = None,
129
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
108
130
  state: Optional[
109
131
  mlrun.common.runtimes.constants.RunStates
110
132
  ] = None, # Backward compatibility
111
133
  states: Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
112
134
  sort: bool = True,
113
- last: int = 0,
114
135
  iter: bool = False,
115
- start_time_from: datetime.datetime = None,
116
- start_time_to: datetime.datetime = None,
117
- last_update_time_from: datetime.datetime = None,
118
- last_update_time_to: datetime.datetime = None,
136
+ start_time_from: Optional[datetime.datetime] = None,
137
+ start_time_to: Optional[datetime.datetime] = None,
138
+ last_update_time_from: Optional[datetime.datetime] = None,
139
+ last_update_time_to: Optional[datetime.datetime] = None,
140
+ end_time_from: Optional[datetime.datetime] = None,
141
+ end_time_to: Optional[datetime.datetime] = None,
119
142
  partition_by: Union[mlrun.common.schemas.RunPartitionByField, str] = None,
120
143
  rows_per_partition: int = 1,
121
144
  partition_sort_by: Union[mlrun.common.schemas.SortField, str] = None,
@@ -127,14 +150,37 @@ class NopDB(RunDBInterface):
127
150
  ):
128
151
  return mlrun.lists.RunList()
129
152
 
153
+ def paginated_list_runs(
154
+ self,
155
+ *args,
156
+ page: Optional[int] = None,
157
+ page_size: Optional[int] = None,
158
+ page_token: Optional[str] = None,
159
+ **kwargs,
160
+ ):
161
+ return mlrun.lists.RunList(), None
162
+
130
163
  def del_run(self, uid, project="", iter=0):
131
164
  pass
132
165
 
133
- def del_runs(self, name="", project="", labels=None, state="", days_ago=0):
166
+ def del_runs(
167
+ self,
168
+ name: str = "",
169
+ project: str = "",
170
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
171
+ state: Optional[mlrun.common.runtimes.constants.RunStates] = None,
172
+ days_ago: int = 0,
173
+ ):
134
174
  pass
135
175
 
136
176
  def store_artifact(
137
- self, key, artifact, uid=None, iter=None, tag="", project="", tree=None
177
+ self,
178
+ key,
179
+ artifact,
180
+ iter=None,
181
+ tag="",
182
+ project="",
183
+ tree=None,
138
184
  ):
139
185
  pass
140
186
 
@@ -155,19 +201,39 @@ class NopDB(RunDBInterface):
155
201
  name="",
156
202
  project="",
157
203
  tag="",
158
- labels=None,
204
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
159
205
  since=None,
160
206
  until=None,
161
- iter: int = None,
207
+ iter: Optional[int] = None,
162
208
  best_iteration: bool = False,
163
- kind: str = None,
209
+ kind: Optional[str] = None,
164
210
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
165
- tree: str = None,
211
+ tree: Optional[str] = None,
166
212
  format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
167
- limit: int = None,
213
+ limit: Optional[int] = None,
214
+ partition_by: Optional[
215
+ Union[mlrun.common.schemas.ArtifactPartitionByField, str]
216
+ ] = None,
217
+ rows_per_partition: int = 1,
218
+ partition_sort_by: Optional[
219
+ Union[mlrun.common.schemas.SortField, str]
220
+ ] = mlrun.common.schemas.SortField.updated,
221
+ partition_order: Union[
222
+ mlrun.common.schemas.OrderType, str
223
+ ] = mlrun.common.schemas.OrderType.desc,
168
224
  ):
169
225
  return mlrun.lists.ArtifactList()
170
226
 
227
+ def paginated_list_artifacts(
228
+ self,
229
+ *args,
230
+ page: Optional[int] = None,
231
+ page_size: Optional[int] = None,
232
+ page_token: Optional[str] = None,
233
+ **kwargs,
234
+ ):
235
+ return mlrun.lists.ArtifactList(), None
236
+
171
237
  def del_artifact(
172
238
  self,
173
239
  key,
@@ -178,12 +244,18 @@ class NopDB(RunDBInterface):
178
244
  deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
179
245
  mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
180
246
  ),
181
- secrets: dict = None,
247
+ secrets: Optional[dict] = None,
182
248
  iter=None,
183
249
  ):
184
250
  pass
185
251
 
186
- def del_artifacts(self, name="", project="", tag="", labels=None):
252
+ def del_artifacts(
253
+ self,
254
+ name="",
255
+ project="",
256
+ tag="",
257
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
258
+ ):
187
259
  pass
188
260
 
189
261
  def store_function(self, function, name, project="", tag="", versioned=False):
@@ -196,10 +268,29 @@ class NopDB(RunDBInterface):
196
268
  pass
197
269
 
198
270
  def list_functions(
199
- self, name=None, project="", tag="", labels=None, since=None, until=None
271
+ self,
272
+ name: Optional[str] = None,
273
+ project: Optional[str] = None,
274
+ tag: Optional[str] = None,
275
+ kind: Optional[str] = None,
276
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
277
+ states: Optional[list[mlrun.common.schemas.FunctionState]] = None,
278
+ format_: mlrun.common.formatters.FunctionFormat = mlrun.common.formatters.FunctionFormat.full,
279
+ since: Optional[datetime.datetime] = None,
280
+ until: Optional[datetime.datetime] = None,
200
281
  ):
201
282
  return []
202
283
 
284
+ def paginated_list_functions(
285
+ self,
286
+ *args,
287
+ page: Optional[int] = None,
288
+ page_size: Optional[int] = None,
289
+ page_token: Optional[str] = None,
290
+ **kwargs,
291
+ ):
292
+ return [], None
293
+
203
294
  def tag_objects(
204
295
  self,
205
296
  project: str,
@@ -249,9 +340,9 @@ class NopDB(RunDBInterface):
249
340
 
250
341
  def list_projects(
251
342
  self,
252
- owner: str = None,
343
+ owner: Optional[str] = None,
253
344
  format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
254
- labels: list[str] = None,
345
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
255
346
  state: mlrun.common.schemas.ProjectState = None,
256
347
  ) -> mlrun.common.schemas.ProjectsOutput:
257
348
  pass
@@ -275,49 +366,61 @@ class NopDB(RunDBInterface):
275
366
  pass
276
367
 
277
368
  def get_feature_set(
278
- self, name: str, project: str = "", tag: str = None, uid: str = None
369
+ self,
370
+ name: str,
371
+ project: str = "",
372
+ tag: Optional[str] = None,
373
+ uid: Optional[str] = None,
279
374
  ) -> dict:
280
375
  pass
281
376
 
282
377
  def list_features(
283
378
  self,
284
379
  project: str,
285
- name: str = None,
286
- tag: str = None,
287
- entities: list[str] = None,
288
- labels: list[str] = None,
380
+ name: Optional[str] = None,
381
+ tag: Optional[str] = None,
382
+ entities: Optional[list[str]] = None,
383
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
289
384
  ) -> mlrun.common.schemas.FeaturesOutput:
290
385
  pass
291
386
 
292
387
  def list_features_v2(
293
388
  self,
294
389
  project: str,
295
- name: str = None,
296
- tag: str = None,
297
- entities: list[str] = None,
298
- labels: list[str] = None,
390
+ name: Optional[str] = None,
391
+ tag: Optional[str] = None,
392
+ entities: Optional[list[str]] = None,
393
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
299
394
  ) -> mlrun.common.schemas.FeaturesOutputV2:
300
395
  pass
301
396
 
302
397
  def list_entities(
303
- self, project: str, name: str = None, tag: str = None, labels: list[str] = None
398
+ self,
399
+ project: str,
400
+ name: Optional[str] = None,
401
+ tag: Optional[str] = None,
402
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
304
403
  ) -> mlrun.common.schemas.EntitiesOutput:
305
404
  pass
306
405
 
307
406
  def list_entities_v2(
308
- self, project: str, name: str = None, tag: str = None, labels: list[str] = None
407
+ self,
408
+ project: str,
409
+ name: Optional[str] = None,
410
+ tag: Optional[str] = None,
411
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
309
412
  ) -> mlrun.common.schemas.EntitiesOutputV2:
310
413
  pass
311
414
 
312
415
  def list_feature_sets(
313
416
  self,
314
417
  project: str = "",
315
- name: str = None,
316
- tag: str = None,
317
- state: str = None,
318
- entities: list[str] = None,
319
- features: list[str] = None,
320
- labels: list[str] = None,
418
+ name: Optional[str] = None,
419
+ tag: Optional[str] = None,
420
+ state: Optional[str] = None,
421
+ entities: Optional[list[str]] = None,
422
+ features: Optional[list[str]] = None,
423
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
321
424
  partition_by: Union[
322
425
  mlrun.common.schemas.FeatureStorePartitionByField, str
323
426
  ] = None,
@@ -368,17 +471,21 @@ class NopDB(RunDBInterface):
368
471
  pass
369
472
 
370
473
  def get_feature_vector(
371
- self, name: str, project: str = "", tag: str = None, uid: str = None
474
+ self,
475
+ name: str,
476
+ project: str = "",
477
+ tag: Optional[str] = None,
478
+ uid: Optional[str] = None,
372
479
  ) -> dict:
373
480
  pass
374
481
 
375
482
  def list_feature_vectors(
376
483
  self,
377
484
  project: str = "",
378
- name: str = None,
379
- tag: str = None,
380
- state: str = None,
381
- labels: list[str] = None,
485
+ name: Optional[str] = None,
486
+ tag: Optional[str] = None,
487
+ state: Optional[str] = None,
488
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
382
489
  partition_by: Union[
383
490
  mlrun.common.schemas.FeatureStorePartitionByField, str
384
491
  ] = None,
@@ -420,26 +527,26 @@ class NopDB(RunDBInterface):
420
527
  def get_pipeline(
421
528
  self,
422
529
  run_id: str,
423
- namespace: str = None,
530
+ namespace: Optional[str] = None,
424
531
  timeout: int = 30,
425
532
  format_: Union[
426
533
  str, mlrun.common.formatters.PipelineFormat
427
534
  ] = mlrun.common.formatters.PipelineFormat.summary,
428
- project: str = None,
535
+ project: Optional[str] = None,
429
536
  ):
430
537
  pass
431
538
 
432
539
  def list_pipelines(
433
540
  self,
434
541
  project: str,
435
- namespace: str = None,
542
+ namespace: Optional[str] = None,
436
543
  sort_by: str = "",
437
544
  page_token: str = "",
438
545
  filter_: str = "",
439
546
  format_: Union[
440
547
  str, mlrun.common.formatters.PipelineFormat
441
548
  ] = mlrun.common.formatters.PipelineFormat.metadata_only,
442
- page_size: int = None,
549
+ page_size: Optional[int] = None,
443
550
  ) -> mlrun.common.schemas.PipelinesOutput:
444
551
  return mlrun.common.schemas.PipelinesOutput(runs=[], total_size=0)
445
552
 
@@ -449,7 +556,7 @@ class NopDB(RunDBInterface):
449
556
  provider: Union[
450
557
  str, mlrun.common.schemas.SecretProviderName
451
558
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
452
- secrets: dict = None,
559
+ secrets: Optional[dict] = None,
453
560
  ):
454
561
  pass
455
562
 
@@ -460,7 +567,7 @@ class NopDB(RunDBInterface):
460
567
  provider: Union[
461
568
  str, mlrun.common.schemas.SecretProviderName
462
569
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
463
- secrets: list[str] = None,
570
+ secrets: Optional[list[str]] = None,
464
571
  ) -> mlrun.common.schemas.SecretsData:
465
572
  pass
466
573
 
@@ -470,7 +577,7 @@ class NopDB(RunDBInterface):
470
577
  provider: Union[
471
578
  str, mlrun.common.schemas.SecretProviderName
472
579
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
473
- token: str = None,
580
+ token: Optional[str] = None,
474
581
  ) -> mlrun.common.schemas.SecretKeysData:
475
582
  pass
476
583
 
@@ -480,7 +587,7 @@ class NopDB(RunDBInterface):
480
587
  provider: Union[
481
588
  str, mlrun.common.schemas.SecretProviderName
482
589
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
483
- secrets: list[str] = None,
590
+ secrets: Optional[list[str]] = None,
484
591
  ):
485
592
  pass
486
593
 
@@ -490,45 +597,70 @@ class NopDB(RunDBInterface):
490
597
  provider: Union[
491
598
  str, mlrun.common.schemas.SecretProviderName
492
599
  ] = mlrun.common.schemas.SecretProviderName.vault,
493
- secrets: dict = None,
600
+ secrets: Optional[dict] = None,
494
601
  ):
495
602
  pass
496
603
 
497
604
  def create_model_endpoint(
498
605
  self,
499
- project: str,
500
- endpoint_id: str,
501
606
  model_endpoint: mlrun.common.schemas.ModelEndpoint,
502
- ):
607
+ creation_strategy: Optional[
608
+ mm_constants.ModelEndpointCreationStrategy
609
+ ] = mm_constants.ModelEndpointCreationStrategy.INPLACE,
610
+ ) -> mlrun.common.schemas.ModelEndpoint:
503
611
  pass
504
612
 
505
- def delete_model_endpoint(self, project: str, endpoint_id: str):
613
+ def delete_model_endpoint(
614
+ self,
615
+ name: str,
616
+ project: str,
617
+ function_name: Optional[str] = None,
618
+ function_tag: Optional[str] = None,
619
+ endpoint_id: Optional[str] = None,
620
+ ):
506
621
  pass
507
622
 
508
623
  def list_model_endpoints(
509
624
  self,
510
625
  project: str,
511
- model: Optional[str] = None,
512
- function: Optional[str] = None,
513
- labels: list[str] = None,
514
- start: str = "now-1h",
515
- end: str = "now",
516
- metrics: Optional[list[str]] = None,
517
- ):
626
+ names: Optional[Union[str, list[str]]] = None,
627
+ function_name: Optional[str] = None,
628
+ function_tag: Optional[str] = None,
629
+ model_name: Optional[str] = None,
630
+ model_tag: Optional[str] = None,
631
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
632
+ start: Optional[datetime.datetime] = None,
633
+ end: Optional[datetime.datetime] = None,
634
+ tsdb_metrics: bool = False,
635
+ metric_list: Optional[list[str]] = None,
636
+ top_level: bool = False,
637
+ uids: Optional[list[str]] = None,
638
+ latest_only: bool = False,
639
+ ) -> mlrun.common.schemas.ModelEndpointList:
518
640
  pass
519
641
 
520
642
  def get_model_endpoint(
521
643
  self,
644
+ name: str,
522
645
  project: str,
523
- endpoint_id: str,
524
- start: Optional[str] = None,
525
- end: Optional[str] = None,
526
- metrics: Optional[list[str]] = None,
527
- features: bool = False,
528
- ):
646
+ function_name: Optional[str] = None,
647
+ function_tag: Optional[str] = None,
648
+ endpoint_id: Optional[str] = None,
649
+ tsdb_metrics: bool = True,
650
+ metric_list: Optional[list[str]] = None,
651
+ feature_analysis: bool = False,
652
+ ) -> mlrun.common.schemas.ModelEndpoint:
529
653
  pass
530
654
 
531
- def patch_model_endpoint(self, project: str, endpoint_id: str, attributes: dict):
655
+ def patch_model_endpoint(
656
+ self,
657
+ name: str,
658
+ project: str,
659
+ attributes: dict,
660
+ function_name: Optional[str] = None,
661
+ function_tag: Optional[str] = None,
662
+ endpoint_id: Optional[str] = None,
663
+ ) -> mlrun.common.schemas.ModelEndpoint:
532
664
  pass
533
665
 
534
666
  def create_hub_source(
@@ -560,9 +692,9 @@ class NopDB(RunDBInterface):
560
692
  def get_hub_catalog(
561
693
  self,
562
694
  source_name: str,
563
- channel: str = None,
564
- version: str = None,
565
- tag: str = None,
695
+ channel: Optional[str] = None,
696
+ version: Optional[str] = None,
697
+ tag: Optional[str] = None,
566
698
  force_refresh: bool = False,
567
699
  ):
568
700
  pass
@@ -572,7 +704,7 @@ class NopDB(RunDBInterface):
572
704
  source_name: str,
573
705
  item_name: str,
574
706
  channel: str = "development",
575
- version: str = None,
707
+ version: Optional[str] = None,
576
708
  tag: str = "latest",
577
709
  force_refresh: bool = False,
578
710
  ):
@@ -584,7 +716,7 @@ class NopDB(RunDBInterface):
584
716
  mlrun.common.schemas.APIGateway,
585
717
  mlrun.runtimes.nuclio.api_gateway.APIGateway,
586
718
  ],
587
- project: str = None,
719
+ project: Optional[str] = None,
588
720
  ) -> mlrun.common.schemas.APIGateway:
589
721
  pass
590
722
 
@@ -628,6 +760,7 @@ class NopDB(RunDBInterface):
628
760
  logs: bool = True,
629
761
  last_log_timestamp: float = 0.0,
630
762
  verbose: bool = False,
763
+ events_offset: int = 0,
631
764
  ):
632
765
  pass
633
766
 
@@ -651,7 +784,7 @@ class NopDB(RunDBInterface):
651
784
  self,
652
785
  notification_objects: list[mlrun.model.Notification],
653
786
  run_uid: str,
654
- project: str = None,
787
+ project: Optional[str] = None,
655
788
  mask_params: bool = True,
656
789
  ):
657
790
  pass
@@ -694,7 +827,9 @@ class NopDB(RunDBInterface):
694
827
  pass
695
828
 
696
829
  def start_function(
697
- self, func_url: str = None, function: "mlrun.runtimes.BaseRuntime" = None
830
+ self,
831
+ func_url: Optional[str] = None,
832
+ function: "mlrun.runtimes.BaseRuntime" = None,
698
833
  ):
699
834
  pass
700
835
 
@@ -712,7 +847,7 @@ class NopDB(RunDBInterface):
712
847
  source: Optional[str] = None,
713
848
  run_name: Optional[str] = None,
714
849
  namespace: Optional[str] = None,
715
- notifications: list["mlrun.model.Notification"] = None,
850
+ notifications: Optional[list["mlrun.model.Notification"]] = None,
716
851
  ) -> "mlrun.common.schemas.WorkflowResponse":
717
852
  pass
718
853
 
@@ -730,7 +865,6 @@ class NopDB(RunDBInterface):
730
865
  base_period: int = 10,
731
866
  image: str = "mlrun/mlrun",
732
867
  deploy_histogram_data_drift_app: bool = True,
733
- rebuild_images: bool = False,
734
868
  fetch_credentials_from_sys_config: bool = False,
735
869
  ) -> None:
736
870
  pass
@@ -742,7 +876,7 @@ class NopDB(RunDBInterface):
742
876
  delete_stream_function: bool = False,
743
877
  delete_histogram_data_drift_app: bool = True,
744
878
  delete_user_applications: bool = False,
745
- user_application_list: list[str] = None,
879
+ user_application_list: Optional[list[str]] = None,
746
880
  ) -> bool:
747
881
  pass
748
882
 
@@ -751,15 +885,10 @@ class NopDB(RunDBInterface):
751
885
  ) -> bool:
752
886
  pass
753
887
 
754
- def deploy_histogram_data_drift_app(
755
- self, project: str, image: str = "mlrun/mlrun"
756
- ) -> None:
757
- pass
758
-
759
888
  def set_model_monitoring_credentials(
760
889
  self,
761
890
  project: str,
762
- credentials: dict[str, str],
891
+ credentials: dict[str, Optional[str]],
763
892
  replace_creds: bool,
764
893
  ) -> None:
765
894
  pass
@@ -774,6 +903,7 @@ class NopDB(RunDBInterface):
774
903
  alert_name: str,
775
904
  alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
776
905
  project="",
906
+ force_reset: bool = False,
777
907
  ):
778
908
  pass
779
909
 
@@ -794,3 +924,40 @@ class NopDB(RunDBInterface):
794
924
 
795
925
  def list_alert_templates(self):
796
926
  pass
927
+
928
+ def list_alert_activations(
929
+ self,
930
+ project: Optional[str] = None,
931
+ name: Optional[str] = None,
932
+ since: Optional[datetime.datetime] = None,
933
+ until: Optional[datetime.datetime] = None,
934
+ entity: Optional[str] = None,
935
+ severity: Optional[
936
+ list[Union[mlrun.common.schemas.alert.AlertSeverity, str]]
937
+ ] = None,
938
+ entity_kind: Optional[
939
+ Union[mlrun.common.schemas.alert.EventEntityKind, str]
940
+ ] = None,
941
+ event_kind: Optional[Union[mlrun.common.schemas.alert.EventKind, str]] = None,
942
+ ):
943
+ pass
944
+
945
+ def paginated_list_alert_activations(
946
+ self,
947
+ *args,
948
+ page: Optional[int] = None,
949
+ page_size: Optional[int] = None,
950
+ page_token: Optional[str] = None,
951
+ **kwargs,
952
+ ):
953
+ pass
954
+
955
+ def get_alert_activation(
956
+ self,
957
+ project,
958
+ activation_id,
959
+ ) -> mlrun.common.schemas.AlertActivation:
960
+ pass
961
+
962
+ def get_project_summary(self, project: str):
963
+ pass
mlrun/errors.py CHANGED
@@ -86,7 +86,7 @@ def raise_for_status(
86
86
  requests.Response,
87
87
  aiohttp.ClientResponse,
88
88
  ],
89
- message: str = None,
89
+ message: typing.Optional[str] = None,
90
90
  ):
91
91
  """
92
92
  Raise a specific MLRunSDK error depending on the given response status code.
@@ -107,7 +107,7 @@ def raise_for_status(
107
107
  raise MLRunHTTPError(error_message, response=response) from exc
108
108
 
109
109
 
110
- def err_for_status_code(status_code: int, message: str = None):
110
+ def err_for_status_code(status_code: int, message: typing.Optional[str] = None):
111
111
  """
112
112
  Return a specific MLRunSDK error depending on the given response status code.
113
113
  If no specific error exists, returns an MLRunHTTPError.
@@ -174,6 +174,10 @@ class MLRunInvalidArgumentError(MLRunHTTPStatusError, ValueError):
174
174
  error_status_code = HTTPStatus.BAD_REQUEST.value
175
175
 
176
176
 
177
+ class MLRunModelLimitExceededError(MLRunHTTPStatusError, ValueError):
178
+ error_status_code = HTTPStatus.BAD_REQUEST.value
179
+
180
+
177
181
  class MLRunInvalidArgumentTypeError(MLRunHTTPStatusError, TypeError):
178
182
  error_status_code = HTTPStatus.BAD_REQUEST.value
179
183