mlrun 1.7.2rc3__py3-none-any.whl → 1.8.0rc2__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 (250) hide show
  1. mlrun/__init__.py +18 -18
  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/formatters/project.py +9 -0
  16. mlrun/common/model_monitoring/__init__.py +0 -3
  17. mlrun/common/model_monitoring/helpers.py +1 -1
  18. mlrun/common/runtimes/constants.py +1 -2
  19. mlrun/common/schemas/__init__.py +7 -2
  20. mlrun/common/schemas/alert.py +31 -18
  21. mlrun/common/schemas/api_gateway.py +3 -3
  22. mlrun/common/schemas/artifact.py +7 -13
  23. mlrun/common/schemas/auth.py +6 -4
  24. mlrun/common/schemas/background_task.py +7 -7
  25. mlrun/common/schemas/client_spec.py +2 -2
  26. mlrun/common/schemas/clusterization_spec.py +2 -2
  27. mlrun/common/schemas/common.py +53 -3
  28. mlrun/common/schemas/datastore_profile.py +1 -1
  29. mlrun/common/schemas/feature_store.py +9 -9
  30. mlrun/common/schemas/frontend_spec.py +4 -4
  31. mlrun/common/schemas/function.py +10 -10
  32. mlrun/common/schemas/hub.py +1 -1
  33. mlrun/common/schemas/k8s.py +3 -3
  34. mlrun/common/schemas/memory_reports.py +3 -3
  35. mlrun/common/schemas/model_monitoring/__init__.py +8 -1
  36. mlrun/common/schemas/model_monitoring/constants.py +62 -12
  37. mlrun/common/schemas/model_monitoring/grafana.py +1 -1
  38. mlrun/common/schemas/model_monitoring/model_endpoint_v2.py +149 -0
  39. mlrun/common/schemas/model_monitoring/model_endpoints.py +22 -6
  40. mlrun/common/schemas/notification.py +18 -3
  41. mlrun/common/schemas/object.py +1 -1
  42. mlrun/common/schemas/pagination.py +4 -4
  43. mlrun/common/schemas/partition.py +137 -0
  44. mlrun/common/schemas/pipeline.py +2 -2
  45. mlrun/common/schemas/project.py +22 -17
  46. mlrun/common/schemas/runs.py +2 -2
  47. mlrun/common/schemas/runtime_resource.py +5 -5
  48. mlrun/common/schemas/schedule.py +1 -1
  49. mlrun/common/schemas/secret.py +1 -1
  50. mlrun/common/schemas/tag.py +3 -3
  51. mlrun/common/schemas/workflow.py +5 -5
  52. mlrun/config.py +65 -15
  53. mlrun/data_types/__init__.py +0 -2
  54. mlrun/data_types/data_types.py +0 -1
  55. mlrun/data_types/infer.py +3 -1
  56. mlrun/data_types/spark.py +4 -4
  57. mlrun/data_types/to_pandas.py +2 -11
  58. mlrun/datastore/__init__.py +0 -2
  59. mlrun/datastore/alibaba_oss.py +4 -1
  60. mlrun/datastore/azure_blob.py +4 -1
  61. mlrun/datastore/base.py +12 -4
  62. mlrun/datastore/datastore.py +9 -3
  63. mlrun/datastore/datastore_profile.py +20 -20
  64. mlrun/datastore/dbfs_store.py +4 -1
  65. mlrun/datastore/filestore.py +4 -1
  66. mlrun/datastore/google_cloud_storage.py +4 -1
  67. mlrun/datastore/hdfs.py +4 -1
  68. mlrun/datastore/inmem.py +4 -1
  69. mlrun/datastore/redis.py +4 -1
  70. mlrun/datastore/s3.py +4 -1
  71. mlrun/datastore/sources.py +51 -49
  72. mlrun/datastore/store_resources.py +0 -2
  73. mlrun/datastore/targets.py +22 -23
  74. mlrun/datastore/utils.py +2 -2
  75. mlrun/datastore/v3io.py +4 -1
  76. mlrun/datastore/wasbfs/fs.py +13 -12
  77. mlrun/db/base.py +170 -64
  78. mlrun/db/factory.py +3 -0
  79. mlrun/db/httpdb.py +986 -238
  80. mlrun/db/nopdb.py +155 -57
  81. mlrun/errors.py +2 -2
  82. mlrun/execution.py +55 -29
  83. mlrun/feature_store/__init__.py +0 -2
  84. mlrun/feature_store/api.py +40 -40
  85. mlrun/feature_store/common.py +9 -9
  86. mlrun/feature_store/feature_set.py +20 -18
  87. mlrun/feature_store/feature_vector.py +27 -24
  88. mlrun/feature_store/retrieval/base.py +14 -9
  89. mlrun/feature_store/retrieval/job.py +2 -1
  90. mlrun/feature_store/steps.py +2 -2
  91. mlrun/features.py +30 -13
  92. mlrun/frameworks/__init__.py +1 -2
  93. mlrun/frameworks/_common/__init__.py +1 -2
  94. mlrun/frameworks/_common/artifacts_library.py +2 -2
  95. mlrun/frameworks/_common/mlrun_interface.py +10 -6
  96. mlrun/frameworks/_common/model_handler.py +29 -27
  97. mlrun/frameworks/_common/producer.py +3 -1
  98. mlrun/frameworks/_dl_common/__init__.py +1 -2
  99. mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
  100. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
  101. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
  102. mlrun/frameworks/_ml_common/__init__.py +1 -2
  103. mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
  104. mlrun/frameworks/_ml_common/model_handler.py +21 -21
  105. mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
  106. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
  107. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  108. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  109. mlrun/frameworks/auto_mlrun/__init__.py +1 -2
  110. mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
  111. mlrun/frameworks/huggingface/__init__.py +1 -2
  112. mlrun/frameworks/huggingface/model_server.py +9 -9
  113. mlrun/frameworks/lgbm/__init__.py +47 -44
  114. mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
  115. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
  116. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
  117. mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
  118. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
  119. mlrun/frameworks/lgbm/model_handler.py +15 -11
  120. mlrun/frameworks/lgbm/model_server.py +11 -7
  121. mlrun/frameworks/lgbm/utils.py +2 -2
  122. mlrun/frameworks/onnx/__init__.py +1 -2
  123. mlrun/frameworks/onnx/dataset.py +3 -3
  124. mlrun/frameworks/onnx/mlrun_interface.py +2 -2
  125. mlrun/frameworks/onnx/model_handler.py +7 -5
  126. mlrun/frameworks/onnx/model_server.py +8 -6
  127. mlrun/frameworks/parallel_coordinates.py +11 -11
  128. mlrun/frameworks/pytorch/__init__.py +22 -23
  129. mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
  130. mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
  131. mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
  132. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
  133. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
  134. mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
  135. mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
  136. mlrun/frameworks/pytorch/model_handler.py +21 -17
  137. mlrun/frameworks/pytorch/model_server.py +13 -9
  138. mlrun/frameworks/sklearn/__init__.py +19 -18
  139. mlrun/frameworks/sklearn/estimator.py +2 -2
  140. mlrun/frameworks/sklearn/metric.py +3 -3
  141. mlrun/frameworks/sklearn/metrics_library.py +8 -6
  142. mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
  143. mlrun/frameworks/sklearn/model_handler.py +4 -3
  144. mlrun/frameworks/tf_keras/__init__.py +11 -12
  145. mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
  146. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
  147. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
  148. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
  149. mlrun/frameworks/tf_keras/model_handler.py +17 -13
  150. mlrun/frameworks/tf_keras/model_server.py +12 -8
  151. mlrun/frameworks/xgboost/__init__.py +19 -18
  152. mlrun/frameworks/xgboost/model_handler.py +13 -9
  153. mlrun/launcher/base.py +3 -4
  154. mlrun/launcher/local.py +1 -1
  155. mlrun/launcher/remote.py +1 -1
  156. mlrun/lists.py +4 -3
  157. mlrun/model.py +110 -46
  158. mlrun/model_monitoring/__init__.py +1 -2
  159. mlrun/model_monitoring/api.py +6 -6
  160. mlrun/model_monitoring/applications/_application_steps.py +13 -15
  161. mlrun/model_monitoring/applications/histogram_data_drift.py +41 -15
  162. mlrun/model_monitoring/applications/results.py +55 -3
  163. mlrun/model_monitoring/controller.py +185 -223
  164. mlrun/model_monitoring/db/_schedules.py +156 -0
  165. mlrun/model_monitoring/db/_stats.py +189 -0
  166. mlrun/model_monitoring/db/stores/__init__.py +1 -1
  167. mlrun/model_monitoring/db/stores/base/store.py +6 -65
  168. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -25
  169. mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -97
  170. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +2 -58
  171. mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -15
  172. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +6 -257
  173. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +9 -271
  174. mlrun/model_monitoring/db/tsdb/base.py +76 -24
  175. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +61 -6
  176. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
  177. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +253 -28
  178. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
  179. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +35 -17
  180. mlrun/model_monitoring/helpers.py +91 -1
  181. mlrun/model_monitoring/model_endpoint.py +4 -2
  182. mlrun/model_monitoring/stream_processing.py +16 -13
  183. mlrun/model_monitoring/tracking_policy.py +10 -3
  184. mlrun/model_monitoring/writer.py +47 -26
  185. mlrun/package/__init__.py +3 -6
  186. mlrun/package/context_handler.py +1 -1
  187. mlrun/package/packager.py +12 -9
  188. mlrun/package/packagers/__init__.py +0 -2
  189. mlrun/package/packagers/default_packager.py +14 -11
  190. mlrun/package/packagers/numpy_packagers.py +16 -7
  191. mlrun/package/packagers/pandas_packagers.py +18 -18
  192. mlrun/package/packagers/python_standard_library_packagers.py +25 -11
  193. mlrun/package/packagers_manager.py +31 -14
  194. mlrun/package/utils/__init__.py +0 -3
  195. mlrun/package/utils/_pickler.py +6 -6
  196. mlrun/platforms/__init__.py +3 -16
  197. mlrun/platforms/iguazio.py +4 -1
  198. mlrun/projects/operations.py +27 -27
  199. mlrun/projects/pipelines.py +34 -35
  200. mlrun/projects/project.py +535 -182
  201. mlrun/run.py +13 -10
  202. mlrun/runtimes/__init__.py +1 -3
  203. mlrun/runtimes/base.py +15 -11
  204. mlrun/runtimes/daskjob.py +9 -9
  205. mlrun/runtimes/generators.py +2 -1
  206. mlrun/runtimes/kubejob.py +4 -5
  207. mlrun/runtimes/mounts.py +572 -0
  208. mlrun/runtimes/mpijob/__init__.py +0 -2
  209. mlrun/runtimes/mpijob/abstract.py +7 -6
  210. mlrun/runtimes/nuclio/api_gateway.py +7 -7
  211. mlrun/runtimes/nuclio/application/application.py +11 -11
  212. mlrun/runtimes/nuclio/function.py +13 -13
  213. mlrun/runtimes/nuclio/serving.py +9 -9
  214. mlrun/runtimes/pod.py +154 -45
  215. mlrun/runtimes/remotesparkjob.py +3 -2
  216. mlrun/runtimes/sparkjob/__init__.py +0 -2
  217. mlrun/runtimes/sparkjob/spark3job.py +21 -11
  218. mlrun/runtimes/utils.py +6 -5
  219. mlrun/serving/merger.py +6 -4
  220. mlrun/serving/remote.py +18 -17
  221. mlrun/serving/routers.py +27 -27
  222. mlrun/serving/server.py +1 -1
  223. mlrun/serving/states.py +76 -71
  224. mlrun/serving/utils.py +13 -2
  225. mlrun/serving/v1_serving.py +3 -2
  226. mlrun/serving/v2_serving.py +4 -4
  227. mlrun/track/__init__.py +1 -1
  228. mlrun/track/tracker.py +2 -2
  229. mlrun/track/trackers/mlflow_tracker.py +6 -5
  230. mlrun/utils/async_http.py +1 -1
  231. mlrun/utils/helpers.py +70 -16
  232. mlrun/utils/logger.py +106 -4
  233. mlrun/utils/notifications/notification/__init__.py +22 -19
  234. mlrun/utils/notifications/notification/base.py +33 -14
  235. mlrun/utils/notifications/notification/console.py +6 -6
  236. mlrun/utils/notifications/notification/git.py +11 -11
  237. mlrun/utils/notifications/notification/ipython.py +10 -9
  238. mlrun/utils/notifications/notification/mail.py +149 -0
  239. mlrun/utils/notifications/notification/slack.py +6 -6
  240. mlrun/utils/notifications/notification/webhook.py +18 -22
  241. mlrun/utils/notifications/notification_pusher.py +43 -31
  242. mlrun/utils/regex.py +3 -1
  243. mlrun/utils/version/version.json +2 -2
  244. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc2.dist-info}/METADATA +18 -14
  245. mlrun-1.8.0rc2.dist-info/RECORD +358 -0
  246. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc2.dist-info}/WHEEL +1 -1
  247. mlrun-1.7.2rc3.dist-info/RECORD +0 -351
  248. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc2.dist-info}/LICENSE +0 -0
  249. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc2.dist-info}/entry_points.txt +0 -0
  250. {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc2.dist-info}/top_level.txt +0 -0
