mlrun 1.7.0rc5__py3-none-any.whl → 1.7.2__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 (234) hide show
  1. mlrun/__init__.py +11 -1
  2. mlrun/__main__.py +39 -121
  3. mlrun/{datastore/helpers.py → alerts/__init__.py} +2 -5
  4. mlrun/alerts/alert.py +248 -0
  5. mlrun/api/schemas/__init__.py +4 -3
  6. mlrun/artifacts/__init__.py +8 -3
  7. mlrun/artifacts/base.py +39 -254
  8. mlrun/artifacts/dataset.py +9 -190
  9. mlrun/artifacts/manager.py +73 -46
  10. mlrun/artifacts/model.py +30 -158
  11. mlrun/artifacts/plots.py +23 -380
  12. mlrun/common/constants.py +73 -2
  13. mlrun/common/db/sql_session.py +3 -2
  14. mlrun/common/formatters/__init__.py +21 -0
  15. mlrun/common/formatters/artifact.py +46 -0
  16. mlrun/common/formatters/base.py +113 -0
  17. mlrun/common/formatters/feature_set.py +44 -0
  18. mlrun/common/formatters/function.py +46 -0
  19. mlrun/common/formatters/pipeline.py +53 -0
  20. mlrun/common/formatters/project.py +51 -0
  21. mlrun/common/formatters/run.py +29 -0
  22. mlrun/common/helpers.py +11 -1
  23. mlrun/{runtimes → common/runtimes}/constants.py +32 -4
  24. mlrun/common/schemas/__init__.py +21 -4
  25. mlrun/common/schemas/alert.py +202 -0
  26. mlrun/common/schemas/api_gateway.py +113 -2
  27. mlrun/common/schemas/artifact.py +28 -1
  28. mlrun/common/schemas/auth.py +11 -0
  29. mlrun/common/schemas/client_spec.py +2 -1
  30. mlrun/common/schemas/common.py +7 -4
  31. mlrun/common/schemas/constants.py +3 -0
  32. mlrun/common/schemas/feature_store.py +58 -28
  33. mlrun/common/schemas/frontend_spec.py +8 -0
  34. mlrun/common/schemas/function.py +11 -0
  35. mlrun/common/schemas/hub.py +7 -9
  36. mlrun/common/schemas/model_monitoring/__init__.py +21 -4
  37. mlrun/common/schemas/model_monitoring/constants.py +136 -42
  38. mlrun/common/schemas/model_monitoring/grafana.py +9 -5
  39. mlrun/common/schemas/model_monitoring/model_endpoints.py +89 -41
  40. mlrun/common/schemas/notification.py +69 -12
  41. mlrun/{runtimes/mpijob/v1alpha1.py → common/schemas/pagination.py} +10 -13
  42. mlrun/common/schemas/pipeline.py +7 -0
  43. mlrun/common/schemas/project.py +67 -16
  44. mlrun/common/schemas/runs.py +17 -0
  45. mlrun/common/schemas/schedule.py +1 -1
  46. mlrun/common/schemas/workflow.py +10 -2
  47. mlrun/common/types.py +14 -1
  48. mlrun/config.py +224 -58
  49. mlrun/data_types/data_types.py +11 -1
  50. mlrun/data_types/spark.py +5 -4
  51. mlrun/data_types/to_pandas.py +75 -34
  52. mlrun/datastore/__init__.py +8 -10
  53. mlrun/datastore/alibaba_oss.py +131 -0
  54. mlrun/datastore/azure_blob.py +131 -43
  55. mlrun/datastore/base.py +107 -47
  56. mlrun/datastore/datastore.py +17 -7
  57. mlrun/datastore/datastore_profile.py +91 -7
  58. mlrun/datastore/dbfs_store.py +3 -7
  59. mlrun/datastore/filestore.py +1 -3
  60. mlrun/datastore/google_cloud_storage.py +92 -32
  61. mlrun/datastore/hdfs.py +5 -0
  62. mlrun/datastore/inmem.py +6 -3
  63. mlrun/datastore/redis.py +3 -2
  64. mlrun/datastore/s3.py +30 -12
  65. mlrun/datastore/snowflake_utils.py +45 -0
  66. mlrun/datastore/sources.py +274 -59
  67. mlrun/datastore/spark_utils.py +30 -0
  68. mlrun/datastore/store_resources.py +9 -7
  69. mlrun/datastore/storeytargets.py +151 -0
  70. mlrun/datastore/targets.py +374 -102
  71. mlrun/datastore/utils.py +68 -5
  72. mlrun/datastore/v3io.py +28 -50
  73. mlrun/db/auth_utils.py +152 -0
  74. mlrun/db/base.py +231 -22
  75. mlrun/db/factory.py +1 -4
  76. mlrun/db/httpdb.py +864 -228
  77. mlrun/db/nopdb.py +268 -16
  78. mlrun/errors.py +35 -5
  79. mlrun/execution.py +111 -38
  80. mlrun/feature_store/__init__.py +0 -2
  81. mlrun/feature_store/api.py +46 -53
  82. mlrun/feature_store/common.py +6 -11
  83. mlrun/feature_store/feature_set.py +48 -23
  84. mlrun/feature_store/feature_vector.py +13 -2
  85. mlrun/feature_store/ingestion.py +7 -6
  86. mlrun/feature_store/retrieval/base.py +9 -4
  87. mlrun/feature_store/retrieval/dask_merger.py +2 -0
  88. mlrun/feature_store/retrieval/job.py +13 -4
  89. mlrun/feature_store/retrieval/local_merger.py +2 -0
  90. mlrun/feature_store/retrieval/spark_merger.py +24 -32
  91. mlrun/feature_store/steps.py +38 -19
  92. mlrun/features.py +6 -14
  93. mlrun/frameworks/_common/plan.py +3 -3
  94. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +7 -12
  95. mlrun/frameworks/_ml_common/plan.py +1 -1
  96. mlrun/frameworks/auto_mlrun/auto_mlrun.py +2 -2
  97. mlrun/frameworks/lgbm/__init__.py +1 -1
  98. mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
  99. mlrun/frameworks/lgbm/model_handler.py +1 -1
  100. mlrun/frameworks/parallel_coordinates.py +4 -4
  101. mlrun/frameworks/pytorch/__init__.py +2 -2
  102. mlrun/frameworks/sklearn/__init__.py +1 -1
  103. mlrun/frameworks/sklearn/mlrun_interface.py +13 -3
  104. mlrun/frameworks/tf_keras/__init__.py +5 -2
  105. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +1 -1
  106. mlrun/frameworks/tf_keras/mlrun_interface.py +2 -2
  107. mlrun/frameworks/xgboost/__init__.py +1 -1
  108. mlrun/k8s_utils.py +57 -12
  109. mlrun/launcher/__init__.py +1 -1
  110. mlrun/launcher/base.py +6 -5
  111. mlrun/launcher/client.py +13 -11
  112. mlrun/launcher/factory.py +1 -1
  113. mlrun/launcher/local.py +15 -5
  114. mlrun/launcher/remote.py +10 -3
  115. mlrun/lists.py +6 -2
  116. mlrun/model.py +297 -48
  117. mlrun/model_monitoring/__init__.py +1 -1
  118. mlrun/model_monitoring/api.py +152 -357
  119. mlrun/model_monitoring/applications/__init__.py +10 -0
  120. mlrun/model_monitoring/applications/_application_steps.py +190 -0
  121. mlrun/model_monitoring/applications/base.py +108 -0
  122. mlrun/model_monitoring/applications/context.py +341 -0
  123. mlrun/model_monitoring/{evidently_application.py → applications/evidently_base.py} +27 -22
  124. mlrun/model_monitoring/applications/histogram_data_drift.py +227 -91
  125. mlrun/model_monitoring/applications/results.py +99 -0
  126. mlrun/model_monitoring/controller.py +130 -303
  127. mlrun/model_monitoring/{stores/models/sqlite.py → db/__init__.py} +5 -10
  128. mlrun/model_monitoring/db/stores/__init__.py +136 -0
  129. mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
  130. mlrun/model_monitoring/db/stores/base/store.py +213 -0
  131. mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
  132. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
  133. mlrun/model_monitoring/db/stores/sqldb/models/base.py +190 -0
  134. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +103 -0
  135. mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
  136. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +659 -0
  137. mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
  138. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +726 -0
  139. mlrun/model_monitoring/db/tsdb/__init__.py +105 -0
  140. mlrun/model_monitoring/db/tsdb/base.py +448 -0
  141. mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
  142. mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
  143. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +298 -0
  144. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +42 -0
  145. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +522 -0
  146. mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
  147. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +158 -0
  148. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +849 -0
  149. mlrun/model_monitoring/features_drift_table.py +34 -22
  150. mlrun/model_monitoring/helpers.py +177 -39
  151. mlrun/model_monitoring/model_endpoint.py +3 -2
  152. mlrun/model_monitoring/stream_processing.py +165 -398
  153. mlrun/model_monitoring/tracking_policy.py +7 -1
  154. mlrun/model_monitoring/writer.py +161 -125
  155. mlrun/package/packagers/default_packager.py +2 -2
  156. mlrun/package/packagers_manager.py +1 -0
  157. mlrun/package/utils/_formatter.py +2 -2
  158. mlrun/platforms/__init__.py +11 -10
  159. mlrun/platforms/iguazio.py +67 -228
  160. mlrun/projects/__init__.py +6 -1
  161. mlrun/projects/operations.py +47 -20
  162. mlrun/projects/pipelines.py +396 -249
  163. mlrun/projects/project.py +1125 -414
  164. mlrun/render.py +28 -22
  165. mlrun/run.py +207 -180
  166. mlrun/runtimes/__init__.py +76 -11
  167. mlrun/runtimes/base.py +40 -14
  168. mlrun/runtimes/daskjob.py +9 -2
  169. mlrun/runtimes/databricks_job/databricks_runtime.py +1 -0
  170. mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
  171. mlrun/runtimes/funcdoc.py +1 -29
  172. mlrun/runtimes/kubejob.py +34 -128
  173. mlrun/runtimes/local.py +39 -10
  174. mlrun/runtimes/mpijob/__init__.py +0 -20
  175. mlrun/runtimes/mpijob/abstract.py +8 -8
  176. mlrun/runtimes/mpijob/v1.py +1 -1
  177. mlrun/runtimes/nuclio/api_gateway.py +646 -177
  178. mlrun/runtimes/nuclio/application/__init__.py +15 -0
  179. mlrun/runtimes/nuclio/application/application.py +758 -0
  180. mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
  181. mlrun/runtimes/nuclio/function.py +188 -68
  182. mlrun/runtimes/nuclio/serving.py +57 -60
  183. mlrun/runtimes/pod.py +191 -58
  184. mlrun/runtimes/remotesparkjob.py +11 -8
  185. mlrun/runtimes/sparkjob/spark3job.py +17 -18
  186. mlrun/runtimes/utils.py +40 -73
  187. mlrun/secrets.py +6 -2
  188. mlrun/serving/__init__.py +8 -1
  189. mlrun/serving/remote.py +2 -3
  190. mlrun/serving/routers.py +89 -64
  191. mlrun/serving/server.py +54 -26
  192. mlrun/serving/states.py +187 -56
  193. mlrun/serving/utils.py +19 -11
  194. mlrun/serving/v2_serving.py +136 -63
  195. mlrun/track/tracker.py +2 -1
  196. mlrun/track/trackers/mlflow_tracker.py +5 -0
  197. mlrun/utils/async_http.py +26 -6
  198. mlrun/utils/db.py +18 -0
  199. mlrun/utils/helpers.py +375 -105
  200. mlrun/utils/http.py +2 -2
  201. mlrun/utils/logger.py +75 -9
  202. mlrun/utils/notifications/notification/__init__.py +14 -10
  203. mlrun/utils/notifications/notification/base.py +48 -0
  204. mlrun/utils/notifications/notification/console.py +2 -0
  205. mlrun/utils/notifications/notification/git.py +24 -1
  206. mlrun/utils/notifications/notification/ipython.py +2 -0
  207. mlrun/utils/notifications/notification/slack.py +96 -21
  208. mlrun/utils/notifications/notification/webhook.py +63 -2
  209. mlrun/utils/notifications/notification_pusher.py +146 -16
  210. mlrun/utils/regex.py +9 -0
  211. mlrun/utils/retryer.py +3 -2
  212. mlrun/utils/v3io_clients.py +2 -3
  213. mlrun/utils/version/version.json +2 -2
  214. mlrun-1.7.2.dist-info/METADATA +390 -0
  215. mlrun-1.7.2.dist-info/RECORD +351 -0
  216. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.2.dist-info}/WHEEL +1 -1
  217. mlrun/feature_store/retrieval/conversion.py +0 -271
  218. mlrun/kfpops.py +0 -868
  219. mlrun/model_monitoring/application.py +0 -310
  220. mlrun/model_monitoring/batch.py +0 -974
  221. mlrun/model_monitoring/controller_handler.py +0 -37
  222. mlrun/model_monitoring/prometheus.py +0 -216
  223. mlrun/model_monitoring/stores/__init__.py +0 -111
  224. mlrun/model_monitoring/stores/kv_model_endpoint_store.py +0 -574
  225. mlrun/model_monitoring/stores/model_endpoint_store.py +0 -145
  226. mlrun/model_monitoring/stores/models/__init__.py +0 -27
  227. mlrun/model_monitoring/stores/models/base.py +0 -84
  228. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
  229. mlrun/platforms/other.py +0 -305
  230. mlrun-1.7.0rc5.dist-info/METADATA +0 -269
  231. mlrun-1.7.0rc5.dist-info/RECORD +0 -323
  232. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.2.dist-info}/LICENSE +0 -0
  233. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.2.dist-info}/entry_points.txt +0 -0
  234. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,113 @@
