mlrun 1.7.0rc4__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 (200) hide show
  1. mlrun/__init__.py +11 -1
  2. mlrun/__main__.py +25 -111
  3. mlrun/{datastore/helpers.py → alerts/__init__.py} +2 -5
  4. mlrun/alerts/alert.py +144 -0
  5. mlrun/api/schemas/__init__.py +4 -3
  6. mlrun/artifacts/__init__.py +8 -3
  7. mlrun/artifacts/base.py +38 -254
  8. mlrun/artifacts/dataset.py +9 -190
  9. mlrun/artifacts/manager.py +41 -47
  10. mlrun/artifacts/model.py +30 -158
  11. mlrun/artifacts/plots.py +23 -380
  12. mlrun/common/constants.py +68 -0
  13. mlrun/common/formatters/__init__.py +19 -0
  14. mlrun/{model_monitoring/stores/models/sqlite.py → common/formatters/artifact.py} +6 -8
  15. mlrun/common/formatters/base.py +78 -0
  16. mlrun/common/formatters/function.py +41 -0
  17. mlrun/common/formatters/pipeline.py +53 -0
  18. mlrun/common/formatters/project.py +51 -0
  19. mlrun/{runtimes → common/runtimes}/constants.py +32 -4
  20. mlrun/common/schemas/__init__.py +25 -4
  21. mlrun/common/schemas/alert.py +203 -0
  22. mlrun/common/schemas/api_gateway.py +148 -0
  23. mlrun/common/schemas/artifact.py +15 -5
  24. mlrun/common/schemas/auth.py +8 -2
  25. mlrun/common/schemas/client_spec.py +2 -0
  26. mlrun/common/schemas/frontend_spec.py +1 -0
  27. mlrun/common/schemas/function.py +4 -0
  28. mlrun/common/schemas/hub.py +7 -9
  29. mlrun/common/schemas/model_monitoring/__init__.py +19 -3
  30. mlrun/common/schemas/model_monitoring/constants.py +96 -26
  31. mlrun/common/schemas/model_monitoring/grafana.py +9 -5
  32. mlrun/common/schemas/model_monitoring/model_endpoints.py +86 -2
  33. mlrun/{runtimes/mpijob/v1alpha1.py → common/schemas/pagination.py} +10 -13
  34. mlrun/common/schemas/pipeline.py +0 -9
  35. mlrun/common/schemas/project.py +22 -21
  36. mlrun/common/types.py +7 -1
  37. mlrun/config.py +87 -19
  38. mlrun/data_types/data_types.py +4 -0
  39. mlrun/data_types/to_pandas.py +9 -9
  40. mlrun/datastore/__init__.py +5 -8
  41. mlrun/datastore/alibaba_oss.py +130 -0
  42. mlrun/datastore/azure_blob.py +4 -5
  43. mlrun/datastore/base.py +69 -30
  44. mlrun/datastore/datastore.py +10 -2
  45. mlrun/datastore/datastore_profile.py +90 -6
  46. mlrun/datastore/google_cloud_storage.py +1 -1
  47. mlrun/datastore/hdfs.py +5 -0
  48. mlrun/datastore/inmem.py +2 -2
  49. mlrun/datastore/redis.py +2 -2
  50. mlrun/datastore/s3.py +5 -0
  51. mlrun/datastore/snowflake_utils.py +43 -0
  52. mlrun/datastore/sources.py +172 -44
  53. mlrun/datastore/store_resources.py +7 -7
  54. mlrun/datastore/targets.py +285 -41
  55. mlrun/datastore/utils.py +68 -5
  56. mlrun/datastore/v3io.py +27 -50
  57. mlrun/db/auth_utils.py +152 -0
  58. mlrun/db/base.py +149 -14
  59. mlrun/db/factory.py +1 -1
  60. mlrun/db/httpdb.py +608 -178
  61. mlrun/db/nopdb.py +191 -7
  62. mlrun/errors.py +11 -0
  63. mlrun/execution.py +37 -20
  64. mlrun/feature_store/__init__.py +0 -2
  65. mlrun/feature_store/api.py +21 -52
  66. mlrun/feature_store/feature_set.py +48 -23
  67. mlrun/feature_store/feature_vector.py +2 -1
  68. mlrun/feature_store/ingestion.py +7 -6
  69. mlrun/feature_store/retrieval/base.py +9 -4
  70. mlrun/feature_store/retrieval/conversion.py +9 -9
  71. mlrun/feature_store/retrieval/dask_merger.py +2 -0
  72. mlrun/feature_store/retrieval/job.py +9 -3
  73. mlrun/feature_store/retrieval/local_merger.py +2 -0
  74. mlrun/feature_store/retrieval/spark_merger.py +34 -24
  75. mlrun/feature_store/steps.py +30 -19
  76. mlrun/features.py +4 -13
  77. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +7 -12
  78. mlrun/frameworks/auto_mlrun/auto_mlrun.py +2 -2
  79. mlrun/frameworks/lgbm/__init__.py +1 -1
  80. mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
  81. mlrun/frameworks/lgbm/model_handler.py +1 -1
  82. mlrun/frameworks/parallel_coordinates.py +2 -1
  83. mlrun/frameworks/pytorch/__init__.py +2 -2
  84. mlrun/frameworks/sklearn/__init__.py +1 -1
  85. mlrun/frameworks/tf_keras/__init__.py +5 -2
  86. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +1 -1
  87. mlrun/frameworks/tf_keras/mlrun_interface.py +2 -2
  88. mlrun/frameworks/xgboost/__init__.py +1 -1
  89. mlrun/k8s_utils.py +10 -11
  90. mlrun/launcher/__init__.py +1 -1
  91. mlrun/launcher/base.py +6 -5
  92. mlrun/launcher/client.py +8 -6
  93. mlrun/launcher/factory.py +1 -1
  94. mlrun/launcher/local.py +9 -3
  95. mlrun/launcher/remote.py +9 -3
  96. mlrun/lists.py +6 -2
  97. mlrun/model.py +58 -19
  98. mlrun/model_monitoring/__init__.py +1 -1
  99. mlrun/model_monitoring/api.py +127 -301
  100. mlrun/model_monitoring/application.py +5 -296
  101. mlrun/model_monitoring/applications/__init__.py +11 -0
  102. mlrun/model_monitoring/applications/_application_steps.py +157 -0
  103. mlrun/model_monitoring/applications/base.py +282 -0
  104. mlrun/model_monitoring/applications/context.py +214 -0
  105. mlrun/model_monitoring/applications/evidently_base.py +211 -0
  106. mlrun/model_monitoring/applications/histogram_data_drift.py +224 -93
  107. mlrun/model_monitoring/applications/results.py +99 -0
  108. mlrun/model_monitoring/controller.py +30 -36
  109. mlrun/model_monitoring/db/__init__.py +18 -0
  110. mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -36
  111. mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
  112. mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +58 -32
  113. mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
  114. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
  115. mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +109 -5
  116. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +88 -0
  117. mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
  118. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +684 -0
  119. mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
  120. mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +302 -155
  121. mlrun/model_monitoring/db/tsdb/__init__.py +100 -0
  122. mlrun/model_monitoring/db/tsdb/base.py +329 -0
  123. mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
  124. mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
  125. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +240 -0
  126. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +45 -0
  127. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +397 -0
  128. mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
  129. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +117 -0
  130. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +630 -0
  131. mlrun/model_monitoring/evidently_application.py +6 -118
  132. mlrun/model_monitoring/features_drift_table.py +34 -22
  133. mlrun/model_monitoring/helpers.py +100 -7
  134. mlrun/model_monitoring/model_endpoint.py +3 -2
  135. mlrun/model_monitoring/stream_processing.py +93 -228
  136. mlrun/model_monitoring/tracking_policy.py +7 -1
  137. mlrun/model_monitoring/writer.py +152 -124
  138. mlrun/package/packagers_manager.py +1 -0
  139. mlrun/package/utils/_formatter.py +2 -2
  140. mlrun/platforms/__init__.py +11 -10
  141. mlrun/platforms/iguazio.py +21 -202
  142. mlrun/projects/operations.py +30 -16
  143. mlrun/projects/pipelines.py +92 -99
  144. mlrun/projects/project.py +757 -268
  145. mlrun/render.py +15 -14
  146. mlrun/run.py +160 -162
  147. mlrun/runtimes/__init__.py +55 -3
  148. mlrun/runtimes/base.py +33 -19
  149. mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
  150. mlrun/runtimes/funcdoc.py +0 -28
  151. mlrun/runtimes/kubejob.py +28 -122
  152. mlrun/runtimes/local.py +5 -2
  153. mlrun/runtimes/mpijob/__init__.py +0 -20
  154. mlrun/runtimes/mpijob/abstract.py +8 -8
  155. mlrun/runtimes/mpijob/v1.py +1 -1
  156. mlrun/runtimes/nuclio/__init__.py +1 -0
  157. mlrun/runtimes/nuclio/api_gateway.py +709 -0
  158. mlrun/runtimes/nuclio/application/__init__.py +15 -0
  159. mlrun/runtimes/nuclio/application/application.py +523 -0
  160. mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
  161. mlrun/runtimes/nuclio/function.py +98 -58
  162. mlrun/runtimes/nuclio/serving.py +36 -42
  163. mlrun/runtimes/pod.py +196 -45
  164. mlrun/runtimes/remotesparkjob.py +1 -1
  165. mlrun/runtimes/sparkjob/spark3job.py +1 -1
  166. mlrun/runtimes/utils.py +6 -73
  167. mlrun/secrets.py +6 -2
  168. mlrun/serving/remote.py +2 -3
  169. mlrun/serving/routers.py +7 -4
  170. mlrun/serving/server.py +7 -8
  171. mlrun/serving/states.py +73 -43
  172. mlrun/serving/v2_serving.py +8 -7
  173. mlrun/track/tracker.py +2 -1
  174. mlrun/utils/async_http.py +25 -5
  175. mlrun/utils/helpers.py +141 -75
  176. mlrun/utils/http.py +1 -1
  177. mlrun/utils/logger.py +39 -7
  178. mlrun/utils/notifications/notification/__init__.py +14 -9
  179. mlrun/utils/notifications/notification/base.py +12 -0
  180. mlrun/utils/notifications/notification/console.py +2 -0
  181. mlrun/utils/notifications/notification/git.py +3 -1
  182. mlrun/utils/notifications/notification/ipython.py +2 -0
  183. mlrun/utils/notifications/notification/slack.py +101 -21
  184. mlrun/utils/notifications/notification/webhook.py +11 -1
  185. mlrun/utils/notifications/notification_pusher.py +147 -16
  186. mlrun/utils/retryer.py +3 -2
  187. mlrun/utils/v3io_clients.py +0 -1
  188. mlrun/utils/version/version.json +2 -2
  189. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.0rc20.dist-info}/METADATA +33 -18
  190. mlrun-1.7.0rc20.dist-info/RECORD +353 -0
  191. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.0rc20.dist-info}/WHEEL +1 -1
  192. mlrun/kfpops.py +0 -868
  193. mlrun/model_monitoring/batch.py +0 -974
  194. mlrun/model_monitoring/stores/models/__init__.py +0 -27
  195. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
  196. mlrun/platforms/other.py +0 -305
  197. mlrun-1.7.0rc4.dist-info/RECORD +0 -321
  198. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.0rc20.dist-info}/LICENSE +0 -0
  199. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.0rc20.dist-info}/entry_points.txt +0 -0
  200. {mlrun-1.7.0rc4.dist-info → mlrun-1.7.0rc20.dist-info}/top_level.txt +0 -0