@@ -396,7 +396,7 @@ class BaseStoreTarget(DataTargetBase):
396
396
  self,
397
397
  name: str = "",
398
398
  path=None,
399
- attributes: dict[str, str] = None,
399
+ attributes: Optional[dict[str, str]] = None,
400
400
  after_step=None,
401
401
  columns=None,
402
402
  partitioned: bool = False,
@@ -405,8 +405,8 @@ class BaseStoreTarget(DataTargetBase):
405
405
  time_partitioning_granularity: Optional[str] = None,
406
406
  max_events: Optional[int] = None,
407
407
  flush_after_seconds: Optional[int] = None,
408
- storage_options: dict[str, str] = None,
409
- schema: dict[str, Any] = None,
408
+ storage_options: Optional[dict[str, str]] = None,
409
+ schema: Optional[dict[str, Any]] = None,
410
410
  credentials_prefix=None,
411
411
  ):
412
412
  super().__init__(
@@ -834,16 +834,16 @@ class ParquetTarget(BaseStoreTarget):
834
834
  self,
835
835
  name: str = "",
836
836
  path=None,
837
- attributes: dict[str, str] = None,
837
+ attributes: Optional[dict[str, str]] = None,
838
838
  after_step=None,
839
839
  columns=None,
840
- partitioned: bool = None,
840
+ partitioned: Optional[bool] = None,
841
841
  key_bucketing_number: Optional[int] = None,
842
842
  partition_cols: Optional[list[str]] = None,
843
843
  time_partitioning_granularity: Optional[str] = None,
844
844
  max_events: Optional[int] = 10000,
845
845
  flush_after_seconds: Optional[int] = 900,
846
- storage_options: dict[str, str] = None,
846
+ storage_options: Optional[dict[str, str]] = None,
847
847
  ):
