mlrun 1.6.0rc35__py3-none-any.whl → 1.7.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 (199) hide show
  1. mlrun/__main__.py +3 -3
  2. mlrun/api/schemas/__init__.py +1 -1
  3. mlrun/artifacts/base.py +11 -6
  4. mlrun/artifacts/dataset.py +2 -2
  5. mlrun/artifacts/model.py +30 -24
  6. mlrun/artifacts/plots.py +2 -2
  7. mlrun/common/db/sql_session.py +5 -3
  8. mlrun/common/helpers.py +1 -2
  9. mlrun/common/schemas/artifact.py +3 -3
  10. mlrun/common/schemas/auth.py +3 -3
  11. mlrun/common/schemas/background_task.py +1 -1
  12. mlrun/common/schemas/client_spec.py +1 -1
  13. mlrun/common/schemas/feature_store.py +16 -16
  14. mlrun/common/schemas/frontend_spec.py +7 -7
  15. mlrun/common/schemas/function.py +1 -1
  16. mlrun/common/schemas/hub.py +4 -9
  17. mlrun/common/schemas/memory_reports.py +2 -2
  18. mlrun/common/schemas/model_monitoring/grafana.py +4 -4
  19. mlrun/common/schemas/model_monitoring/model_endpoints.py +14 -15
  20. mlrun/common/schemas/notification.py +4 -4
  21. mlrun/common/schemas/object.py +2 -2
  22. mlrun/common/schemas/pipeline.py +1 -1
  23. mlrun/common/schemas/project.py +3 -3
  24. mlrun/common/schemas/runtime_resource.py +8 -12
  25. mlrun/common/schemas/schedule.py +3 -3
  26. mlrun/common/schemas/tag.py +1 -2
  27. mlrun/common/schemas/workflow.py +2 -2
  28. mlrun/config.py +8 -4
  29. mlrun/data_types/to_pandas.py +1 -3
  30. mlrun/datastore/base.py +0 -28
  31. mlrun/datastore/datastore_profile.py +9 -9
  32. mlrun/datastore/filestore.py +0 -1
  33. mlrun/datastore/google_cloud_storage.py +1 -1
  34. mlrun/datastore/sources.py +7 -11
  35. mlrun/datastore/spark_utils.py +1 -2
  36. mlrun/datastore/targets.py +31 -31
  37. mlrun/datastore/utils.py +4 -6
  38. mlrun/datastore/v3io.py +70 -46
  39. mlrun/db/base.py +22 -23
  40. mlrun/db/httpdb.py +34 -34
  41. mlrun/db/nopdb.py +19 -19
  42. mlrun/errors.py +1 -1
  43. mlrun/execution.py +4 -4
  44. mlrun/feature_store/api.py +20 -21
  45. mlrun/feature_store/common.py +1 -1
  46. mlrun/feature_store/feature_set.py +28 -32
  47. mlrun/feature_store/feature_vector.py +24 -27
  48. mlrun/feature_store/retrieval/base.py +7 -7
  49. mlrun/feature_store/retrieval/conversion.py +2 -4
  50. mlrun/feature_store/steps.py +7 -15
  51. mlrun/features.py +5 -7
  52. mlrun/frameworks/_common/artifacts_library.py +9 -9
  53. mlrun/frameworks/_common/mlrun_interface.py +5 -5
  54. mlrun/frameworks/_common/model_handler.py +48 -48
  55. mlrun/frameworks/_common/plan.py +2 -3
  56. mlrun/frameworks/_common/producer.py +3 -4
  57. mlrun/frameworks/_common/utils.py +5 -5
  58. mlrun/frameworks/_dl_common/loggers/logger.py +6 -7
  59. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +9 -9
  60. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +16 -35
  61. mlrun/frameworks/_ml_common/artifacts_library.py +1 -2
  62. mlrun/frameworks/_ml_common/loggers/logger.py +3 -4
  63. mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +4 -5
  64. mlrun/frameworks/_ml_common/model_handler.py +24 -24
  65. mlrun/frameworks/_ml_common/pkl_model_server.py +2 -2
  66. mlrun/frameworks/_ml_common/plan.py +1 -1
  67. mlrun/frameworks/_ml_common/plans/calibration_curve_plan.py +2 -3
  68. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +2 -3
  69. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  70. mlrun/frameworks/_ml_common/plans/feature_importance_plan.py +3 -3
  71. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  72. mlrun/frameworks/_ml_common/utils.py +4 -4
  73. mlrun/frameworks/auto_mlrun/auto_mlrun.py +7 -7
  74. mlrun/frameworks/huggingface/model_server.py +4 -4
  75. mlrun/frameworks/lgbm/__init__.py +32 -32
  76. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -5
  77. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -5
  78. mlrun/frameworks/lgbm/mlrun_interfaces/booster_mlrun_interface.py +1 -3
  79. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +6 -6
  80. mlrun/frameworks/lgbm/model_handler.py +9 -9
  81. mlrun/frameworks/lgbm/model_server.py +6 -6
  82. mlrun/frameworks/lgbm/utils.py +5 -5
  83. mlrun/frameworks/onnx/dataset.py +8 -8
  84. mlrun/frameworks/onnx/mlrun_interface.py +3 -3
  85. mlrun/frameworks/onnx/model_handler.py +6 -6
  86. mlrun/frameworks/onnx/model_server.py +7 -7
  87. mlrun/frameworks/parallel_coordinates.py +2 -2
  88. mlrun/frameworks/pytorch/__init__.py +16 -16
  89. mlrun/frameworks/pytorch/callbacks/callback.py +4 -5
  90. mlrun/frameworks/pytorch/callbacks/logging_callback.py +17 -17
  91. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +11 -11
  92. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +23 -29
  93. mlrun/frameworks/pytorch/callbacks_handler.py +38 -38
  94. mlrun/frameworks/pytorch/mlrun_interface.py +20 -20
  95. mlrun/frameworks/pytorch/model_handler.py +17 -17
  96. mlrun/frameworks/pytorch/model_server.py +7 -7
  97. mlrun/frameworks/sklearn/__init__.py +12 -12
  98. mlrun/frameworks/sklearn/estimator.py +4 -4
  99. mlrun/frameworks/sklearn/metrics_library.py +14 -14
  100. mlrun/frameworks/sklearn/mlrun_interface.py +3 -6
  101. mlrun/frameworks/sklearn/model_handler.py +2 -2
  102. mlrun/frameworks/tf_keras/__init__.py +5 -5
  103. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +14 -14
  104. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +11 -11
  105. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +19 -23
  106. mlrun/frameworks/tf_keras/mlrun_interface.py +7 -9
  107. mlrun/frameworks/tf_keras/model_handler.py +14 -14
  108. mlrun/frameworks/tf_keras/model_server.py +6 -6
  109. mlrun/frameworks/xgboost/__init__.py +12 -12
  110. mlrun/frameworks/xgboost/model_handler.py +6 -6
  111. mlrun/k8s_utils.py +4 -5
  112. mlrun/kfpops.py +2 -2
  113. mlrun/launcher/base.py +10 -10
  114. mlrun/launcher/local.py +8 -8
  115. mlrun/launcher/remote.py +7 -7
  116. mlrun/lists.py +3 -4
  117. mlrun/model.py +205 -55
  118. mlrun/model_monitoring/api.py +21 -24
  119. mlrun/model_monitoring/application.py +4 -4
  120. mlrun/model_monitoring/batch.py +17 -17
  121. mlrun/model_monitoring/controller.py +2 -1
  122. mlrun/model_monitoring/features_drift_table.py +44 -31
  123. mlrun/model_monitoring/prometheus.py +1 -4
  124. mlrun/model_monitoring/stores/kv_model_endpoint_store.py +11 -13
  125. mlrun/model_monitoring/stores/model_endpoint_store.py +9 -11
  126. mlrun/model_monitoring/stores/models/__init__.py +2 -2
  127. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +11 -13
  128. mlrun/model_monitoring/stream_processing.py +16 -34
  129. mlrun/model_monitoring/tracking_policy.py +2 -1
  130. mlrun/package/__init__.py +6 -6
  131. mlrun/package/context_handler.py +5 -5
  132. mlrun/package/packager.py +7 -7
  133. mlrun/package/packagers/default_packager.py +6 -6
  134. mlrun/package/packagers/numpy_packagers.py +15 -15
  135. mlrun/package/packagers/pandas_packagers.py +5 -5
  136. mlrun/package/packagers/python_standard_library_packagers.py +10 -10
  137. mlrun/package/packagers_manager.py +18 -23
  138. mlrun/package/utils/_formatter.py +4 -4
  139. mlrun/package/utils/_pickler.py +2 -2
  140. mlrun/package/utils/_supported_format.py +4 -4
  141. mlrun/package/utils/log_hint_utils.py +2 -2
  142. mlrun/package/utils/type_hint_utils.py +4 -9
  143. mlrun/platforms/other.py +1 -2
  144. mlrun/projects/operations.py +5 -5
  145. mlrun/projects/pipelines.py +9 -9
  146. mlrun/projects/project.py +58 -46
  147. mlrun/render.py +1 -1
  148. mlrun/run.py +9 -9
  149. mlrun/runtimes/__init__.py +7 -4
  150. mlrun/runtimes/base.py +20 -23
  151. mlrun/runtimes/constants.py +5 -5
  152. mlrun/runtimes/daskjob.py +8 -8
  153. mlrun/runtimes/databricks_job/databricks_cancel_task.py +1 -1
  154. mlrun/runtimes/databricks_job/databricks_runtime.py +7 -7
  155. mlrun/runtimes/function_reference.py +1 -1
  156. mlrun/runtimes/local.py +1 -1
  157. mlrun/runtimes/mpijob/abstract.py +1 -2
  158. mlrun/runtimes/nuclio/__init__.py +20 -0
  159. mlrun/runtimes/{function.py → nuclio/function.py} +15 -16
  160. mlrun/runtimes/{nuclio.py → nuclio/nuclio.py} +6 -6
  161. mlrun/runtimes/{serving.py → nuclio/serving.py} +13 -12
  162. mlrun/runtimes/pod.py +95 -48
  163. mlrun/runtimes/remotesparkjob.py +1 -1
  164. mlrun/runtimes/sparkjob/spark3job.py +50 -33
  165. mlrun/runtimes/utils.py +1 -2
  166. mlrun/secrets.py +3 -3
  167. mlrun/serving/remote.py +0 -4
  168. mlrun/serving/routers.py +6 -6
  169. mlrun/serving/server.py +4 -4
  170. mlrun/serving/states.py +29 -0
  171. mlrun/serving/utils.py +3 -3
  172. mlrun/serving/v1_serving.py +6 -7
  173. mlrun/serving/v2_serving.py +50 -8
  174. mlrun/track/tracker_manager.py +3 -3
  175. mlrun/track/trackers/mlflow_tracker.py +1 -2
  176. mlrun/utils/async_http.py +5 -7
  177. mlrun/utils/azure_vault.py +1 -1
  178. mlrun/utils/clones.py +1 -2
  179. mlrun/utils/condition_evaluator.py +3 -3
  180. mlrun/utils/db.py +3 -3
  181. mlrun/utils/helpers.py +37 -119
  182. mlrun/utils/http.py +1 -4
  183. mlrun/utils/logger.py +49 -14
  184. mlrun/utils/notifications/notification/__init__.py +3 -3
  185. mlrun/utils/notifications/notification/base.py +2 -2
  186. mlrun/utils/notifications/notification/ipython.py +1 -1
  187. mlrun/utils/notifications/notification_pusher.py +8 -14
  188. mlrun/utils/retryer.py +207 -0
  189. mlrun/utils/singleton.py +1 -1
  190. mlrun/utils/v3io_clients.py +2 -3
  191. mlrun/utils/version/version.json +2 -2
  192. mlrun/utils/version/version.py +2 -6
  193. {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/METADATA +9 -9
  194. mlrun-1.7.0rc2.dist-info/RECORD +315 -0
  195. mlrun-1.6.0rc35.dist-info/RECORD +0 -313
  196. {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/LICENSE +0 -0
  197. {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/WHEEL +0 -0
  198. {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/entry_points.txt +0 -0
  199. {mlrun-1.6.0rc35.dist-info → mlrun-1.7.0rc2.dist-info}/top_level.txt +0 -0
mlrun/datastore/utils.py CHANGED
@@ -70,9 +70,7 @@ def store_path_to_spark(path, spark_options=None):
70
70
  return path
71
71
 
72
72
 
73
- def parse_kafka_url(
74
- url: str, bootstrap_servers: typing.List = None
75
- ) -> typing.Tuple[str, typing.List]:
73
+ def parse_kafka_url(url: str, bootstrap_servers: list = None) -> tuple[str, list]:
76
74
  """Generating Kafka topic and adjusting a list of bootstrap servers.
77
75
 
78
76
  :param url: URL path to parse using urllib.parse.urlparse.
@@ -157,7 +155,7 @@ def _execute_time_filter(
157
155
 
158
156
  def select_columns_from_df(
159
157
  df: typing.Union[pd.DataFrame, typing.Iterator[pd.DataFrame]],
160
- columns: typing.List[str],
158
+ columns: list[str],
161
159
  ) -> typing.Union[pd.DataFrame, typing.Iterator[pd.DataFrame]]:
162
160
  if not columns:
163
161
  return df
@@ -169,7 +167,7 @@ def select_columns_from_df(
169
167
 
170
168
  def select_columns_generator(
171
169
  dfs: typing.Union[pd.DataFrame, typing.Iterator[pd.DataFrame]],
172
- columns: typing.List[str],
170
+ columns: list[str],
173
171
  ) -> typing.Iterator[pd.DataFrame]:
174
172
  for df in dfs:
175
173
  yield df[columns]
@@ -179,7 +177,7 @@ def _generate_sql_query_with_time_filter(
179
177
  table_name: str,
180
178
  engine: "sqlalchemy.engine.Engine", # noqa: F821,
181
179
  time_column: str,
182
- parse_dates: typing.List[str],
180
+ parse_dates: list[str],
183
181
  start_time: pd.Timestamp,
184
182
  end_time: pd.Timestamp,
185
183
  ):
mlrun/datastore/v3io.py CHANGED
@@ -15,12 +15,11 @@
15
15
  import mmap
16
16
  import os
17
17
  import time
18
- from copy import deepcopy
19
18
  from datetime import datetime
20
19
 
21
20
  import fsspec
22
- import requests
23
- import v3io.dataplane
21
+ import v3io
22
+ from v3io.dataplane.response import HttpResponseError
24
23
 
25
24
  import mlrun
26
25
  from mlrun.datastore.helpers import ONE_GB, ONE_MB
@@ -30,11 +29,6 @@ from .base import (
30
29
  DataStore,
31
30
  FileStats,
32
31
  basic_auth_header,
33
- get_range,
34
- http_get,
35
- http_head,
36
- http_put,
37
- http_upload,
38
32
  )
39
33
 
40
34
  V3IO_LOCAL_ROOT = "v3io"
@@ -47,17 +41,18 @@ class V3ioStore(DataStore):
47
41
 
48
42
  self.headers = None
49
43
  self.secure = self.kind == "v3ios"
44
+
45
+ token = self._get_secret_or_env("V3IO_ACCESS_KEY")
46
+ username = self._get_secret_or_env("V3IO_USERNAME")
47
+ password = self._get_secret_or_env("V3IO_PASSWORD")
50
48
  if self.endpoint.startswith("https://"):
51
49
  self.endpoint = self.endpoint[len("https://") :]
52
50
  self.secure = True
53
51
  elif self.endpoint.startswith("http://"):
54
52
  self.endpoint = self.endpoint[len("http://") :]
55
53
  self.secure = False
56
-
57
- token = self._get_secret_or_env("V3IO_ACCESS_KEY")
58
- username = self._get_secret_or_env("V3IO_USERNAME")
59
- password = self._get_secret_or_env("V3IO_PASSWORD")
60
-
54
+ self.client = v3io.dataplane.Client(access_key=token, endpoint=self.url)
55
+ self.object = self.client.object
61
56
  self.auth = None
62
57
  self.token = token
63
58
  if token:
@@ -65,6 +60,16 @@ class V3ioStore(DataStore):
65
60
  elif username and password:
66
61
  self.headers = basic_auth_header(username, password)
67
62
 
63
+ @staticmethod
64
+ def _do_object_request(function: callable, *args, **kwargs):
65
+ try:
66
+ return function(*args, **kwargs)
67
+ except HttpResponseError as http_response_error:
68
+ raise mlrun.errors.err_for_status_code(
69
+ status_code=http_response_error.status_code,
70
+ message=mlrun.errors.err_to_str(http_response_error),
71
+ )
72
+
68
73
  @staticmethod
69
74
  def uri_to_ipython(endpoint, subpath):
70
75
  return V3IO_LOCAL_ROOT + subpath
@@ -91,13 +96,19 @@ class V3ioStore(DataStore):
91
96
 
92
97
  def _upload(self, key: str, src_path: str, max_chunk_size: int = ONE_GB):
93
98
  """helper function for upload method, allows for controlling max_chunk_size in testing"""
99
+ container, path = split_path(self._join(key))
94
100
  file_size = os.path.getsize(src_path) # in bytes
95
101
  if file_size <= ONE_MB:
96
- http_upload(self.url + self._join(key), src_path, self.headers, None)
102
+ with open(src_path, "rb") as source_file:
103
+ data = source_file.read()
104
+ self._do_object_request(
105
+ self.object.put,
106
+ container=container,
107
+ path=path,
108
+ body=data,
109
+ append=False,
110
+ )
97
111
  return
98
- append_header = deepcopy(self.headers)
99
- append_header["Range"] = "-1"
100
-
101
112
  # chunk must be a multiple of the ALLOCATIONGRANULARITY
102
113
  # https://docs.python.org/3/library/mmap.html
103
114
  if residue := max_chunk_size % mmap.ALLOCATIONGRANULARITY:
@@ -114,11 +125,13 @@ class V3ioStore(DataStore):
114
125
  access=mmap.ACCESS_READ,
115
126
  offset=file_offset,
116
127
  ) as mmap_obj:
117
- http_put(
118
- self.url + self._join(key),
119
- mmap_obj,
120
- append_header if file_offset else self.headers,
121
- None,
128
+ append = file_offset != 0
129
+ self._do_object_request(
130
+ self.object.put,
131
+ container=container,
132
+ path=path,
133
+ body=mmap_obj,
134
+ append=append,
122
135
  )
123
136
  file_offset += chunk_size
124
137
 
@@ -126,43 +139,55 @@ class V3ioStore(DataStore):
126
139
  return self._upload(key, src_path)
127
140
 
128
141
  def get(self, key, size=None, offset=0):
129
- headers = self.headers
130
- if size or offset:
131
- headers = deepcopy(headers)
132
- headers["Range"] = get_range(size, offset)
133
- return http_get(self.url + self._join(key), headers)
142
+ container, path = split_path(self._join(key))
143
+ return self._do_object_request(
144
+ function=self.object.get,
145
+ container=container,
146
+ path=path,
147
+ offset=offset,
148
+ num_bytes=size,
149
+ ).body
134
150
 
135
- def _put(self, key, data, max_chunk_size: int = ONE_GB):
151
+ def _put(self, key, data, append=False, max_chunk_size: int = ONE_GB):
136
152
  """helper function for put method, allows for controlling max_chunk_size in testing"""
153
+ container, path = split_path(self._join(key))
137
154
  buffer_size = len(data) # in bytes
138
155
  if buffer_size <= ONE_MB:
139
- http_put(self.url + self._join(key), data, self.headers, None)
156
+ self._do_object_request(
157
+ self.object.put,
158
+ container=container,
159
+ path=path,
160
+ body=data,
161
+ append=append,
162
+ )
140
163
  return
141
- append_header = deepcopy(self.headers)
142
- append_header["Range"] = "-1"
143
164
  buffer_offset = 0
144
165
  try:
145
166
  data = memoryview(data)
146
167
  except TypeError:
147
168
  pass
148
169
 
149
- with requests.Session() as requests_session:
150
- while buffer_offset < buffer_size:
151
- chunk_size = min(buffer_size - buffer_offset, max_chunk_size)
152
- http_put(
153
- self.url + self._join(key),
154
- data[buffer_offset : buffer_offset + chunk_size],
155
- append_header if buffer_offset else self.headers,
156
- None,
157
- requests_session,
158
- )
159
- buffer_offset += chunk_size
170
+ while buffer_offset < buffer_size:
171
+ chunk_size = min(buffer_size - buffer_offset, max_chunk_size)
172
+ append = True if buffer_offset or append else False
173
+ self._do_object_request(
174
+ self.object.put,
175
+ container=container,
176
+ path=path,
177
+ body=data[buffer_offset : buffer_offset + chunk_size],
178
+ append=append,
179
+ )
180
+ buffer_offset += chunk_size
160
181
 
161
182
  def put(self, key, data, append=False):
162
- return self._put(key, data)
183
+ return self._put(key, data, append)
163
184
 
164
185
  def stat(self, key):
165
- head = http_head(self.url + self._join(key), self.headers)
186
+ container, path = split_path(self._join(key))
187
+ response = self._do_object_request(
188
+ function=self.object.head, container=container, path=path
189
+ )
190
+ head = dict(response.headers)
166
191
  size = int(head.get("Content-Length", "0"))
167
192
  datestr = head.get("Last-Modified", "0")
168
193
  modified = time.mktime(
@@ -171,7 +196,6 @@ class V3ioStore(DataStore):
171
196
  return FileStats(size, modified)
172
197
 
173
198
  def listdir(self, key):
174
- v3io_client = v3io.dataplane.Client(endpoint=self.url, access_key=self.token)
175
199
  container, subpath = split_path(self._join(key))
176
200
  if not subpath.endswith("/"):
177
201
  subpath += "/"
@@ -180,7 +204,7 @@ class V3ioStore(DataStore):
180
204
  subpath_length = len(subpath) - 1
181
205
 
182
206
  try:
183
- response = v3io_client.container.list(
207
+ response = self.client.container.list(
184
208
  container=container,
185
209
  path=subpath,
186
210
  get_all_attributes=False,
mlrun/db/base.py CHANGED
@@ -13,9 +13,8 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import datetime
16
- import typing
17
16
  from abc import ABC, abstractmethod
18
- from typing import List, Optional, Union
17
+ from typing import Optional, Union
19
18
 
20
19
  import mlrun.common.schemas
21
20
  import mlrun.model_monitoring.model_endpoint
@@ -60,9 +59,9 @@ class RunDBInterface(ABC):
60
59
  def list_runs(
61
60
  self,
62
61
  name: Optional[str] = None,
63
- uid: Optional[Union[str, List[str]]] = None,
62
+ uid: Optional[Union[str, list[str]]] = None,
64
63
  project: Optional[str] = None,
65
- labels: Optional[Union[str, List[str]]] = None,
64
+ labels: Optional[Union[str, list[str]]] = None,
66
65
  state: Optional[str] = None,
67
66
  sort: bool = True,
68
67
  last: int = 0,
@@ -253,7 +252,7 @@ class RunDBInterface(ABC):
253
252
  self,
254
253
  owner: str = None,
255
254
  format_: mlrun.common.schemas.ProjectsFormat = mlrun.common.schemas.ProjectsFormat.name_only,
256
- labels: List[str] = None,
255
+ labels: list[str] = None,
257
256
  state: mlrun.common.schemas.ProjectState = None,
258
257
  ) -> mlrun.common.schemas.ProjectsOutput:
259
258
  pass
@@ -291,8 +290,8 @@ class RunDBInterface(ABC):
291
290
  project: str,
292
291
  name: str = None,
293
292
  tag: str = None,
294
- entities: List[str] = None,
295
- labels: List[str] = None,
293
+ entities: list[str] = None,
294
+ labels: list[str] = None,
296
295
  ) -> mlrun.common.schemas.FeaturesOutput:
297
296
  pass
298
297
 
@@ -302,7 +301,7 @@ class RunDBInterface(ABC):
302
301
  project: str,
303
302
  name: str = None,
304
303
  tag: str = None,
305
- labels: List[str] = None,
304
+ labels: list[str] = None,
306
305
  ) -> mlrun.common.schemas.EntitiesOutput:
307
306
  pass
308
307
 
@@ -313,9 +312,9 @@ class RunDBInterface(ABC):
313
312
  name: str = None,
314
313
  tag: str = None,
315
314
  state: str = None,
316
- entities: List[str] = None,
317
- features: List[str] = None,
318
- labels: List[str] = None,
315
+ entities: list[str] = None,
316
+ features: list[str] = None,
317
+ labels: list[str] = None,
319
318
  partition_by: Union[
320
319
  mlrun.common.schemas.FeatureStorePartitionByField, str
321
320
  ] = None,
@@ -324,7 +323,7 @@ class RunDBInterface(ABC):
324
323
  partition_order: Union[
325
324
  mlrun.common.schemas.OrderType, str
326
325
  ] = mlrun.common.schemas.OrderType.desc,
327
- ) -> List[dict]:
326
+ ) -> list[dict]:
328
327
  pass
329
328
 
330
329
  @abstractmethod
@@ -379,7 +378,7 @@ class RunDBInterface(ABC):
379
378
  name: str = None,
380
379
  tag: str = None,
381
380
  state: str = None,
382
- labels: List[str] = None,
381
+ labels: list[str] = None,
383
382
  partition_by: Union[
384
383
  mlrun.common.schemas.FeatureStorePartitionByField, str
385
384
  ] = None,
@@ -388,7 +387,7 @@ class RunDBInterface(ABC):
388
387
  partition_order: Union[
389
388
  mlrun.common.schemas.OrderType, str
390
389
  ] = mlrun.common.schemas.OrderType.desc,
391
- ) -> List[dict]:
390
+ ) -> list[dict]:
392
391
  pass
393
392
 
394
393
  @abstractmethod
@@ -468,7 +467,7 @@ class RunDBInterface(ABC):
468
467
  provider: Union[
469
468
  str, mlrun.common.schemas.SecretProviderName
470
469
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
471
- secrets: List[str] = None,
470
+ secrets: list[str] = None,
472
471
  ) -> mlrun.common.schemas.SecretsData:
473
472
  pass
474
473
 
@@ -490,7 +489,7 @@ class RunDBInterface(ABC):
490
489
  provider: Union[
491
490
  str, mlrun.common.schemas.SecretProviderName
492
491
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
493
- secrets: List[str] = None,
492
+ secrets: list[str] = None,
494
493
  ):
495
494
  pass
496
495
 
@@ -530,10 +529,10 @@ class RunDBInterface(ABC):
530
529
  project: str,
531
530
  model: Optional[str] = None,
532
531
  function: Optional[str] = None,
533
- labels: List[str] = None,
532
+ labels: list[str] = None,
534
533
  start: str = "now-1h",
535
534
  end: str = "now",
536
- metrics: Optional[List[str]] = None,
535
+ metrics: Optional[list[str]] = None,
537
536
  ):
538
537
  pass
539
538
 
@@ -544,7 +543,7 @@ class RunDBInterface(ABC):
544
543
  endpoint_id: str,
545
544
  start: Optional[str] = None,
546
545
  end: Optional[str] = None,
547
- metrics: Optional[List[str]] = None,
546
+ metrics: Optional[list[str]] = None,
548
547
  features: bool = False,
549
548
  ):
550
549
  pass
@@ -630,14 +629,14 @@ class RunDBInterface(ABC):
630
629
  def set_run_notifications(
631
630
  self,
632
631
  project: str,
633
- runs: typing.List[mlrun.model.RunObject],
634
- notifications: typing.List[mlrun.model.Notification],
632
+ runs: list[mlrun.model.RunObject],
633
+ notifications: list[mlrun.model.Notification],
635
634
  ):
636
635
  pass
637
636
 
638
637
  def store_run_notifications(
639
638
  self,
640
- notification_objects: typing.List[mlrun.model.Notification],
639
+ notification_objects: list[mlrun.model.Notification],
641
640
  run_uid: str,
642
641
  project: str = None,
643
642
  mask_params: bool = True,
@@ -662,7 +661,7 @@ class RunDBInterface(ABC):
662
661
 
663
662
  def list_datastore_profiles(
664
663
  self, project: str
665
- ) -> List[mlrun.common.schemas.DatastoreProfile]:
664
+ ) -> list[mlrun.common.schemas.DatastoreProfile]:
666
665
  pass
667
666
 
668
667
  def store_datastore_profile(
mlrun/db/httpdb.py CHANGED
@@ -21,7 +21,7 @@ import typing
21
21
  import warnings
22
22
  from datetime import datetime, timedelta
23
23
  from os import path, remove
24
- from typing import Dict, List, Optional, Union
24
+ from typing import Optional, Union
25
25
  from urllib.parse import urlparse
26
26
 
27
27
  import kfp
@@ -660,9 +660,9 @@ class HTTPRunDB(RunDBInterface):
660
660
  def list_runs(
661
661
  self,
662
662
  name: Optional[str] = None,
663
- uid: Optional[Union[str, List[str]]] = None,
663
+ uid: Optional[Union[str, list[str]]] = None,
664
664
  project: Optional[str] = None,
665
- labels: Optional[Union[str, List[str]]] = None,
665
+ labels: Optional[Union[str, list[str]]] = None,
666
666
  state: Optional[str] = None,
667
667
  sort: bool = True,
668
668
  last: int = 0,
@@ -920,7 +920,7 @@ class HTTPRunDB(RunDBInterface):
920
920
  name=None,
921
921
  project=None,
922
922
  tag=None,
923
- labels: Optional[Union[Dict[str, str], List[str]]] = None,
923
+ labels: Optional[Union[dict[str, str], list[str]]] = None,
924
924
  since=None,
925
925
  until=None,
926
926
  iter: int = None,
@@ -1011,7 +1011,7 @@ class HTTPRunDB(RunDBInterface):
1011
1011
  self,
1012
1012
  project=None,
1013
1013
  category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
1014
- ) -> List[str]:
1014
+ ) -> list[str]:
1015
1015
  """Return a list of all the tags assigned to artifacts in the scope of the given project."""
1016
1016
 
1017
1017
  project = project or config.default_project
@@ -1828,9 +1828,9 @@ class HTTPRunDB(RunDBInterface):
1828
1828
  project: str,
1829
1829
  name: str = None,
1830
1830
  tag: str = None,
1831
- entities: List[str] = None,
1832
- labels: List[str] = None,
1833
- ) -> List[dict]:
1831
+ entities: list[str] = None,
1832
+ labels: list[str] = None,
1833
+ ) -> list[dict]:
1834
1834
  """List feature-sets which contain specific features. This function may return multiple versions of the same
1835
1835
  feature-set if a specific tag is not requested. Note that the various filters of this function actually
1836
1836
  refer to the feature-set object containing the features, not to the features themselves.
@@ -1865,8 +1865,8 @@ class HTTPRunDB(RunDBInterface):
1865
1865
  project: str,
1866
1866
  name: str = None,
1867
1867
  tag: str = None,
1868
- labels: List[str] = None,
1869
- ) -> List[dict]:
1868
+ labels: list[str] = None,
1869
+ ) -> list[dict]:
1870
1870
  """Retrieve a list of entities and their mapping to the containing feature-sets. This function is similar
1871
1871
  to the :py:func:`~list_features` function, and uses the same logic. However, the entities are matched
1872
1872
  against the name rather than the features.
@@ -1910,9 +1910,9 @@ class HTTPRunDB(RunDBInterface):
1910
1910
  name: str = None,
1911
1911
  tag: str = None,
1912
1912
  state: str = None,
1913
- entities: List[str] = None,
1914
- features: List[str] = None,
1915
- labels: List[str] = None,
1913
+ entities: list[str] = None,
1914
+ features: list[str] = None,
1915
+ labels: list[str] = None,
1916
1916
  partition_by: Union[
1917
1917
  mlrun.common.schemas.FeatureStorePartitionByField, str
1918
1918
  ] = None,
@@ -1921,7 +1921,7 @@ class HTTPRunDB(RunDBInterface):
1921
1921
  partition_order: Union[
1922
1922
  mlrun.common.schemas.OrderType, str
1923
1923
  ] = mlrun.common.schemas.OrderType.desc,
1924
- ) -> List[FeatureSet]:
1924
+ ) -> list[FeatureSet]:
1925
1925
  """Retrieve a list of feature-sets matching the criteria provided.
1926
1926
 
1927
1927
  :param project: Project name.
@@ -2131,7 +2131,7 @@ class HTTPRunDB(RunDBInterface):
2131
2131
  name: str = None,
2132
2132
  tag: str = None,
2133
2133
  state: str = None,
2134
- labels: List[str] = None,
2134
+ labels: list[str] = None,
2135
2135
  partition_by: Union[
2136
2136
  mlrun.common.schemas.FeatureStorePartitionByField, str
2137
2137
  ] = None,
@@ -2140,7 +2140,7 @@ class HTTPRunDB(RunDBInterface):
2140
2140
  partition_order: Union[
2141
2141
  mlrun.common.schemas.OrderType, str
2142
2142
  ] = mlrun.common.schemas.OrderType.desc,
2143
- ) -> List[FeatureVector]:
2143
+ ) -> list[FeatureVector]:
2144
2144
  """Retrieve a list of feature-vectors matching the criteria provided.
2145
2145
 
2146
2146
  :param project: Project name.
@@ -2342,7 +2342,7 @@ class HTTPRunDB(RunDBInterface):
2342
2342
 
2343
2343
  def tag_artifacts(
2344
2344
  self,
2345
- artifacts: Union[List[Artifact], List[dict], Artifact, dict],
2345
+ artifacts: Union[list[Artifact], list[dict], Artifact, dict],
2346
2346
  project: str,
2347
2347
  tag_name: str,
2348
2348
  replace: bool = False,
@@ -2380,9 +2380,9 @@ class HTTPRunDB(RunDBInterface):
2380
2380
  format_: Union[
2381
2381
  str, mlrun.common.schemas.ProjectsFormat
2382
2382
  ] = mlrun.common.schemas.ProjectsFormat.name_only,
2383
- labels: List[str] = None,
2383
+ labels: list[str] = None,
2384
2384
  state: Union[str, mlrun.common.schemas.ProjectState] = None,
2385
- ) -> List[Union[mlrun.projects.MlrunProject, str]]:
2385
+ ) -> list[Union[mlrun.projects.MlrunProject, str]]:
2386
2386
  """Return a list of the existing projects, potentially filtered by specific criteria.