@@ -11,10 +11,24 @@
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
+ from sqlalchemy import (
15
+ TIMESTAMP,
16
+ Boolean,
17
+ Column,
18
+ Float,
19
+ Integer,
20
+ String,
21
+ Text,
22
+ )
14
23
 
15
- from sqlalchemy import TIMESTAMP, Boolean, Column, Integer, String, Text
16
-
17
- from mlrun.common.schemas.model_monitoring import EventFieldType
24
+ from mlrun.common.schemas.model_monitoring import (
25
+ EventFieldType,
26
+ FileTargetKind,
27
+ MetricData,
28
+ ResultData,
29
+ SchedulingKeys,
30
+ WriterEvent,
31
+ )
18
32
  from mlrun.utils.db import BaseModel
19
33
 
20
34
 
@@ -76,9 +90,99 @@ class ModelEndpointsBaseTable(BaseModel):
76
90
  metrics = Column(EventFieldType.METRICS, Text)
77
91
  first_request = Column(
78
92
  EventFieldType.FIRST_REQUEST,
79
- TIMESTAMP,
93
+ TIMESTAMP(timezone=True),
80
94
  )
81
95
  last_request = Column(
82
96
  EventFieldType.LAST_REQUEST,
83
- TIMESTAMP,
97
+ TIMESTAMP(timezone=True),
98
+ )
99
+
100
+
101
+ class ApplicationResultBaseTable(BaseModel):
102
+ __tablename__ = FileTargetKind.APP_RESULTS
103
+
104
+ uid = Column(EventFieldType.UID, String(120), primary_key=True)
105
+
106
+ application_name = Column(
107
+ WriterEvent.APPLICATION_NAME,
108
+ String(40),
109
+ nullable=True,
110
+ )
111
+
112
+ endpoint_id = Column(
113
+ WriterEvent.ENDPOINT_ID,
114
+ String(40),
115
+ nullable=True,
116
+ )
117
+
118
+ result_name = Column(
119
+ ResultData.RESULT_NAME,
120
+ String(40),
121
+ )
122
+
123
+ start_infer_time = Column(
124
+ WriterEvent.START_INFER_TIME,
125
+ TIMESTAMP(timezone=True),
126
+ )
127
+ end_infer_time = Column(
128
+ WriterEvent.END_INFER_TIME,
129
+ TIMESTAMP(timezone=True),
130
+ )
131
+
132
+ result_status = Column(ResultData.RESULT_STATUS, String(10))
133
+ result_kind = Column(ResultData.RESULT_KIND, String(40))
134
+ result_value = Column(ResultData.RESULT_VALUE, Float)
135
+ result_extra_data = Column(ResultData.RESULT_EXTRA_DATA, Text)
136
+ current_stats = Column(ResultData.CURRENT_STATS, Text)
137
+
138
+
139
+ class ApplicationMetricsBaseTable(BaseModel):
140
+ __tablename__ = FileTargetKind.APP_METRICS
141
+
142
+ uid = Column(EventFieldType.UID, String(120), primary_key=True)
143
+ application_name = Column(
144
+ WriterEvent.APPLICATION_NAME,
145
+ String(40),
146
+ nullable=True,
147
+ )
148
+ endpoint_id = Column(
149
+ WriterEvent.ENDPOINT_ID,
150
+ String(40),
151
+ nullable=True,
152
+ )
153
+ start_infer_time = Column(
154
+ WriterEvent.START_INFER_TIME,
155
+ TIMESTAMP(timezone=True),
156
+ )
157
+ end_infer_time = Column(
158
+ WriterEvent.END_INFER_TIME,
159
+ TIMESTAMP(timezone=True),
160
+ )
161
+ metric_name = Column(
162
+ MetricData.METRIC_NAME,
163
+ String(40),
164
+ )
165
+ metric_value = Column(MetricData.METRIC_VALUE, Float)
166
+
167
+
168
+ class MonitoringSchedulesBaseTable(BaseModel):
169
+ __tablename__ = FileTargetKind.MONITORING_SCHEDULES
170
+
171
+ uid = Column(SchedulingKeys.UID, String(32), primary_key=True)
172
+
173
+ application_name = Column(
174
+ SchedulingKeys.APPLICATION_NAME,
175
+ String(40),
176
+ nullable=False,
177
+ )
178
+
179
+ endpoint_id = Column(
180
+ SchedulingKeys.ENDPOINT_ID,
181
+ String(40),
182
+ nullable=False,
183
+ )
184
+
185
+ last_analyzed = Column(
186
+ SchedulingKeys.LAST_ANALYZED,
187
+ Integer,
84
188
  )