1
+ # Copyright 2024 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
+
16
+ import typing
17
+
18
+ import mlrun.errors
19
+
20
+
21
+ class ObjectFormat:
22
+ """
23
+ MLRun object formatter. Any class that inherits from this class should implement the `format_method` method
24
+ to specify the formatting method for each format.
25
+ A `filter_obj_method` utility method is provided to filter the object based on a list of keys.
26
+ """
27
+
28
+ full = "full"
29
+
30
+ @staticmethod
31
+ def format_method(format_: str) -> typing.Optional[typing.Callable]:
32
+ """
33
+ Get the formatting method for the provided format.
34
+ A `None` value signifies a pass-through formatting method (no formatting).
35
+ :param format_: The format as a string representation.
36
+ :return: The formatting method.
37
+ """
38
+ return {
39
+ ObjectFormat.full: None,
40
+ }[format_]
41
+
42
+ @classmethod
43
+ def format_obj(
44
+ cls,
45
+ obj: typing.Any,
46
+ format_: str,
47
+ exclude_formats: typing.Optional[list[str]] = None,
48
+ ) -> typing.Any:
49
+ """
50
+ Format the provided object based on the provided format.
51
+ :param obj: The object to format.
52
+ :param format_: The format as a string representation.
53
+ :param exclude_formats: A list of formats to exclude from the formatting process. If the provided format is in
54
+ this list, an invalid format exception will be raised.
55
+ """
56
+ exclude_formats = exclude_formats or []
57
+ format_ = format_ or cls.full
58
+ invalid_format_exc = mlrun.errors.MLRunBadRequestError(
59
+ f"Provided format is not supported. format={format_}"
60
+ )
61
+
62
+ if format_ in exclude_formats:
63
+ raise invalid_format_exc
64
+
65
+ try:
66
+ format_method = cls.format_method(format_)
67
+ except KeyError:
68
+ raise invalid_format_exc
69
+
70
+ if not format_method:
71
+ return obj
72
+
73
+ return format_method(obj)
74
+
75
+ @staticmethod
76
+ def filter_obj_method(_filter: list[str]) -> typing.Callable:
77
+ """
78
+ Returns a method that filters the object based on the provided list of keys.
79
+ The keys should be in a dot-separated format, denoting the path within the dictionary to the desired key.
80
+ The object maintains its structure, with the filtered keys and their values, while all other keys are removed.
81
+ :param _filter: The list of keys to filter by.
82
+ Example:
83
+ [
84
+ "kind",
85
+ "metadata.name",
86
+ "spec.something.else",
87
+ ]
88
+
89
+ :return: The filtering method.
90
+ """
91
+
92
+ def _filter_method(obj: dict) -> dict:
93
+ formatted_obj = {}
94
+ for key in _filter:
95
+ key_list = key.split(".")
96
+ obj_recursive_iterator = obj
97
+ formatted_obj_recursive_iterator = formatted_obj
98
+ for idx, key in enumerate(key_list):
99
+ if key not in obj_recursive_iterator:
100
+ break
101
+ value = (
102
+ {} if idx < len(key_list) - 1 else obj_recursive_iterator[key]
103
+ )
104
+ formatted_obj_recursive_iterator.setdefault(key, value)
105
+
106
+ obj_recursive_iterator = obj_recursive_iterator[key]
107
+ formatted_obj_recursive_iterator = formatted_obj_recursive_iterator[
108
+ key
109
+ ]
110
+
111
+ return formatted_obj
112
+
113
+ return _filter_method
@@ -0,0 +1,44 @@
1
+ # Copyright 2024 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
+
16
+ import typing
17
+
18
+ import mlrun.common.types
19
+
20
+ from .base import ObjectFormat
21
+
22
+
23
+ class FeatureSetFormat(ObjectFormat, mlrun.common.types.StrEnum):
24
+ minimal = "minimal"
25
+
26
+ @staticmethod
27
+ def format_method(_format: str) -> typing.Optional[typing.Callable]:
28
+ return {
29
+ FeatureSetFormat.full: None,
30
+ FeatureSetFormat.minimal: FeatureSetFormat.filter_obj_method(
31
+ [
32
+ "metadata.name",
33
+ "metadata.project",
34
+ "metadata.tag",
35
+ "metadata.uid",
36
+ "metadata.labels",
37
+ "spec.entities",
38
+ "spec.description",
39
+ "spec.targets",
40
+ "spec.engine", # It's not needed by the UI, but we override it anyway to storey if empty
41
+ "status.state",
42
+ ]
43
+ ),
44
+ }[_format]
@@ -0,0 +1,46 @@
1
+ # Copyright 2024 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
+
16
+ import typing
17
+
18
+ import mlrun.common.types
19
+
20
+ from .base import ObjectFormat
21
+
22
+
23
+ class FunctionFormat(ObjectFormat, mlrun.common.types.StrEnum):
24
+ minimal = "minimal"
25
+
26
+ @staticmethod
27
+ def format_method(_format: str) -> typing.Optional[typing.Callable]:
28
+ return {
29
+ FunctionFormat.full: None,
30
+ FunctionFormat.minimal: FunctionFormat.filter_obj_method(
31
+ [
32
+ "kind",
33
+ "metadata",
34
+ "status",
35
+ "spec.description",
36
+ "spec.command",
37
+ "spec.image",
38
+ "spec.default_handler",
39
+ "spec.default_class",
40
+ "spec.graph",
41
+ "spec.preemption_mode",
42
+ "spec.node_selector",
43
+ "spec.priority_class_name",
44
+ ]
45
+ ),
46
+ }[_format]
@@ -0,0 +1,53 @@
1
+ # Copyright 2024 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
+
16
+ import typing
17
+
18
+ import mlrun_pipelines.common.ops
19
+ import mlrun_pipelines.models
20
+
21
+ import mlrun.common.types
22
+
23
+ from .base import ObjectFormat
24
+
25
+
26
+ class PipelineFormat(ObjectFormat, mlrun.common.types.StrEnum):
27
+ full = "full"
28
+ metadata_only = "metadata_only"
29
+ name_only = "name_only"
30
+ summary = "summary"
31
+
32
+ @staticmethod
33
+ def format_method(_format: str) -> typing.Optional[typing.Callable]:
34
+ def _full(run: mlrun_pipelines.models.PipelineRun) -> dict:
35
+ return run.to_dict()
36
+
37
+ def _metadata_only(run: mlrun_pipelines.models.PipelineRun) -> dict:
38
+ return mlrun.utils.helpers.format_run(run, with_project=True)
39
+
40
+ def _name_only(run: mlrun_pipelines.models.PipelineRun) -> str:
41
+ return run.get("name")
42
+
43
+ def _summary(run: mlrun_pipelines.models.PipelineRun) -> dict:
44
+ return mlrun_pipelines.common.ops.format_summary_from_kfp_run(
45
+ run, run["project"]
46
+ )
47
+
48
+ return {
49
+ PipelineFormat.full: _full,
50
+ PipelineFormat.metadata_only: _metadata_only,
51
+ PipelineFormat.name_only: _name_only,
52
+ PipelineFormat.summary: _summary,
53
+ }[_format]
@@ -0,0 +1,51 @@
1
+ # Copyright 2024 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
+
16
+ import typing
17
+
18
+ import mlrun.common.schemas
19
+ import mlrun.common.types
20
+
21
+ from .base import ObjectFormat
22
+
23
+
24
+ class ProjectFormat(ObjectFormat, mlrun.common.types.StrEnum):
25
+ full = "full"
26
+ name_only = "name_only"
27
+ # minimal format removes large fields from the response (e.g. functions, workflows, artifacts)
28
+ # and is used for faster response times (in the UI)
29
+ minimal = "minimal"
30
+ # internal - allowed only in follower mode, only for the leader for upgrade purposes
31
+ leader = "leader"
32
+
33
+ @staticmethod
34
+ def format_method(_format: str) -> typing.Optional[typing.Callable]:
35
+ def _name_only(project: mlrun.common.schemas.Project) -> str:
36
+ return project.metadata.name
37
+
38
+ def _minimal(
39
+ project: mlrun.common.schemas.Project,
40
+ ) -> mlrun.common.schemas.Project:
41
+ project.spec.functions = None
42
+ project.spec.workflows = None
43
+ project.spec.artifacts = None
44
+ return project
45
+
46
+ return {
47
+ ProjectFormat.full: None,
48
+ ProjectFormat.name_only: _name_only,
49
+ ProjectFormat.minimal: _minimal,
50
+ ProjectFormat.leader: None,
51
+ }[_format]
@@ -0,0 +1,29 @@
1
+ # Copyright 2024 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
+
16
+
17
+ import mlrun.common.types
18
+ from mlrun.common.formatters.base import ObjectFormat
19
+
20
+
21
+ class RunFormat(ObjectFormat, mlrun.common.types.StrEnum):
22
+ # No enrichment, data is pulled as-is from the database.
23
+ standard = "standard"
24
+
25
+ # Enrich run with full notifications since the notification params are subtracted from the run body.
26
+ notifications = "notifications"
27
+
28
+ # Performs run enrichment, including the run's artifacts. Only available for the `get` run API.
29
+ full = "full"
mlrun/common/helpers.py CHANGED
@@ -11,7 +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
14
 
