mlrun 1.6.4rc2__py3-none-any.whl → 1.7.0rc20__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 (291) hide show
  1. mlrun/__init__.py +11 -1
  2. mlrun/__main__.py +26 -112
  3. mlrun/alerts/__init__.py +15 -0
  4. mlrun/alerts/alert.py +144 -0
  5. mlrun/api/schemas/__init__.py +5 -4
  6. mlrun/artifacts/__init__.py +8 -3
  7. mlrun/artifacts/base.py +46 -257
  8. mlrun/artifacts/dataset.py +11 -192
  9. mlrun/artifacts/manager.py +47 -48
  10. mlrun/artifacts/model.py +31 -159
  11. mlrun/artifacts/plots.py +23 -380
  12. mlrun/common/constants.py +69 -0
  13. mlrun/common/db/sql_session.py +2 -3
  14. mlrun/common/formatters/__init__.py +19 -0
  15. mlrun/common/formatters/artifact.py +21 -0
  16. mlrun/common/formatters/base.py +78 -0
  17. mlrun/common/formatters/function.py +41 -0
  18. mlrun/common/formatters/pipeline.py +53 -0
  19. mlrun/common/formatters/project.py +51 -0
  20. mlrun/common/helpers.py +1 -2
  21. mlrun/common/model_monitoring/helpers.py +9 -5
  22. mlrun/{runtimes → common/runtimes}/constants.py +37 -9
  23. mlrun/common/schemas/__init__.py +24 -4
  24. mlrun/common/schemas/alert.py +203 -0
  25. mlrun/common/schemas/api_gateway.py +148 -0
  26. mlrun/common/schemas/artifact.py +18 -8
  27. mlrun/common/schemas/auth.py +11 -5
  28. mlrun/common/schemas/background_task.py +1 -1
  29. mlrun/common/schemas/client_spec.py +4 -1
  30. mlrun/common/schemas/feature_store.py +16 -16
  31. mlrun/common/schemas/frontend_spec.py +8 -7
  32. mlrun/common/schemas/function.py +5 -1
  33. mlrun/common/schemas/hub.py +11 -18
  34. mlrun/common/schemas/memory_reports.py +2 -2
  35. mlrun/common/schemas/model_monitoring/__init__.py +18 -3
  36. mlrun/common/schemas/model_monitoring/constants.py +83 -26
  37. mlrun/common/schemas/model_monitoring/grafana.py +13 -9
  38. mlrun/common/schemas/model_monitoring/model_endpoints.py +99 -16
  39. mlrun/common/schemas/notification.py +4 -4
  40. mlrun/common/schemas/object.py +2 -2
  41. mlrun/{runtimes/mpijob/v1alpha1.py → common/schemas/pagination.py} +10 -13
  42. mlrun/common/schemas/pipeline.py +1 -10
  43. mlrun/common/schemas/project.py +24 -23
  44. mlrun/common/schemas/runtime_resource.py +8 -12
  45. mlrun/common/schemas/schedule.py +3 -3
  46. mlrun/common/schemas/tag.py +1 -2
  47. mlrun/common/schemas/workflow.py +2 -2
  48. mlrun/common/types.py +7 -1
  49. mlrun/config.py +54 -17
  50. mlrun/data_types/to_pandas.py +10 -12
  51. mlrun/datastore/__init__.py +5 -8
  52. mlrun/datastore/alibaba_oss.py +130 -0
  53. mlrun/datastore/azure_blob.py +17 -5
  54. mlrun/datastore/base.py +62 -39
  55. mlrun/datastore/datastore.py +28 -9
  56. mlrun/datastore/datastore_profile.py +146 -20
  57. mlrun/datastore/filestore.py +0 -1
  58. mlrun/datastore/google_cloud_storage.py +6 -2
  59. mlrun/datastore/hdfs.py +56 -0
  60. mlrun/datastore/inmem.py +2 -2
  61. mlrun/datastore/redis.py +6 -2
  62. mlrun/datastore/s3.py +9 -0
  63. mlrun/datastore/snowflake_utils.py +43 -0
  64. mlrun/datastore/sources.py +201 -96
  65. mlrun/datastore/spark_utils.py +1 -2
  66. mlrun/datastore/store_resources.py +7 -7
  67. mlrun/datastore/targets.py +358 -104
  68. mlrun/datastore/utils.py +72 -58
  69. mlrun/datastore/v3io.py +5 -1
  70. mlrun/db/base.py +185 -35
  71. mlrun/db/factory.py +1 -1
  72. mlrun/db/httpdb.py +614 -179
  73. mlrun/db/nopdb.py +210 -26
  74. mlrun/errors.py +12 -1
  75. mlrun/execution.py +41 -24
  76. mlrun/feature_store/__init__.py +0 -2
  77. mlrun/feature_store/api.py +40 -72
  78. mlrun/feature_store/common.py +1 -1
  79. mlrun/feature_store/feature_set.py +76 -55
  80. mlrun/feature_store/feature_vector.py +28 -30
  81. mlrun/feature_store/ingestion.py +7 -6
  82. mlrun/feature_store/retrieval/base.py +16 -11
  83. mlrun/feature_store/retrieval/conversion.py +11 -13
  84. mlrun/feature_store/retrieval/dask_merger.py +2 -0
  85. mlrun/feature_store/retrieval/job.py +9 -3
  86. mlrun/feature_store/retrieval/local_merger.py +2 -0
  87. mlrun/feature_store/retrieval/spark_merger.py +34 -24
  88. mlrun/feature_store/steps.py +37 -34
  89. mlrun/features.py +9 -20
  90. mlrun/frameworks/_common/artifacts_library.py +9 -9
  91. mlrun/frameworks/_common/mlrun_interface.py +5 -5
  92. mlrun/frameworks/_common/model_handler.py +48 -48
  93. mlrun/frameworks/_common/plan.py +2 -3
  94. mlrun/frameworks/_common/producer.py +3 -4
  95. mlrun/frameworks/_common/utils.py +5 -5
  96. mlrun/frameworks/_dl_common/loggers/logger.py +6 -7
  97. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +9 -9
  98. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +23 -47
  99. mlrun/frameworks/_ml_common/artifacts_library.py +1 -2
  100. mlrun/frameworks/_ml_common/loggers/logger.py +3 -4
  101. mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +4 -5
  102. mlrun/frameworks/_ml_common/model_handler.py +24 -24
  103. mlrun/frameworks/_ml_common/pkl_model_server.py +2 -2
  104. mlrun/frameworks/_ml_common/plan.py +1 -1
  105. mlrun/frameworks/_ml_common/plans/calibration_curve_plan.py +2 -3
  106. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +2 -3
  107. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  108. mlrun/frameworks/_ml_common/plans/feature_importance_plan.py +3 -3
  109. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  110. mlrun/frameworks/_ml_common/utils.py +4 -4
  111. mlrun/frameworks/auto_mlrun/auto_mlrun.py +9 -9
  112. mlrun/frameworks/huggingface/model_server.py +4 -4
  113. mlrun/frameworks/lgbm/__init__.py +33 -33
  114. mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
  115. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -5
  116. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -5
  117. mlrun/frameworks/lgbm/mlrun_interfaces/booster_mlrun_interface.py +1 -3
  118. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +6 -6
  119. mlrun/frameworks/lgbm/model_handler.py +10 -10
  120. mlrun/frameworks/lgbm/model_server.py +6 -6
  121. mlrun/frameworks/lgbm/utils.py +5 -5
  122. mlrun/frameworks/onnx/dataset.py +8 -8
  123. mlrun/frameworks/onnx/mlrun_interface.py +3 -3
  124. mlrun/frameworks/onnx/model_handler.py +6 -6
  125. mlrun/frameworks/onnx/model_server.py +7 -7
  126. mlrun/frameworks/parallel_coordinates.py +4 -3
  127. mlrun/frameworks/pytorch/__init__.py +18 -18
  128. mlrun/frameworks/pytorch/callbacks/callback.py +4 -5
  129. mlrun/frameworks/pytorch/callbacks/logging_callback.py +17 -17
  130. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +11 -11
  131. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +23 -29
  132. mlrun/frameworks/pytorch/callbacks_handler.py +38 -38
  133. mlrun/frameworks/pytorch/mlrun_interface.py +20 -20
  134. mlrun/frameworks/pytorch/model_handler.py +17 -17
  135. mlrun/frameworks/pytorch/model_server.py +7 -7
  136. mlrun/frameworks/sklearn/__init__.py +13 -13
  137. mlrun/frameworks/sklearn/estimator.py +4 -4
  138. mlrun/frameworks/sklearn/metrics_library.py +14 -14
  139. mlrun/frameworks/sklearn/mlrun_interface.py +3 -6
  140. mlrun/frameworks/sklearn/model_handler.py +2 -2
  141. mlrun/frameworks/tf_keras/__init__.py +10 -7
  142. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +15 -15
  143. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +11 -11
  144. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +19 -23
  145. mlrun/frameworks/tf_keras/mlrun_interface.py +9 -11
  146. mlrun/frameworks/tf_keras/model_handler.py +14 -14
  147. mlrun/frameworks/tf_keras/model_server.py +6 -6
  148. mlrun/frameworks/xgboost/__init__.py +13 -13
  149. mlrun/frameworks/xgboost/model_handler.py +6 -6
  150. mlrun/k8s_utils.py +14 -16
  151. mlrun/launcher/__init__.py +1 -1
  152. mlrun/launcher/base.py +16 -15
  153. mlrun/launcher/client.py +8 -6
  154. mlrun/launcher/factory.py +1 -1
  155. mlrun/launcher/local.py +17 -11
  156. mlrun/launcher/remote.py +16 -10
  157. mlrun/lists.py +7 -6
  158. mlrun/model.py +238 -73
  159. mlrun/model_monitoring/__init__.py +1 -1
  160. mlrun/model_monitoring/api.py +138 -315
  161. mlrun/model_monitoring/application.py +5 -296
  162. mlrun/model_monitoring/applications/__init__.py +24 -0
  163. mlrun/model_monitoring/applications/_application_steps.py +157 -0
  164. mlrun/model_monitoring/applications/base.py +282 -0
  165. mlrun/model_monitoring/applications/context.py +214 -0
  166. mlrun/model_monitoring/applications/evidently_base.py +211 -0
  167. mlrun/model_monitoring/applications/histogram_data_drift.py +349 -0
  168. mlrun/model_monitoring/applications/results.py +99 -0
  169. mlrun/model_monitoring/controller.py +104 -84
  170. mlrun/model_monitoring/controller_handler.py +13 -5
  171. mlrun/model_monitoring/db/__init__.py +18 -0
  172. mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -36
  173. mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
  174. mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +64 -40
  175. mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
  176. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
  177. mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +109 -5
  178. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +88 -0
  179. mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
  180. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +684 -0
  181. mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
  182. mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +310 -165
  183. mlrun/model_monitoring/db/tsdb/__init__.py +100 -0
  184. mlrun/model_monitoring/db/tsdb/base.py +329 -0
  185. mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
  186. mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
  187. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +240 -0
  188. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +45 -0
  189. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +397 -0
  190. mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
  191. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +117 -0
  192. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +630 -0
  193. mlrun/model_monitoring/evidently_application.py +6 -118
  194. mlrun/model_monitoring/features_drift_table.py +134 -106
  195. mlrun/model_monitoring/helpers.py +127 -28
  196. mlrun/model_monitoring/metrics/__init__.py +13 -0
  197. mlrun/model_monitoring/metrics/histogram_distance.py +127 -0
  198. mlrun/model_monitoring/model_endpoint.py +3 -2
  199. mlrun/model_monitoring/prometheus.py +1 -4
  200. mlrun/model_monitoring/stream_processing.py +62 -231
  201. mlrun/model_monitoring/tracking_policy.py +9 -2
  202. mlrun/model_monitoring/writer.py +152 -124
  203. mlrun/package/__init__.py +6 -6
  204. mlrun/package/context_handler.py +5 -5
  205. mlrun/package/packager.py +7 -7
  206. mlrun/package/packagers/default_packager.py +6 -6
  207. mlrun/package/packagers/numpy_packagers.py +15 -15
  208. mlrun/package/packagers/pandas_packagers.py +5 -5
  209. mlrun/package/packagers/python_standard_library_packagers.py +10 -10
  210. mlrun/package/packagers_manager.py +19 -23
  211. mlrun/package/utils/_formatter.py +6 -6
  212. mlrun/package/utils/_pickler.py +2 -2
  213. mlrun/package/utils/_supported_format.py +4 -4
  214. mlrun/package/utils/log_hint_utils.py +2 -2
  215. mlrun/package/utils/type_hint_utils.py +4 -9
  216. mlrun/platforms/__init__.py +11 -10
  217. mlrun/platforms/iguazio.py +24 -203
  218. mlrun/projects/operations.py +35 -21
  219. mlrun/projects/pipelines.py +68 -99
  220. mlrun/projects/project.py +830 -266
  221. mlrun/render.py +3 -11
  222. mlrun/run.py +162 -166
  223. mlrun/runtimes/__init__.py +62 -7
  224. mlrun/runtimes/base.py +39 -32
  225. mlrun/runtimes/daskjob.py +8 -8
  226. mlrun/runtimes/databricks_job/databricks_cancel_task.py +1 -1
  227. mlrun/runtimes/databricks_job/databricks_runtime.py +7 -7
  228. mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
  229. mlrun/runtimes/funcdoc.py +0 -28
  230. mlrun/runtimes/function_reference.py +1 -1
  231. mlrun/runtimes/kubejob.py +28 -122
  232. mlrun/runtimes/local.py +6 -3
  233. mlrun/runtimes/mpijob/__init__.py +0 -20
  234. mlrun/runtimes/mpijob/abstract.py +9 -10
  235. mlrun/runtimes/mpijob/v1.py +1 -1
  236. mlrun/{model_monitoring/stores/models/sqlite.py → runtimes/nuclio/__init__.py} +7 -9
  237. mlrun/runtimes/nuclio/api_gateway.py +709 -0
  238. mlrun/runtimes/nuclio/application/__init__.py +15 -0
  239. mlrun/runtimes/nuclio/application/application.py +523 -0
  240. mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
  241. mlrun/runtimes/{function.py → nuclio/function.py} +112 -73
  242. mlrun/runtimes/{nuclio.py → nuclio/nuclio.py} +6 -6
  243. mlrun/runtimes/{serving.py → nuclio/serving.py} +45 -51
  244. mlrun/runtimes/pod.py +286 -88
  245. mlrun/runtimes/remotesparkjob.py +2 -2
  246. mlrun/runtimes/sparkjob/spark3job.py +51 -34
  247. mlrun/runtimes/utils.py +7 -75
  248. mlrun/secrets.py +9 -5
  249. mlrun/serving/remote.py +2 -7
  250. mlrun/serving/routers.py +13 -10
  251. mlrun/serving/server.py +22 -26
  252. mlrun/serving/states.py +99 -25
  253. mlrun/serving/utils.py +3 -3
  254. mlrun/serving/v1_serving.py +6 -7
  255. mlrun/serving/v2_serving.py +59 -20
  256. mlrun/track/tracker.py +2 -1
  257. mlrun/track/tracker_manager.py +3 -3
  258. mlrun/track/trackers/mlflow_tracker.py +1 -2
  259. mlrun/utils/async_http.py +5 -7
  260. mlrun/utils/azure_vault.py +1 -1
  261. mlrun/utils/clones.py +1 -2
  262. mlrun/utils/condition_evaluator.py +3 -3
  263. mlrun/utils/db.py +3 -3
  264. mlrun/utils/helpers.py +183 -197
  265. mlrun/utils/http.py +2 -5
  266. mlrun/utils/logger.py +76 -14
  267. mlrun/utils/notifications/notification/__init__.py +17 -12
  268. mlrun/utils/notifications/notification/base.py +14 -2
  269. mlrun/utils/notifications/notification/console.py +2 -0
  270. mlrun/utils/notifications/notification/git.py +3 -1
  271. mlrun/utils/notifications/notification/ipython.py +3 -1
  272. mlrun/utils/notifications/notification/slack.py +101 -21
  273. mlrun/utils/notifications/notification/webhook.py +11 -1
  274. mlrun/utils/notifications/notification_pusher.py +155 -30
  275. mlrun/utils/retryer.py +208 -0
  276. mlrun/utils/singleton.py +1 -1
  277. mlrun/utils/v3io_clients.py +2 -4
  278. mlrun/utils/version/version.json +2 -2
  279. mlrun/utils/version/version.py +2 -6
  280. {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/METADATA +31 -19
  281. mlrun-1.7.0rc20.dist-info/RECORD +353 -0
  282. mlrun/kfpops.py +0 -868
  283. mlrun/model_monitoring/batch.py +0 -1095
  284. mlrun/model_monitoring/stores/models/__init__.py +0 -27
  285. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -384
  286. mlrun/platforms/other.py +0 -306
  287. mlrun-1.6.4rc2.dist-info/RECORD +0 -314
  288. {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/LICENSE +0 -0
  289. {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/WHEEL +0 -0
  290. {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/entry_points.txt +0 -0
  291. {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,148 @@
1
+ # Copyright 2023 Iguazio
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ import typing
16
+ from typing import Optional
17
+
18
+ import pydantic
19
+
20
+ import mlrun.common.types
21
+ from mlrun.common.constants import MLRUN_FUNCTIONS_ANNOTATION
22
+
23
+
24
+ class APIGatewayAuthenticationMode(mlrun.common.types.StrEnum):
25
+ basic = "basicAuth"
26
+ none = "none"
27
+ access_key = "accessKey"
28
+
29
+ @classmethod
30
+ def from_str(cls, authentication_mode: str):
31
+ if authentication_mode == "none":
32
+ return cls.none
33
+ elif authentication_mode == "basicAuth":
34
+ return cls.basic
35
+ elif authentication_mode == "accessKey":
36
+ return cls.access_key
37
+ else:
38
+ raise mlrun.errors.MLRunInvalidArgumentError(
39
+ f"Authentication mode `{authentication_mode}` is not supported",
40
+ )
41
+
42
+
43
+ class APIGatewayState(mlrun.common.types.StrEnum):
44
+ none = ""
45
+ ready = "ready"
46
+ error = "error"
47
+ waiting_for_provisioning = "waitingForProvisioning"
48
+
49
+
50
+ class _APIGatewayBaseModel(pydantic.BaseModel):
51
+ class Config:
52
+ extra = pydantic.Extra.allow
53
+
54
+
55
+ class APIGatewayMetadata(_APIGatewayBaseModel):
56
+ name: str
57
+ namespace: Optional[str]
58
+ labels: Optional[dict] = {}
59
+ annotations: Optional[dict] = {}
60
+
61
+
62
+ class APIGatewayBasicAuth(_APIGatewayBaseModel):
63
+ username: str
64
+ password: str
65
+
66
+
67
+ class APIGatewayUpstream(_APIGatewayBaseModel):
68
+ kind: Optional[str] = "nucliofunction"
69
+ nucliofunction: dict[str, str]
70
+ percentage: Optional[int] = 0
71
+ port: Optional[int] = 0
72
+
73
+
74
+ class APIGatewaySpec(_APIGatewayBaseModel):
75
+ name: str
76
+ description: Optional[str]
77
+ path: Optional[str] = "/"
78
+ authenticationMode: Optional[APIGatewayAuthenticationMode] = (
79
+ APIGatewayAuthenticationMode.none
80
+ )
81
+ upstreams: list[APIGatewayUpstream]
82
+ authentication: Optional[dict[str, Optional[APIGatewayBasicAuth]]]
83
+ host: Optional[str]
84
+
85
+
86
+ class APIGatewayStatus(_APIGatewayBaseModel):
87
+ name: Optional[str]
88
+ state: Optional[APIGatewayState]
89
+
90
+
91
+ class APIGateway(_APIGatewayBaseModel):
92
+ metadata: APIGatewayMetadata
93
+ spec: APIGatewaySpec
94
+ status: Optional[APIGatewayStatus]
95
+
96
+ def get_function_names(self):
97
+ return [
98
+ upstream.nucliofunction.get("name")
99
+ for upstream in self.spec.upstreams
100
+ if upstream.nucliofunction.get("name")
101
+ ]
102
+
103
+ def enrich_mlrun_function_names(self):
104
+ upstream_with_nuclio_names = []
105
+ mlrun_function_uris = []
106
+ for upstream in self.spec.upstreams:
107
+ uri = upstream.nucliofunction.get("name")
108
+ project, function_name, tag, _ = (
109
+ mlrun.common.helpers.parse_versioned_object_uri(uri)
110
+ )
111
+ upstream.nucliofunction["name"] = (
112
+ mlrun.runtimes.nuclio.function.get_fullname(function_name, project, tag)
113
+ )
114
+
115
+ upstream_with_nuclio_names.append(upstream)
116
+ mlrun_function_uris.append(uri)
117
+
118
+ self.spec.upstreams = upstream_with_nuclio_names
119
+ if len(mlrun_function_uris) == 1:
120
+ self.metadata.annotations[MLRUN_FUNCTIONS_ANNOTATION] = mlrun_function_uris[
121
+ 0
122
+ ]
123
+ elif len(mlrun_function_uris) == 2:
124
+ self.metadata.annotations[MLRUN_FUNCTIONS_ANNOTATION] = "&".join(
125
+ mlrun_function_uris
126
+ )
127
+ return self
128
+
129
+ def replace_nuclio_names_with_mlrun_uri(self):
130
+ mlrun_functions = self.metadata.annotations.get(MLRUN_FUNCTIONS_ANNOTATION)
131
+ if mlrun_functions:
132
+ mlrun_function_uris = (
133
+ mlrun_functions.split("&")
134
+ if "&" in mlrun_functions
135
+ else [mlrun_functions]
136
+ )
137
+ if len(mlrun_function_uris) != len(self.spec.upstreams):
138
+ raise mlrun.errors.MLRunValueError(
139
+ "Error when translating nuclio names to mlrun names in api gateway:"
140
+ " number of functions doesn't match the mlrun functions in annotation"
141
+ )
142
+ for i in range(len(mlrun_function_uris)):
143
+ self.spec.upstreams[i].nucliofunction["name"] = mlrun_function_uris[i]
144
+ return self
145
+
146
+
147
+ class APIGatewaysOutput(_APIGatewayBaseModel):
148
+ api_gateways: typing.Optional[dict[str, APIGateway]] = {}
@@ -30,7 +30,7 @@ class ArtifactCategories(mlrun.common.types.StrEnum):
30
30
  # and should not be used as such
31
31
  link = "link"
32
32
 
33
- def to_kinds_filter(self) -> typing.Tuple[typing.List[str], bool]:
33
+ def to_kinds_filter(self) -> tuple[list[str], bool]:
34
34
  link_kind = ArtifactCategories.link.value
35
35
 
36
36
  if self.value == ArtifactCategories.model.value:
@@ -58,11 +58,6 @@ class ArtifactIdentifier(pydantic.BaseModel):
58
58
  # hash: typing.Optional[str]
59
59
 
60
60
 
61
- class ArtifactsFormat(mlrun.common.types.StrEnum):
62
- # TODO: add a format that returns a minimal response
63
- full = "full"
64
-
65
-
66
61
  class ArtifactMetadata(pydantic.BaseModel):
67
62
  key: str
68
63
  project: str
@@ -81,8 +76,8 @@ class ArtifactSpec(pydantic.BaseModel):
81
76
  inline: typing.Optional[str]
82
77
  size: typing.Optional[int]
83
78
  db_key: typing.Optional[str]
84
- extra_data: typing.Optional[typing.Dict[str, typing.Any]]
85
- unpackaging_instructions: typing.Optional[typing.Dict[str, typing.Any]]
79
+ extra_data: typing.Optional[dict[str, typing.Any]]
80
+ unpackaging_instructions: typing.Optional[dict[str, typing.Any]]
86
81
 
87
82
  class Config:
88
83
  extra = pydantic.Extra.allow
@@ -93,3 +88,18 @@ class Artifact(pydantic.BaseModel):
93
88
  metadata: ArtifactMetadata
94
89
  spec: ArtifactSpec
95
90
  status: ObjectStatus
91
+
92
+
93
+ class ArtifactsDeletionStrategies(mlrun.common.types.StrEnum):
94
+ """Artifacts deletion strategies types."""
95
+
96
+ metadata_only = "metadata-only"
97
+ """Only removes the artifact db record, leaving all related artifact data in-place"""
98
+
99
+ data_optional = "data-optional"
100
+ """Delete the artifact data of the artifact as a best-effort.
101
+ If artifact data deletion fails still try to delete the artifact db record"""
102
+
103
+ data_force = "data-force"
104
+ """Delete the artifact data, and if cannot delete it fail the deletion
105
+ and don’t delete the artifact db record"""
@@ -58,8 +58,11 @@ class AuthorizationResourceTypes(mlrun.common.types.StrEnum):
58
58
  pipeline = "pipeline"
59
59
  hub_source = "hub-source"
60
60
  workflow = "workflow"
61
+ alert = "alert"
62
+ alert_templates = "alert-templates"
63
+ event = "event"
61
64
  datastore_profile = "datastore-profile"
62
- api_gateways = "api-gateways"
65
+ api_gateway = "api-gateway"
63
66
 
64
67
  def to_resource_string(
65
68
  self,
@@ -83,6 +86,9 @@ class AuthorizationResourceTypes(mlrun.common.types.StrEnum):
83
86
  AuthorizationResourceTypes.schedule: "/projects/{project_name}/schedules/{resource_name}",
84
87
  AuthorizationResourceTypes.secret: "/projects/{project_name}/secrets/{resource_name}",
85
88
  AuthorizationResourceTypes.run: "/projects/{project_name}/runs/{resource_name}",
89
+ AuthorizationResourceTypes.event: "/projects/{project_name}/events/{resource_name}",
90
+ AuthorizationResourceTypes.alert: "/projects/{project_name}/alerts/{resource_name}",
91
+ AuthorizationResourceTypes.alert_templates: "/alert-templates/{resource_name}",
86
92
  # runtime resource doesn't have an identifier, we don't need any auth granularity behind project level
87
93
  AuthorizationResourceTypes.runtime_resource: "/projects/{project_name}/runtime-resources",
88
94
  AuthorizationResourceTypes.model_endpoint: "/projects/{project_name}/model-endpoints/{resource_name}",
@@ -94,7 +100,7 @@ class AuthorizationResourceTypes(mlrun.common.types.StrEnum):
94
100
  AuthorizationResourceTypes.hub_source: "/marketplace/sources",
95
101
  # workflow define how to run a pipeline and can be considered as the specification of a pipeline.
96
102
  AuthorizationResourceTypes.workflow: "/projects/{project_name}/workflows/{resource_name}",
97
- AuthorizationResourceTypes.api_gateways: "/projects/{project_name}/api-gateways",
103
+ AuthorizationResourceTypes.api_gateway: "/projects/{project_name}/api-gateways/{resource_name}",
98
104
  }[self].format(project_name=project_name, resource_name=resource_name)
99
105
 
100
106
 
@@ -115,17 +121,17 @@ class AuthInfo(pydantic.BaseModel):
115
121
  data_session: typing.Optional[str] = None
116
122
  access_key: typing.Optional[str] = None
117
123
  user_id: typing.Optional[str] = None
118
- user_group_ids: typing.List[str] = []
124
+ user_group_ids: list[str] = []
119
125
  user_unix_id: typing.Optional[int] = None
120
126
  projects_role: typing.Optional[ProjectsRole] = None
121
- planes: typing.List[str] = []
127
+ planes: list[str] = []
122
128
 
123
129
  def to_nuclio_auth_info(self):
124
130
  if self.session != "":
125
131
  return NuclioAuthInfo(password=self.session, mode=NuclioAuthKinds.iguazio)
126
132
  return None
127
133
 
128
- def get_member_ids(self) -> typing.List[str]:
134
+ def get_member_ids(self) -> list[str]:
129
135
  member_ids = []
130
136
  if self.user_id:
131
137
  member_ids.append(self.user_id)
@@ -61,4 +61,4 @@ class BackgroundTask(pydantic.BaseModel):
61
61
 
62
62
 
63
63
  class BackgroundTaskList(pydantic.BaseModel):
64
- background_tasks: typing.List[BackgroundTask]
64
+ background_tasks: list[BackgroundTask]
@@ -28,7 +28,8 @@ class ClientSpec(pydantic.BaseModel):
28
28
  mpijob_crd_version: typing.Optional[str]
29
29
  ui_url: typing.Optional[str]
30
30
  artifact_path: typing.Optional[str]
31
- feature_store_data_prefixes: typing.Optional[typing.Dict[str, str]]
31
+ feature_store_data_prefixes: typing.Optional[dict[str, str]]
32
+ feature_store_default_targets: typing.Optional[str]
32
33
  spark_app_image: typing.Optional[str]
33
34
  spark_app_image_tag: typing.Optional[str]
34
35
  spark_history_server_path: typing.Optional[str]
@@ -58,6 +59,7 @@ class ClientSpec(pydantic.BaseModel):
58
59
  sql_url: typing.Optional[str]
59
60
  model_endpoint_monitoring_store_type: typing.Optional[str]
60
61
  model_endpoint_monitoring_endpoint_store_connection: typing.Optional[str]
62
+ model_monitoring_tsdb_connection: typing.Optional[str]
61
63
  ce: typing.Optional[dict]
62
64
  # not passing them as one object as it possible client user would like to override only one of the params
63
65
  calculate_artifact_hash: typing.Optional[str]
@@ -65,3 +67,4 @@ class ClientSpec(pydantic.BaseModel):
65
67
  logs: typing.Optional[dict]
66
68
  packagers: typing.Optional[dict]
67
69
  external_platform_tracking: typing.Optional[dict]
70
+ alerts_mode: typing.Optional[str]
@@ -12,7 +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 List, Optional
15
+ from typing import Optional
16
16
 
17
17
  from pydantic import BaseModel, Extra, Field
18
18
 
@@ -46,8 +46,8 @@ class Entity(BaseModel):
46
46
 
47
47
 
48
48
  class FeatureSetSpec(ObjectSpec):
49
- entities: List[Entity] = []
50
- features: List[Feature] = []
49
+ entities: list[Entity] = []
50
+ features: list[Feature] = []
51
51
  engine: Optional[str] = Field(default="storey")
52
52
 
53
53
 
@@ -65,7 +65,7 @@ class FeatureSet(BaseModel):
65
65
  class EntityRecord(BaseModel):
66
66
  name: str
67
67
  value_type: str
68
- labels: List[LabelRecord]
68
+ labels: list[LabelRecord]
69
69
 
70
70
  class Config:
71
71
  orm_mode = True
@@ -74,31 +74,31 @@ class EntityRecord(BaseModel):
74
74
  class FeatureRecord(BaseModel):
75
75
  name: str
76
76
  value_type: str
77
- labels: List[LabelRecord]
77
+ labels: list[LabelRecord]
78
78
 
79
79
  class Config:
80
80
  orm_mode = True
81
81
 
82
82
 
83
83
  class FeatureSetRecord(ObjectRecord):
84
- entities: List[EntityRecord]
85
- features: List[FeatureRecord]
84
+ entities: list[EntityRecord]
85
+ features: list[FeatureRecord]
86
86
 
87
87
  class Config:
88
88
  orm_mode = True
89
89
 
90
90
 
91
91
  class FeatureSetsOutput(BaseModel):
92
- feature_sets: List[FeatureSet]
92
+ feature_sets: list[FeatureSet]
93
93
 
94
94
 
95
95
  class FeatureSetsTagsOutput(BaseModel):
96
- tags: List[str] = []
96
+ tags: list[str] = []
97
97
 
98
98
 
99
99
  class FeatureSetDigestSpec(BaseModel):
100
- entities: List[Entity]
101
- features: List[Feature]
100
+ entities: list[Entity]
101
+ features: list[Feature]
102
102
 
103
103
 
104
104
  class FeatureSetDigestOutput(BaseModel):
@@ -112,7 +112,7 @@ class FeatureListOutput(BaseModel):
112
112
 
113
113
 
114
114
  class FeaturesOutput(BaseModel):
115
- features: List[FeatureListOutput]
115
+ features: list[FeatureListOutput]
116
116
 
117
117
 
118
118
  class EntityListOutput(BaseModel):
@@ -121,7 +121,7 @@ class EntityListOutput(BaseModel):
121
121
 
122
122
 
123
123
  class EntitiesOutput(BaseModel):
124
- entities: List[EntityListOutput]
124
+ entities: list[EntityListOutput]
125
125
 
126
126
 
127
127
  class FeatureVector(BaseModel):
@@ -140,11 +140,11 @@ class FeatureVectorRecord(ObjectRecord):
140
140
 
141
141
 
142
142
  class FeatureVectorsOutput(BaseModel):
143
- feature_vectors: List[FeatureVector]
143
+ feature_vectors: list[FeatureVector]
144
144
 
145
145
 
146
146
  class FeatureVectorsTagsOutput(BaseModel):
147
- tags: List[str] = []
147
+ tags: list[str] = []
148
148
 
149
149
 
150
150
  class DataSource(BaseModel):
@@ -167,7 +167,7 @@ class DataTarget(BaseModel):
167
167
 
168
168
  class FeatureSetIngestInput(BaseModel):
169
169
  source: Optional[DataSource]
170
- targets: Optional[List[DataTarget]]
170
+ targets: Optional[list[DataTarget]]
171
171
  infer_options: Optional[int]
172
172
  credentials: Credentials = Credentials()
173
173
 
@@ -53,20 +53,21 @@ class FeatureFlags(pydantic.BaseModel):
53
53
  class FrontendSpec(pydantic.BaseModel):
54
54
  jobs_dashboard_url: typing.Optional[str]
55
55
  model_monitoring_dashboard_url: typing.Optional[str]
56
- abortable_function_kinds: typing.List[str] = []
56
+ abortable_function_kinds: list[str] = []
57
57
  feature_flags: FeatureFlags
58
58
  default_function_priority_class_name: typing.Optional[str]
59
- valid_function_priority_class_names: typing.List[str] = []
60
- default_function_image_by_kind: typing.Dict[str, str] = {}
59
+ valid_function_priority_class_names: list[str] = []
60
+ default_function_image_by_kind: dict[str, str] = {}
61
61
  function_deployment_target_image_template: typing.Optional[str]
62
62
  function_deployment_target_image_name_prefix_template: str
63
- function_deployment_target_image_registries_to_enforce_prefix: typing.List[str] = []
63
+ function_deployment_target_image_registries_to_enforce_prefix: list[str] = []
64
64
  function_deployment_mlrun_requirement: typing.Optional[str]
65
65
  auto_mount_type: typing.Optional[str]
66
- auto_mount_params: typing.Dict[str, str] = {}
66
+ auto_mount_params: dict[str, str] = {}
67
67
  default_artifact_path: str
68
68
  default_function_pod_resources: Resources = Resources()
69
69
  default_function_preemption_mode: str
70
- feature_store_data_prefixes: typing.Optional[typing.Dict[str, str]]
71
- allowed_artifact_path_prefixes_list: typing.List[str]
70
+ feature_store_data_prefixes: typing.Optional[dict[str, str]]
71
+ allowed_artifact_path_prefixes_list: list[str]
72
72
  ce: typing.Optional[dict]
73
+ internal_labels: list[str] = []
@@ -45,6 +45,9 @@ class FunctionState:
45
45
  # same goes for the build which is not coming from the pod, but is used and we can't just omit it for BC reasons
46
46
  build = "build"
47
47
 
48
+ # for pipeline steps
49
+ skipped = "skipped"
50
+
48
51
  @classmethod
49
52
  def get_function_state_from_pod_state(cls, pod_state: str):
50
53
  if pod_state == "succeeded":
@@ -60,6 +63,7 @@ class FunctionState:
60
63
  return [
61
64
  cls.ready,
62
65
  cls.error,
66
+ cls.skipped,
63
67
  ]
64
68
 
65
69
 
@@ -106,7 +110,7 @@ class ServiceAccount(pydantic.BaseModel):
106
110
 
107
111
 
108
112
  class StateThresholds(pydantic.BaseModel):
109
- default: typing.Optional[typing.Dict[str, str]]
113
+ default: typing.Optional[dict[str, str]]
110
114
 
111
115
 
112
116
  class FunctionSpec(pydantic.BaseModel):
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
  #
15
15
  from datetime import datetime, timezone
16
- from typing import Dict, List, Optional
16
+ from typing import Optional
17
17
 
18
18
  from pydantic import BaseModel, Extra, Field
19
19
 
@@ -56,36 +56,29 @@ class HubSource(BaseModel):
56
56
  status: Optional[ObjectStatus] = ObjectStatus(state="created")
57
57
 
58
58
  def get_full_uri(self, relative_path):
59
- return "{base}/{object_type}/{channel}/{relative_path}".format(
60
- base=self.spec.path,
61
- object_type=self.spec.object_type,
62
- channel=self.spec.channel,
63
- relative_path=relative_path,
64
- )
59
+ return f"{self.spec.path}/{self.spec.object_type}/{self.spec.channel}/{relative_path}"
65
60
 
66
61
  def get_catalog_uri(self):
67
- return self.get_full_uri(mlrun.config.config.hub.catalog_filename)
62
+ return self.get_full_uri(mlrun.mlconf.hub.catalog_filename)
68
63
 
69
64
  @classmethod
70
65
  def generate_default_source(cls):
71
- if not mlrun.config.config.hub.default_source.create:
66
+ if not mlrun.mlconf.hub.default_source.create:
72
67
  return None
73
68
 
74
69
  now = datetime.now(timezone.utc)
75
70
  hub_metadata = HubObjectMetadata(
76
- name=mlrun.config.config.hub.default_source.name,
77
- description=mlrun.config.config.hub.default_source.description,
71
+ name=mlrun.mlconf.hub.default_source.name,
72
+ description=mlrun.mlconf.hub.default_source.description,
78
73
  created=now,
79
74
  updated=now,
80
75
  )
81
76
  return cls(
82
77
  metadata=hub_metadata,
83
78
  spec=HubSourceSpec(
84
- path=mlrun.config.config.hub.default_source.url,
85
- channel=mlrun.config.config.hub.default_source.channel,
86
- object_type=HubSourceType(
87
- mlrun.config.config.hub.default_source.object_type
88
- ),
79
+ path=mlrun.mlconf.hub.default_source.url,
80
+ channel=mlrun.mlconf.hub.default_source.channel,
81
+ object_type=HubSourceType(mlrun.mlconf.hub.default_source.object_type),
89
82
  ),
90
83
  status=ObjectStatus(state="created"),
91
84
  )
@@ -120,7 +113,7 @@ class HubItemMetadata(HubObjectMetadata):
120
113
 
121
114
  class HubItemSpec(ObjectSpec):
122
115
  item_uri: str
123
- assets: Dict[str, str] = {}
116
+ assets: dict[str, str] = {}
124
117
 
125
118
 
126
119
  class HubItem(BaseModel):
@@ -133,4 +126,4 @@ class HubItem(BaseModel):
133
126
  class HubCatalog(BaseModel):
134
127
  kind: ObjectKind = Field(ObjectKind.hub_catalog, const=True)
135
128
  channel: str
136
- catalog: List[HubItem]
129
+ catalog: list[HubItem]
@@ -19,7 +19,7 @@ import pydantic
19
19
 
20
20
 
21
21
  class MostCommonObjectTypesReport(pydantic.BaseModel):
22
- object_types: typing.List[typing.Tuple[str, int]]
22
+ object_types: list[tuple[str, int]]
23
23
 
24
24
 
25
25
  class ObjectTypeReport(pydantic.BaseModel):
@@ -27,4 +27,4 @@ class ObjectTypeReport(pydantic.BaseModel):
27
27
  sample_size: int
28
28
  start_index: typing.Optional[int]
29
29
  max_depth: int
30
- object_report: typing.List[typing.Dict[str, typing.Any]]
30
+ object_report: list[dict[str, typing.Any]]
@@ -11,8 +11,6 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- #
15
- # flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
16
14
 
17
15
  from .constants import (
18
16
  ControllerPolicy,
@@ -25,17 +23,29 @@ from .constants import (
25
23
  FeatureSetFeatures,
26
24
  FileTargetKind,
27
25
  FunctionURI,
26
+ MetricData,
28
27
  ModelEndpointTarget,
29
28
  ModelMonitoringMode,
30
29
  ModelMonitoringStoreKinds,
31
30
  MonitoringFunctionNames,
31
+ PredictionsQueryConstants,
32
32
  ProjectSecretKeys,
33
+ PrometheusEndpoints,
33
34
  PrometheusMetric,
34
- TimeSeriesTarget,
35
+ ResultData,
36
+ ResultKindApp,
37
+ SchedulingKeys,
38
+ SpecialApps,
39
+ TDEngineSuperTables,
40
+ TSDBTarget,
41
+ V3IOTSDBTables,
35
42
  VersionedModel,
43
+ WriterEvent,
44
+ WriterEventKind,
36
45
  )
37
46
  from .grafana import (
38
47
  GrafanaColumn,
48
+ GrafanaColumnType,
39
49
  GrafanaDataPoint,
40
50
  GrafanaNumberColumn,
41
51
  GrafanaStringColumn,
@@ -48,6 +58,11 @@ from .model_endpoints import (
48
58
  ModelEndpoint,
49
59
  ModelEndpointList,
50
60
  ModelEndpointMetadata,
61
+ ModelEndpointMonitoringMetric,
62
+ ModelEndpointMonitoringMetricNoData,
63
+ ModelEndpointMonitoringMetricType,
64
+ ModelEndpointMonitoringMetricValues,
65
+ ModelEndpointMonitoringResultValues,
51
66
  ModelEndpointSpec,
52
67
  ModelEndpointStatus,
53
68
  )