848
848
  self.path = path
849
849
  if partitioned is None:
@@ -1136,8 +1136,7 @@ class CSVTarget(BaseStoreTarget):
1136
1136
  import pyspark.sql.functions as funcs
1137
1137
 
1138
1138
  for col_name, col_type in df.dtypes:
1139
- # covers TimestampType and TimestampNTZType, which was added in PySpark 3.4.0
1140
- if col_type.startswith("timestamp"):
1139
+ if col_type == "timestamp":
1141
1140
  # df.write.csv saves timestamps with millisecond precision, but we want microsecond precision
1142
1141
  # for compatibility with storey.
1143
1142
  df = df.withColumn(
@@ -1200,7 +1199,7 @@ class SnowflakeTarget(BaseStoreTarget):
1200
1199
  self,
1201
1200
  name: str = "",
1202
1201
  path=None,
1203
- attributes: dict[str, str] = None,
1202
+ attributes: Optional[dict[str, str]] = None,
1204
1203
  after_step=None,
1205
1204
  columns=None,
1206
1205
  partitioned: bool = False,
@@ -1209,15 +1208,15 @@ class SnowflakeTarget(BaseStoreTarget):
1209
1208
  time_partitioning_granularity: Optional[str] = None,
1210
1209
  max_events: Optional[int] = None,
1211
1210
  flush_after_seconds: Optional[int] = None,
1212
- storage_options: dict[str, str] = None,
1213
- schema: dict[str, Any] = None,
1211
+ storage_options: Optional[dict[str, str]] = None,
1212
+ schema: Optional[dict[str, Any]] = None,
1214
1213
  credentials_prefix=None,
1215
- url: str = None,
1216
- user: str = None,
1217
- db_schema: str = None,
1218
- database: str = None,
1219
- warehouse: str = None,
1220
- table_name: str = None,
1214
+ url: Optional[str] = None,
1215
+ user: Optional[str] = None,
1216
+ db_schema: Optional[str] = None,
1217
+ database: Optional[str] = None,
1218
+ warehouse: Optional[str] = None,
1219
+ table_name: Optional[str] = None,
1221
1220
  ):