16
15
 
17
16
  def parse_versioned_object_uri(
@@ -34,3 +33,14 @@ def parse_versioned_object_uri(
34
33
  uri = uri[:loc]
35
34
 
36
35
  return project, uri, tag, hash_key
36
+
37
+
38
+ def generate_api_gateway_name(project: str, name: str) -> str:
39
+ """
40
+ Generate a unique (within project) api gateway name
41
+ :param project: project name
42
+ :param name: api gateway name
43
+
44
+ :return: the resolved api gateway name
45
+ """
46
+ return f"{project}-{name}" if project else name
@@ -15,6 +15,10 @@
15
15
  import enum
16
16
  import typing
17
17
 
18
+ import mlrun_pipelines.common.models
19
+
20
+ import mlrun.common.constants as mlrun_constants
21
+
18
22
 
19
23
  class PodPhases:
20
24
  """
@@ -122,8 +126,8 @@ class MPIJobCRDVersions:
122
126
  @staticmethod
123
127
  def role_label_by_version(version):
124
128
  return {
125
- MPIJobCRDVersions.v1alpha1: "mpi_role_type",
126
- MPIJobCRDVersions.v1: "mpi-job-role",
129
+ MPIJobCRDVersions.v1alpha1: mlrun_constants.MLRunInternalLabels.mpi_role_type,
130
+ MPIJobCRDVersions.v1: mlrun_constants.MLRunInternalLabels.mpi_job_role,
127
131
  }[version]
128
132
 
129
133
 
@@ -136,6 +140,7 @@ class RunStates:
136
140
  unknown = "unknown"
137
141
  aborted = "aborted"
138
142
  aborting = "aborting"
143
+ skipped = "skipped"
139
144
 
140
145
  @staticmethod
141
146
  def all():
@@ -148,6 +153,7 @@ class RunStates:
148
153
  RunStates.unknown,
149
154
  RunStates.aborted,
150
155
  RunStates.aborting,
156
+ RunStates.skipped,
151
157
  ]
152
158
 
153
159
  @staticmethod
@@ -156,6 +162,7 @@ class RunStates:
156
162
  RunStates.completed,
157
163
  RunStates.error,
158
164
  RunStates.aborted,
165
+ RunStates.skipped,
159
166
  ]
160
167
 
161
168
  @staticmethod
@@ -188,10 +195,31 @@ class RunStates:
188
195
  # TODO: add aborting state once we have it
189
196
  ]
190
197
 
198
+ @staticmethod
199
+ def run_state_to_pipeline_run_status(run_state: str):
200
+ if not run_state:
201
+ return mlrun_pipelines.common.models.RunStatuses.runtime_state_unspecified
191
202
 
203
+ if run_state not in RunStates.all():
204
+ raise ValueError(f"Invalid run state: {run_state}")
205
+
206
+ return {
207
+ RunStates.completed: mlrun_pipelines.common.models.RunStatuses.succeeded,
208
+ RunStates.error: mlrun_pipelines.common.models.RunStatuses.failed,
209
+ RunStates.running: mlrun_pipelines.common.models.RunStatuses.running,
210
+ RunStates.created: mlrun_pipelines.common.models.RunStatuses.pending,
211
+ RunStates.pending: mlrun_pipelines.common.models.RunStatuses.pending,
212
+ RunStates.unknown: mlrun_pipelines.common.models.RunStatuses.runtime_state_unspecified,
213
+ RunStates.aborted: mlrun_pipelines.common.models.RunStatuses.canceled,
214
+ RunStates.aborting: mlrun_pipelines.common.models.RunStatuses.canceling,
215
+ RunStates.skipped: mlrun_pipelines.common.models.RunStatuses.skipped,
216
+ }[run_state]
217
+
218
+
219
+ # TODO: remove this class in 1.9.0 - use only MlrunInternalLabels
192
220
  class RunLabels(enum.Enum):
193
- owner = "owner"
194
- v3io_user = "v3io_user"
221
+ owner = mlrun_constants.MLRunInternalLabels.owner
222
+ v3io_user = mlrun_constants.MLRunInternalLabels.v3io_user
195
223
 
196
224
  @staticmethod
197
225
  def all():
@@ -14,6 +14,13 @@
14
14
  #
15
15
  # flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
16
16
 
17
+ from .alert import (
18
+ AlertActiveState,
19
+ AlertConfig,
20
+ AlertNotification,
21
+ AlertTemplate,
22
+ Event,
23
+ )
17
24
  from .api_gateway import (
18
25
  APIGateway,
19
26
  APIGatewayAuthenticationMode,
@@ -21,6 +28,7 @@ from .api_gateway import (
21
28
  APIGatewayMetadata,
22
29
  APIGatewaysOutput,
23
30
  APIGatewaySpec,
31
+ APIGatewayState,
24
32
  APIGatewayStatus,
25
33
  APIGatewayUpstream,
26
34
  )
@@ -29,7 +37,6 @@ from .artifact import (
29
37
  ArtifactCategories,
30
38
  ArtifactIdentifier,
31
39
  ArtifactMetadata,
32
- ArtifactsFormat,
33
40
  ArtifactSpec,
34
41
  )
35
42
  from .auth import (
@@ -75,6 +82,7 @@ from .events import (
75
82
  )
76
83
  from .feature_store import (
77
84
  EntitiesOutput,
85
+ EntitiesOutputV2,
78
86
  Entity,
79
87
  EntityListOutput,
80
88
  EntityRecord,
@@ -83,7 +91,9 @@ from .feature_store import (
83
91
  FeatureRecord,
84
92
  FeatureSet,
85
93
  FeatureSetDigestOutput,
94
+ FeatureSetDigestOutputV2,
86
95
  FeatureSetDigestSpec,
96
+ FeatureSetDigestSpecV2,
87
97
  FeatureSetIngestInput,
88
98
  FeatureSetIngestOutput,
89
99
  FeatureSetRecord,
@@ -91,12 +101,14 @@ from .feature_store import (
91
101
  FeatureSetSpec,
92
102
  FeatureSetsTagsOutput,
93
103
  FeaturesOutput,
104
+ FeaturesOutputV2,
94
105
  FeatureVector,
95
106
  FeatureVectorRecord,
96
107
  FeatureVectorsOutput,
97
108
  FeatureVectorsTagsOutput,
98
109
  )
99
110
  from .frontend_spec import (
111
+ ArtifactLimits,
100
112
  AuthenticationFeatureFlag,
101
113
  FeatureFlags,
102
114
  FrontendSpec,
@@ -124,6 +136,7 @@ from .model_monitoring import (
124
136
  EventFieldType,
125
137
  EventKeyMetrics,
126
138
  Features,
139
+ FeatureSetFeatures,
127
140
  FeatureValues,
128
141
  GrafanaColumn,
129
142
  GrafanaDataPoint,
@@ -139,7 +152,8 @@ from .model_monitoring import (
139
152
  ModelMonitoringMode,
140
153
  ModelMonitoringStoreKinds,
141
154
  MonitoringFunctionNames,
142
- TimeSeriesTarget,
155
+ TSDBTarget,
156
+ V3IOTSDBTables,
143
157
  )
144
158
  from .notification import (
145
159
  Notification,
@@ -149,16 +163,19 @@ from .notification import (
149
163
  SetNotificationRequest,
150
164
  )
151
165
  from .object import ObjectKind, ObjectMetadata, ObjectSpec, ObjectStatus
152
- from .pipeline import PipelinesFormat, PipelinesOutput, PipelinesPagination
166
+ from .pagination import PaginationInfo
167
+ from .pipeline import PipelinesOutput, PipelinesPagination
153
168
  from .project import (
154
169
  IguazioProject,
155
170
  Project,
156
171
  ProjectDesiredState,
157
172
  ProjectMetadata,
173
+ ProjectOut,
174
+ ProjectOutput,
158
175
  ProjectOwner,
159
- ProjectsFormat,
160
176
  ProjectsOutput,
161
177
  ProjectSpec,
178
+ ProjectSpecOut,
162
179
  ProjectState,
163
180
  ProjectStatus,
164
181
  ProjectSummariesOutput,