@@ -0,0 +1,88 @@
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 sqlalchemy.dialects.mysql
16
+ from sqlalchemy import Column, ForeignKey, String
17
+ from sqlalchemy.ext.declarative import declarative_base, declared_attr
18
+
19
+ from mlrun.common.schemas.model_monitoring import (
20
+ EventFieldType,
21
+ WriterEvent,
22
+ )
23
+
24
+ from .base import (
25
+ ApplicationMetricsBaseTable,
26
+ ApplicationResultBaseTable,
27
+ ModelEndpointsBaseTable,
28
+ MonitoringSchedulesBaseTable,
29
+ )
30
+
31
+ Base = declarative_base()
32
+
33
+
34
+ class ModelEndpointsTable(Base, ModelEndpointsBaseTable):
35
+ first_request = Column(
36
+ EventFieldType.FIRST_REQUEST,
37
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3, timezone=True),
38
+ )
39
+ last_request = Column(
40
+ EventFieldType.LAST_REQUEST,
41
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3, timezone=True),
42
+ )
43
+
44
+
45
+ class _ApplicationResultOrMetric:
46
+ """
47
+ This class sets common columns of `ApplicationResultTable` and `ApplicationMetricsTable`
48
+ to the correct values in MySQL.
49
+ Note: This class must come before the base tables in the inheritance order to override
50
+ the relevant columns.
51
+ """
52
+
53
+ start_infer_time = Column(
54
+ WriterEvent.START_INFER_TIME,
55
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3, timezone=True),
56
+ )
57
+ end_infer_time = Column(
58
+ WriterEvent.END_INFER_TIME,
59
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3, timezone=True),
60
+ )
61
+
62
+ @declared_attr
63
+ def endpoint_id(self):
64
+ return Column(
65
+ String(40),
66
+ ForeignKey(f"{EventFieldType.MODEL_ENDPOINTS}.{EventFieldType.UID}"),
67
+ )
68
+
69
+
70
+ class ApplicationResultTable(
71
+ Base, _ApplicationResultOrMetric, ApplicationResultBaseTable
72
+ ):
73
+ pass
74
+
75
+
76
+ class ApplicationMetricsTable(
77
+ Base, _ApplicationResultOrMetric, ApplicationMetricsBaseTable
78
+ ):
79
+ pass
80
+
81
+
82
+ class MonitoringSchedulesTable(Base, MonitoringSchedulesBaseTable):
83
+ @declared_attr
84
+ def endpoint_id(self):
85
+ return Column(
86
+ String(40),
87
+ ForeignKey(f"{EventFieldType.MODEL_ENDPOINTS}.{EventFieldType.UID}"),
88
+ )
@@ -12,23 +12,29 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import sqlalchemy.dialects.mysql
16
- from sqlalchemy import Column
17
15
  from sqlalchemy.ext.declarative import declarative_base
18
16
 
19
- from mlrun.common.schemas.model_monitoring import EventFieldType
20
-
21
- from .base import ModelEndpointsBaseTable
17
+ from .base import (
18
+ ApplicationMetricsBaseTable,
19
+ ApplicationResultBaseTable,
20
+ ModelEndpointsBaseTable,
21
+ MonitoringSchedulesBaseTable,
22
+ )
22
23
 
23
24
  Base = declarative_base()
24
25
 
25
26
 
26
27
  class ModelEndpointsTable(Base, ModelEndpointsBaseTable):
27
- first_request = Column(
28
- EventFieldType.FIRST_REQUEST,
29
- sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
30
- )
31
- last_request = Column(
32
- EventFieldType.LAST_REQUEST,
33
- sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
34
- )
28
+ pass
29
+
30
+
31
+ class ApplicationResultTable(Base, ApplicationResultBaseTable):
32
+ pass
33
+
34
+
35
+ class ApplicationMetricsTable(Base, ApplicationMetricsBaseTable):
36
+ pass
37
+
38
+
39
+ class MonitoringSchedulesTable(Base, MonitoringSchedulesBaseTable):
40
+ pass