2387
2387
 
2388
2388
  :param owner: List only projects belonging to this specific owner.
@@ -2637,7 +2637,7 @@ class HTTPRunDB(RunDBInterface):
2637
2637
  provider: Union[
2638
2638
  str, mlrun.common.schemas.SecretProviderName
2639
2639
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
2640
- secrets: List[str] = None,
2640
+ secrets: list[str] = None,
2641
2641
  ) -> mlrun.common.schemas.SecretsData:
2642
2642
  """Retrieve project-context secrets from Vault.
2643
2643
 
@@ -2726,7 +2726,7 @@ class HTTPRunDB(RunDBInterface):
2726
2726
  provider: Union[
2727
2727
  str, mlrun.common.schemas.SecretProviderName
2728
2728
  ] = mlrun.common.schemas.SecretProviderName.kubernetes,
2729
- secrets: List[str] = None,
2729
+ secrets: list[str] = None,
2730
2730
  ):
2731
2731
  """Delete project-context secrets from Kubernetes.
2732
2732
 
@@ -2883,13 +2883,13 @@ class HTTPRunDB(RunDBInterface):
2883
2883
  project: str,
2884
2884
  model: Optional[str] = None,
2885
2885
  function: Optional[str] = None,
2886
- labels: List[str] = None,
2886
+ labels: list[str] = None,
2887
2887
  start: str = "now-1h",