1222
1221
  attributes = attributes or {}
1223
1222
  if url:
@@ -1904,7 +1903,7 @@ class SQLTarget(BaseStoreTarget):
1904
1903
  self,
1905
1904
  name: str = "",
1906
1905
  path=None,
1907
- attributes: dict[str, str] = None,
1906
+ attributes: Optional[dict[str, str]] = None,
1908
1907
  after_step=None,
1909
1908
  partitioned: bool = False,
1910
1909
  key_bucketing_number: Optional[int] = None,
@@ -1912,16 +1911,16 @@ class SQLTarget(BaseStoreTarget):
1912
1911
  time_partitioning_granularity: Optional[str] = None,
1913
1912
  max_events: Optional[int] = None,
1914
1913
  flush_after_seconds: Optional[int] = None,
1915
- storage_options: dict[str, str] = None,
1916
- db_url: str = None,
1917
- table_name: str = None,
1918
- schema: dict[str, Any] = None,
1914
+ storage_options: Optional[dict[str, str]] = None,
1915
+ db_url: Optional[str] = None,
1916
+ table_name: Optional[str] = None,
1917
+ schema: Optional[dict[str, Any]] = None,
1919
1918
  primary_key_column: str = "",
1920
1919
  if_exists: str = "append",
1921
1920
  create_table: bool = False,
1922
1921
  # create_according_to_data: bool = False,
1923
1922
  varchar_len: int = 50,
1924
- parse_dates: list[str] = None,
1923
+ parse_dates: Optional[list[str]] = None,
1925
1924
  ):
1926
1925
  """
1927
1926
  Write to SqlDB as output target for a flow.
mlrun/datastore/utils.py CHANGED
@@ -26,7 +26,7 @@ import mlrun.datastore
26
26
 
27
27
 
28
28
  def parse_kafka_url(
29
- url: str, brokers: typing.Union[list, str] = None
29
+ url: str, brokers: typing.Optional[typing.Union[list, str]] = None
30
30
  ) -> tuple[str, list]:
31
31
  """Generating Kafka topic and adjusting a list of bootstrap servers.
32
32
 
@@ -71,7 +71,7 @@ def upload_tarball(source_dir, target, secrets=None):
71
71
 
72
72
  def filter_df_start_end_time(
73
73
  df: typing.Union[pd.DataFrame, typing.Iterator[pd.DataFrame]],
74
- time_column: str = None,
74
+ time_column: typing.Optional[str] = None,
75
75
  start_time: pd.Timestamp = None,
76
76
  end_time: pd.Timestamp = None,
77
77
  ) -> typing.Union[pd.DataFrame, typing.Iterator[pd.DataFrame]]:
mlrun/datastore/v3io.py CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  import time
16
16
  from datetime import datetime
17
+ from typing import Optional
17
18
 
18
19
  import fsspec
19
20
  import v3io
@@ -33,7 +34,9 @@ V3IO_DEFAULT_UPLOAD_CHUNK_SIZE = 1024 * 1024 * 10
33
34
 
34
35
 
35
36
  class V3ioStore(DataStore):
36
- def __init__(self, parent, schema, name, endpoint="", secrets: dict = None):
37
+ def __init__(
38
+ self, parent, schema, name, endpoint="", secrets: Optional[dict] = None
39
+ ):
37
40
  super().__init__(parent, name, schema, endpoint, secrets=secrets)
38
41
  self.endpoint = self.endpoint or mlrun.mlconf.v3io_api
39
42
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from typing import Optional
15
16
  from urllib.parse import urlparse
16
17
 
17
18
  from fsspec import AbstractFileSystem
@@ -22,23 +23,23 @@ class WasbFS(AbstractFileSystem):
22
23
 
23
24
  def __init__(
24
25
  self,
25
- account_name: str = None,
26
- account_key: str = None,
27
- connection_string: str = None,
28
- credential: str = None,
29
- sas_token: str = None,
26
+ account_name: Optional[str] = None,
27
+ account_key: Optional[str] = None,
28
+ connection_string: Optional[str] = None,
29
+ credential: Optional[str] = None,
30
+ sas_token: Optional[str] = None,
30
31
  request_session=None,
31
- socket_timeout: int = None,
32
- blocksize: int = None,
33
- client_id: str = None,
34
- client_secret: str = None,
35
- tenant_id: str = None,
32
+ socket_timeout: Optional[int] = None,
33
+ blocksize: Optional[int] = None,
34
+ client_id: Optional[str] = None,
35
+ client_secret: Optional[str] = None,
36
+ tenant_id: Optional[str] = None,
36
37
  anon: bool = True,
37
- location_mode: str = None,
38
+ location_mode: Optional[str] = None,
38
39
  loop=None,
39
40
  asynchronous: bool = False,
40
41
  default_fill_cache: bool = True,
41
- default_cache_type: str = None,
42
+ default_cache_type: Optional[str] = None,
42
43
  **kwargs,
43
44
  ):
44
45
  from adlfs import AzureBlobFileSystem
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,7 @@ 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.model_endpoints as mm_endpoints
26
27
  import mlrun.model_monitoring
27
28
 
28
29
 
@@ -73,7 +74,7 @@ class RunDBInterface(ABC):
73
74
  name: Optional[str] = None,
74
75
  uid: Optional[Union[str, list[str]]] = None,
75
76
  project: Optional[str] = None,
76
- labels: Optional[Union[str, list[str]]] = None,
77
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
77
78
  state: Optional[
78
79
  mlrun.common.runtimes.constants.RunStates
79
80
  ] = None, # Backward compatibility
@@ -81,10 +82,10 @@ class RunDBInterface(ABC):
81
82
  sort: bool = True,
82
83
  last: int = 0,
83
84
  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,
85
+ start_time_from: Optional[datetime.datetime] = None,
86
+ start_time_to: Optional[datetime.datetime] = None,
87
+ last_update_time_from: Optional[datetime.datetime] = None,
88
+ last_update_time_to: Optional[datetime.datetime] = None,
88
89
  partition_by: Union[mlrun.common.schemas.RunPartitionByField, str] = None,
89
90
  rows_per_partition: int = 1,
90
91
  partition_sort_by: Union[mlrun.common.schemas.SortField, str] = None,
@@ -96,12 +97,30 @@ class RunDBInterface(ABC):
96
97
  ):
97
98
  pass
98
99
 
100
+ @abstractmethod
101
+ def paginated_list_runs(
102
+ self,
103
+ *args,
104
+ page: Optional[int] = None,
105
+ page_size: Optional[int] = None,
106
+ page_token: Optional[str] = None,
107
+ **kwargs,
108
+ ):
109
+ pass
110
+
99
111
  @abstractmethod
100
112
  def del_run(self, uid, project="", iter=0):
101
113
  pass
102
114
 
103
115
  @abstractmethod
104
- def del_runs(self, name="", project="", labels=None, state="", days_ago=0):
116
+ def del_runs(
117
+ self,
118
+ name: str = "",
119
+ project: str = "",
120
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
121
+ state: Optional[mlrun.common.runtimes.constants.RunStates] = None,
122
+ days_ago: int = 0,
123
+ ):
105
124
  pass
106
125
 
107
126
  @abstractmethod
@@ -126,19 +145,30 @@ class RunDBInterface(ABC):
126
145
  @abstractmethod