2888
2888
  end: str = "now",
2889
- metrics: Optional[List[str]] = None,
2889
+ metrics: Optional[list[str]] = None,
2890
2890
  top_level: bool = False,
2891
- uids: Optional[List[str]] = None,
2892
- ) -> List[mlrun.model_monitoring.model_endpoint.ModelEndpoint]:
2891
+ uids: Optional[list[str]] = None,
2892
+ ) -> list[mlrun.model_monitoring.model_endpoint.ModelEndpoint]:
2893
2893
  """
2894
2894
  Returns a list of `ModelEndpoint` objects. Each `ModelEndpoint` object represents the current state of a
2895
2895
  model endpoint. This functions supports filtering by the following parameters:
@@ -2957,7 +2957,7 @@ class HTTPRunDB(RunDBInterface):
2957
2957
  endpoint_id: str,
2958
2958
  start: Optional[str] = None,
2959
2959
  end: Optional[str] = None,
2960
- metrics: Optional[List[str]] = None,
2960
+ metrics: Optional[list[str]] = None,
2961
2961
  feature_analysis: bool = False,
2962
2962
  ) -> mlrun.model_monitoring.model_endpoint.ModelEndpoint:
2963
2963
  """
@@ -3190,7 +3190,7 @@ class HTTPRunDB(RunDBInterface):
3190
3190
  item_name: Optional[str] = None,
3191
3191
  tag: Optional[str] = None,
3192
3192
  version: Optional[str] = None,
3193
- ) -> List[mlrun.common.schemas.hub.IndexedHubSource]:
3193
+ ) -> list[mlrun.common.schemas.hub.IndexedHubSource]:
3194
3194
  """
3195
3195
  List hub sources in the MLRun DB.
3196
3196
 
@@ -3376,7 +3376,7 @@ class HTTPRunDB(RunDBInterface):
3376
3376
  self,
3377
3377
  project: str,
3378
3378
  run_uid: str,
3379
- notifications: typing.List[mlrun.model.Notification] = None,
3379
+ notifications: list[mlrun.model.Notification] = None,
3380
3380
  ):
3381
3381
  """
3382
3382
  Set notifications on a run. This will override any existing notifications on the run.
@@ -3401,7 +3401,7 @@ class HTTPRunDB(RunDBInterface):
3401
3401
  self,
3402
3402
  project: str,
3403
3403
  schedule_name: str,
3404
- notifications: typing.List[mlrun.model.Notification] = None,
3404
+ notifications: list[mlrun.model.Notification] = None,
3405
3405
  ):
3406
3406
  """
3407
3407
  Set notifications on a schedule. This will override any existing notifications on the schedule.
@@ -3424,7 +3424,7 @@ class HTTPRunDB(RunDBInterface):
3424
3424
 
3425
3425
  def store_run_notifications(
3426
3426
  self,
3427
- notification_objects: typing.List[mlrun.model.Notification],
3427
+ notification_objects: list[mlrun.model.Notification],
3428
3428
  run_uid: str,
3429
3429
  project: str = None,
3430
3430
  mask_params: bool = True,
@@ -3445,12 +3445,12 @@ class HTTPRunDB(RunDBInterface):
3445
3445
  mlrun.common.schemas.WorkflowSpec,
3446
3446
  dict,
3447
3447
  ],
3448
- arguments: Optional[Dict] = None,
3448
+ arguments: Optional[dict] = None,
3449
3449
  artifact_path: Optional[str] = None,
3450
3450
  source: Optional[str] = None,
3451
3451
  run_name: Optional[str] = None,
3452
3452
  namespace: Optional[str] = None,
3453
- notifications: typing.List[mlrun.model.Notification] = None,
3453
+ notifications: list[mlrun.model.Notification] = None,
3454
3454
  ):
3455
3455
  """
3456
3456
  Submitting workflow for a remote execution.
@@ -3538,7 +3538,7 @@ class HTTPRunDB(RunDBInterface):
3538
3538
  self,
3539
3539
  name: str,
3540
3540
  url: str,
3541
- secrets: Optional[Dict] = None,
3541
+ secrets: Optional[dict] = None,
3542
3542
  save_secrets: bool = True,
3543
3543
  ) -> str:
3544
3544
  """
@@ -3601,7 +3601,7 @@ class HTTPRunDB(RunDBInterface):
3601
3601
 
3602
3602
  def list_datastore_profiles(
3603
3603
  self, project: str
3604
- ) -> List[mlrun.common.schemas.DatastoreProfile]:
3604
+ ) -> list[mlrun.common.schemas.DatastoreProfile]:
3605
3605
  project = project or config.default_project
3606
3606
  _path = self._path_of("datastore-profiles", project)
3607
3607