127
146
  def list_artifacts(
128
147
  self,
129
- name="",
130
- project="",
131
- tag="",
132
- labels=None,
148
+ name: Optional[str] = "",
149
+ project: Optional[str] = "",
150
+ tag: Optional[str] = "",
151
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
133
152
  since=None,
134
153
  until=None,
135
- iter: int = None,
154
+ iter: Optional[int] = None,
136
155
  best_iteration: bool = False,
137
- kind: str = None,
156
+ kind: Optional[str] = None,
138
157
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
139
- tree: str = None,
158
+ tree: Optional[str] = None,
140
159
  format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
141
- limit: int = None,
160
+ limit: Optional[int] = None,
161
+ ):
162
+ pass
163
+
164
+ @abstractmethod
165
+ def paginated_list_artifacts(
166
+ self,
167
+ *args,
168
+ page: Optional[int] = None,
169
+ page_size: Optional[int] = None,
170
+ page_token: Optional[str] = None,
171
+ **kwargs,
142
172
  ):
143
173
  pass
144
174
 
@@ -153,13 +183,19 @@ class RunDBInterface(ABC):
153
183
  deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
154
184
  mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
155
185
  ),
156
- secrets: dict = None,
186
+ secrets: Optional[dict] = None,
157
187
  iter=None,
158
188
  ):
159
189
  pass
160
190
 
161
191
  @abstractmethod
162
- def del_artifacts(self, name="", project="", tag="", labels=None):
192
+ def del_artifacts(
193
+ self,
194
+ name: Optional[str] = "",
195
+ project: Optional[str] = "",
196
+ tag: Optional[str] = "",
197
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
198
+ ):
163
199
  pass
164
200
 
165
201
  @abstractmethod
@@ -176,7 +212,26 @@ class RunDBInterface(ABC):
176
212
 
177
213
  @abstractmethod
178
214
  def list_functions(
179
- self, name=None, project="", tag="", labels=None, since=None, until=None
215
+ self,
216
+ name: Optional[str] = None,
217
+ project: Optional[str] = None,
218
+ tag: Optional[str] = None,
219
+ kind: Optional[str] = None,
220
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
221
+ format_: mlrun.common.formatters.FunctionFormat = mlrun.common.formatters.FunctionFormat.full,
222
+ since: Optional[datetime.datetime] = None,
223
+ until: Optional[datetime.datetime] = None,
224
+ ):
225
+ pass
226
+
227
+ @abstractmethod
228
+ def paginated_list_functions(
229
+ self,
230
+ *args,
231
+ page: Optional[int] = None,
232
+ page_size: Optional[int] = None,
233
+ page_token: Optional[str] = None,
234
+ **kwargs,
180
235
  ):
181
236
  pass
182
237
 
@@ -254,6 +309,14 @@ class RunDBInterface(ABC):
254
309
  kind="artifact", identifiers=artifact_identifiers
255
310
  )
256
311
 
312
+ def get_model_endpoint_monitoring_metrics(
313
+ self,
314
+ project: str,
315
+ endpoint_id: str,
316
+ type: Literal["results", "metrics", "all"] = "all",
317
+ ) -> list[mm_endpoints.ModelEndpointMonitoringMetric]:
318
+ pass
319
+
257
320
  @abstractmethod
258
321
  def delete_project(
259
322
  self,
@@ -289,9 +352,9 @@ class RunDBInterface(ABC):
289
352
  @abstractmethod
290
353
  def list_projects(
291
354
  self,
292
- owner: str = None,
355
+ owner: Optional[str] = None,
293
356
  format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
294
- labels: list[str] = None,
357
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
295
358
  state: mlrun.common.schemas.ProjectState = None,
296
359
  ) -> mlrun.common.schemas.ProjectsOutput:
297
360
  pass
@@ -319,7 +382,11 @@ class RunDBInterface(ABC):
319
382
 
320
383
  @abstractmethod
321
384
  def get_feature_set(
322
- self, name: str, project: str = "", tag: str = None, uid: str = None
385
+ self,
386
+ name: str,
387
+ project: str = "",
388
+ tag: Optional[str] = None,
389
+ uid: Optional[str] = None,
323
390
  ) -> dict:
324
391
  pass
325
392
 
@@ -333,10 +400,10 @@ class RunDBInterface(ABC):
333
400
  def list_features(
334
401
  self,
335
402
  project: str,
336
- name: str = None,
337
- tag: str = None,
338
- entities: list[str] = None,
339
- 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,
340
407
  ) -> mlrun.common.schemas.FeaturesOutput:
341
408
  pass
342
409
 
@@ -344,10 +411,10 @@ class RunDBInterface(ABC):
344
411
  def list_features_v2(
345
412
  self,
346
413
  project: str,
347
- name: str = None,
348
- tag: str = None,
349
- entities: list[str] = None,
350
- labels: list[str] = None,
414
+ name: Optional[str] = None,
415
+ tag: Optional[str] = None,
416
+ entities: Optional[list[str]] = None,
417
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
351
418
  ) -> mlrun.common.schemas.FeaturesOutputV2:
352
419
  pass
353
420
 
@@ -361,9 +428,9 @@ class RunDBInterface(ABC):
361
428
  def list_entities(
362
429
  self,
363
430
  project: str,
364
- name: str = None,
365
- tag: str = None,
366
- labels: list[str] = None,
431
+ name: Optional[str] = None,
432
+ tag: Optional[str] = None,
433
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
367
434
  ) -> mlrun.common.schemas.EntitiesOutput:
368
435
  pass
369
436
 
@@ -371,9 +438,9 @@ class RunDBInterface(ABC):
371
438
  def list_entities_v2(
372
439
  self,
373
440
  project: str,
374
- name: str = None,
375
- tag: str = None,
376
- labels: list[str] = None,
441
+ name: Optional[str] = None,
442
+ tag: Optional[str] = None,
443
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
377
444
  ) -> mlrun.common.schemas.EntitiesOutputV2:
378
445
  pass
379
446
 
@@ -381,12 +448,12 @@ class RunDBInterface(ABC):
381
448
  def list_feature_sets(
382
449
  self,
383
450
  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,
451
+ name: Optional[str] = None,
452
+ tag: Optional[str] = None,
453
+ state: Optional[str] = None,
454
+ entities: Optional[list[str]] = None,
455
+ features: Optional[list[str]] = None,
456
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
390
457
  partition_by: Union[
391
458
  mlrun.common.schemas.FeatureStorePartitionByField, str
392
459
  ] = None,
@@ -442,7 +509,11 @@ class RunDBInterface(ABC):
442
509
 
443
510
  @abstractmethod
444
511
  def get_feature_vector(
445
- self, name: str, project: str = "", tag: str = None, uid: str = None
512
+ self,
513
+ name: str,
514
+ project: str = "",
515
+ tag: Optional[str] = None,
516
+ uid: Optional[str] = None,
446
517
  ) -> dict:
447
518
  pass
448
519
 
@@ -450,10 +521,10 @@ class RunDBInterface(ABC):
450
521
  def list_feature_vectors(
451
522
  self,
452
523
  project: str = "",
453
- name: str = None,
454
- tag: str = None,
455
- state: str = None,
456
- labels: list[str] = None,
524
+ name: Optional[str] = None,
525
+ tag: Optional[str] = None,
526
+ state: Optional[str] = None,
527
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
457
528
  partition_by: Union[
458
529
  mlrun.common.schemas.FeatureStorePartitionByField, str
459
530
  ] = None,
@@ -499,12 +570,12 @@ class RunDBInterface(ABC):
499
570
  def get_pipeline(
500
571
  self,
501
572
  run_id: str,
502
- namespace: str = None,
573
+ namespace: Optional[str] = None,
503
574
  timeout: int = 30,
504
575
  format_: Union[
505
576
  str, mlrun.common.formatters.PipelineFormat
506
577
  ] = mlrun.common.formatters.PipelineFormat.summary,
507
- project: str = None,
578
+ project: Optional[str] = None,
508
579
  ):
509
580
  pass
510
581
 
@@ -512,14 +583,14 @@ class RunDBInterface(ABC):
512
583
  def list_pipelines(
513
584
  self,
514
585
  project: str,
515
- namespace: str = None,
586
+ namespace: Optional[str] = None,
516
587
  sort_by: str = "",
517
588
  page_token: str = "",
518
589
  filter_: str = "",
519
590
  format_: Union[
520
591
  str, mlrun.common.formatters.PipelineFormat
521
592
  ] = mlrun.common.formatters.PipelineFormat.metadata_only,
522
- page_size: int = None,
593
+ page_size: Optional[int] = None,
523
594
  ) -> mlrun.common.schemas.PipelinesOutput:
524
595
  pass
525
596
 
@@ -530,7 +601,7 @@ class RunDBInterface(ABC):
530
601
  provider: Union[
531
602
  str, mlrun.common.schemas.SecretProviderName
532
603
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
533
- secrets: dict = None,
604
+ secrets: Optional[dict] = None,
534
605
  ):
535
606
  pass
536
607
 
@@ -542,7 +613,7 @@ class RunDBInterface(ABC):
542
613
  provider: Union[
543
614
  str, mlrun.common.schemas.SecretProviderName
544
615
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
545
- secrets: list[str] = None,
616
+ secrets: Optional[list[str]] = None,
546
617
  ) -> mlrun.common.schemas.SecretsData:
547
618
  pass
548
619
 
@@ -553,7 +624,7 @@ class RunDBInterface(ABC):
553
624
  provider: Union[
554
625
  str, mlrun.common.schemas.SecretProviderName
555
626
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
556
- token: str = None,
627
+ token: Optional[str] = None,
557
628
  ) -> mlrun.common.schemas.SecretKeysData:
558
629
  pass
559
630
 
@@ -564,7 +635,7 @@ class RunDBInterface(ABC):
564
635
  provider: Union[
565
636
  str, mlrun.common.schemas.SecretProviderName
566
637
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
567
- secrets: list[str] = None,
638
+ secrets: Optional[list[str]] = None,
568
639
  ):
569
640
  pass
570
641
 
@@ -575,7 +646,7 @@ class RunDBInterface(ABC):
575
646
  provider: Union[
576
647
  str, mlrun.common.schemas.SecretProviderName
577
648
  ] = mlrun.common.schemas.SecretProviderName.vault,
578
- secrets: dict = None,
649
+ secrets: Optional[dict] = None,
579
650
  ):
580
651
  pass
581
652
 
@@ -602,11 +673,13 @@ class RunDBInterface(ABC):
602
673
  project: str,
603
674
  model: Optional[str] = None,
604
675
  function: Optional[str] = None,
605
- labels: list[str] = None,
676
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
606
677
  start: str = "now-1h",
607
678
  end: str = "now",
608
679
  metrics: Optional[list[str]] = None,
609
- ):
680
+ top_level: bool = False,
681
+ uids: Optional[list[str]] = None,
682
+ ) -> list[mlrun.model_monitoring.model_endpoint.ModelEndpoint]:
610
683
  pass
611
684
 
612
685
  @abstractmethod
@@ -665,8 +738,8 @@ class RunDBInterface(ABC):
665
738
  def get_hub_catalog(
666
739
  self,
667
740
  source_name: str,
668
- version: str = None,
669
- tag: str = None,
741
+ version: Optional[str] = None,
742
+ tag: Optional[str] = None,
670
743
  force_refresh: bool = False,
671
744
  ):
672
745
  pass
@@ -676,7 +749,7 @@ class RunDBInterface(ABC):
676
749
  self,
677
750
  source_name: str,
678
751
  item_name: str,
679
- version: str = None,
752
+ version: Optional[str] = None,
680
753
  tag: str = "latest",
681
754
  force_refresh: bool = False,
682
755
  ):
@@ -744,6 +817,7 @@ class RunDBInterface(ABC):
744
817
  alert_name: str,
745
818
  alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
746
819
  project="",
820
+ force_reset: bool = False,
747
821
  ):
748
822
  pass
749
823
 
@@ -771,6 +845,35 @@ class RunDBInterface(ABC):
771
845
  def list_alert_templates(self):
772
846
  pass
773
847
 
848
+ @abstractmethod
849
+ def list_alert_activations(
850
+ self,
851
+ project: Optional[str] = None,
852
+ name: Optional[str] = None,
853
+ since: Optional[datetime.datetime] = None,
854
+ until: Optional[datetime.datetime] = None,
855
+ entity: Optional[str] = None,
856
+ severity: Optional[
857
+ list[Union[mlrun.common.schemas.alert.AlertSeverity, str]]
858
+ ] = None,
859
+ entity_kind: Optional[
860
+ Union[mlrun.common.schemas.alert.EventEntityKind, str]
861
+ ] = None,
862
+ event_kind: Optional[Union[mlrun.common.schemas.alert.EventKind, str]] = None,
863
+ ):
864
+ pass
865
+
866
+ @abstractmethod
867
+ def paginated_list_alert_activations(
868
+ self,
869
+ *args,
870
+ page: Optional[int] = None,
871
+ page_size: Optional[int] = None,
872
+ page_token: Optional[str] = None,
873
+ **kwargs,
874
+ ):
875
+ pass
876
+
774
877
  @abstractmethod
775
878
  def get_builder_status(
776
879
  self,
@@ -779,6 +882,7 @@ class RunDBInterface(ABC):
779
882
  logs: bool = True,
780
883
  last_log_timestamp: float = 0.0,
781
884
  verbose: bool = False,
885
+ events_offset: int = 0,
782
886
  ):
783
887
  pass
784
888
 
@@ -805,7 +909,7 @@ class RunDBInterface(ABC):
805
909
  self,
806
910
  notification_objects: list[mlrun.model.Notification],
807
911
  run_uid: str,
808
- project: str = None,
912
+ project: Optional[str] = None,
809
913
  mask_params: bool = True,
810
914
  ):
811
915
  pass
@@ -859,7 +963,9 @@ class RunDBInterface(ABC):
859
963
 
860
964
  @abstractmethod
861
965
  def start_function(
862
- self, func_url: str = None, function: "mlrun.runtimes.BaseRuntime" = None
966
+ self,
967
+ func_url: Optional[str] = None,
968
+ function: "mlrun.runtimes.BaseRuntime" = None,
863
969
  ):
864
970
  pass
865
971
 
@@ -878,7 +984,7 @@ class RunDBInterface(ABC):
878
984
  source: Optional[str] = None,
879
985
  run_name: Optional[str] = None,
880
986
  namespace: Optional[str] = None,
881
- notifications: list["mlrun.model.Notification"] = None,
987
+ notifications: Optional[list["mlrun.model.Notification"]] = None,
882
988
  ) -> "mlrun.common.schemas.WorkflowResponse":
883
989
  pass
884
990
 
@@ -911,7 +1017,7 @@ class RunDBInterface(ABC):
911
1017
  delete_stream_function: bool = False,
912
1018
  delete_histogram_data_drift_app: bool = True,
913
1019
  delete_user_applications: bool = False,
914
- user_application_list: list[str] = None,
1020
+ user_application_list: Optional[list[str]] = None,
915
1021
  ) -> bool:
916
1022
  pass
917
1023