mlrun 1.7.2rc4__py3-none-any.whl → 1.8.0__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 (275) hide show
  1. mlrun/__init__.py +26 -22
  2. mlrun/__main__.py +15 -16
  3. mlrun/alerts/alert.py +150 -15
  4. mlrun/api/schemas/__init__.py +1 -9
  5. mlrun/artifacts/__init__.py +2 -3
  6. mlrun/artifacts/base.py +62 -19
  7. mlrun/artifacts/dataset.py +17 -17
  8. mlrun/artifacts/document.py +454 -0
  9. mlrun/artifacts/manager.py +28 -18
  10. mlrun/artifacts/model.py +91 -59
  11. mlrun/artifacts/plots.py +2 -2
  12. mlrun/common/constants.py +8 -0
  13. mlrun/common/formatters/__init__.py +1 -0
  14. mlrun/common/formatters/artifact.py +1 -1
  15. mlrun/common/formatters/feature_set.py +2 -0
  16. mlrun/common/formatters/function.py +1 -0
  17. mlrun/{model_monitoring/db/stores/v3io_kv/__init__.py → common/formatters/model_endpoint.py} +17 -0
  18. mlrun/common/formatters/pipeline.py +1 -2
  19. mlrun/common/formatters/project.py +9 -0
  20. mlrun/common/model_monitoring/__init__.py +0 -5
  21. mlrun/common/model_monitoring/helpers.py +12 -62
  22. mlrun/common/runtimes/constants.py +25 -4
  23. mlrun/common/schemas/__init__.py +9 -5
  24. mlrun/common/schemas/alert.py +114 -19
  25. mlrun/common/schemas/api_gateway.py +3 -3
  26. mlrun/common/schemas/artifact.py +22 -9
  27. mlrun/common/schemas/auth.py +8 -4
  28. mlrun/common/schemas/background_task.py +7 -7
  29. mlrun/common/schemas/client_spec.py +4 -4
  30. mlrun/common/schemas/clusterization_spec.py +2 -2
  31. mlrun/common/schemas/common.py +53 -3
  32. mlrun/common/schemas/constants.py +15 -0
  33. mlrun/common/schemas/datastore_profile.py +1 -1
  34. mlrun/common/schemas/feature_store.py +9 -9
  35. mlrun/common/schemas/frontend_spec.py +4 -4
  36. mlrun/common/schemas/function.py +10 -10
  37. mlrun/common/schemas/hub.py +1 -1
  38. mlrun/common/schemas/k8s.py +3 -3
  39. mlrun/common/schemas/memory_reports.py +3 -3
  40. mlrun/common/schemas/model_monitoring/__init__.py +4 -8
  41. mlrun/common/schemas/model_monitoring/constants.py +127 -46
  42. mlrun/common/schemas/model_monitoring/grafana.py +18 -12
  43. mlrun/common/schemas/model_monitoring/model_endpoints.py +154 -160
  44. mlrun/common/schemas/notification.py +24 -3
  45. mlrun/common/schemas/object.py +1 -1
  46. mlrun/common/schemas/pagination.py +4 -4
  47. mlrun/common/schemas/partition.py +142 -0
  48. mlrun/common/schemas/pipeline.py +3 -3
  49. mlrun/common/schemas/project.py +26 -18
  50. mlrun/common/schemas/runs.py +3 -3
  51. mlrun/common/schemas/runtime_resource.py +5 -5
  52. mlrun/common/schemas/schedule.py +1 -1
  53. mlrun/common/schemas/secret.py +1 -1
  54. mlrun/{model_monitoring/db/stores/sqldb/__init__.py → common/schemas/serving.py} +10 -1
  55. mlrun/common/schemas/tag.py +3 -3
  56. mlrun/common/schemas/workflow.py +6 -5
  57. mlrun/common/types.py +1 -0
  58. mlrun/config.py +157 -89
  59. mlrun/data_types/__init__.py +5 -3
  60. mlrun/data_types/infer.py +13 -3
  61. mlrun/data_types/spark.py +2 -1
  62. mlrun/datastore/__init__.py +59 -18
  63. mlrun/datastore/alibaba_oss.py +4 -1
  64. mlrun/datastore/azure_blob.py +4 -1
  65. mlrun/datastore/base.py +19 -24
  66. mlrun/datastore/datastore.py +10 -4
  67. mlrun/datastore/datastore_profile.py +178 -45
  68. mlrun/datastore/dbfs_store.py +4 -1
  69. mlrun/datastore/filestore.py +4 -1
  70. mlrun/datastore/google_cloud_storage.py +4 -1
  71. mlrun/datastore/hdfs.py +4 -1
  72. mlrun/datastore/inmem.py +4 -1
  73. mlrun/datastore/redis.py +4 -1
  74. mlrun/datastore/s3.py +14 -3
  75. mlrun/datastore/sources.py +89 -92
  76. mlrun/datastore/store_resources.py +7 -4
  77. mlrun/datastore/storeytargets.py +51 -16
  78. mlrun/datastore/targets.py +38 -31
  79. mlrun/datastore/utils.py +87 -4
  80. mlrun/datastore/v3io.py +4 -1
  81. mlrun/datastore/vectorstore.py +291 -0
  82. mlrun/datastore/wasbfs/fs.py +13 -12
  83. mlrun/db/base.py +286 -100
  84. mlrun/db/httpdb.py +1562 -490
  85. mlrun/db/nopdb.py +250 -83
  86. mlrun/errors.py +6 -2
  87. mlrun/execution.py +194 -50
  88. mlrun/feature_store/__init__.py +2 -10
  89. mlrun/feature_store/api.py +20 -458
  90. mlrun/feature_store/common.py +9 -9
  91. mlrun/feature_store/feature_set.py +20 -18
  92. mlrun/feature_store/feature_vector.py +105 -479
  93. mlrun/feature_store/feature_vector_utils.py +466 -0
  94. mlrun/feature_store/retrieval/base.py +15 -11
  95. mlrun/feature_store/retrieval/job.py +2 -1
  96. mlrun/feature_store/retrieval/storey_merger.py +1 -1
  97. mlrun/feature_store/steps.py +3 -3
  98. mlrun/features.py +30 -13
  99. mlrun/frameworks/__init__.py +1 -2
  100. mlrun/frameworks/_common/__init__.py +1 -2
  101. mlrun/frameworks/_common/artifacts_library.py +2 -2
  102. mlrun/frameworks/_common/mlrun_interface.py +10 -6
  103. mlrun/frameworks/_common/model_handler.py +31 -31
  104. mlrun/frameworks/_common/producer.py +3 -1
  105. mlrun/frameworks/_dl_common/__init__.py +1 -2
  106. mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
  107. mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
  108. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
  109. mlrun/frameworks/_ml_common/__init__.py +1 -2
  110. mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
  111. mlrun/frameworks/_ml_common/model_handler.py +21 -21
  112. mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
  113. mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
  114. mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
  115. mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
  116. mlrun/frameworks/auto_mlrun/__init__.py +1 -2
  117. mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
  118. mlrun/frameworks/huggingface/__init__.py +1 -2
  119. mlrun/frameworks/huggingface/model_server.py +9 -9
  120. mlrun/frameworks/lgbm/__init__.py +47 -44
  121. mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
  122. mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
  123. mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
  124. mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
  125. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
  126. mlrun/frameworks/lgbm/model_handler.py +15 -11
  127. mlrun/frameworks/lgbm/model_server.py +11 -7
  128. mlrun/frameworks/lgbm/utils.py +2 -2
  129. mlrun/frameworks/onnx/__init__.py +1 -2
  130. mlrun/frameworks/onnx/dataset.py +3 -3
  131. mlrun/frameworks/onnx/mlrun_interface.py +2 -2
  132. mlrun/frameworks/onnx/model_handler.py +7 -5
  133. mlrun/frameworks/onnx/model_server.py +8 -6
  134. mlrun/frameworks/parallel_coordinates.py +11 -11
  135. mlrun/frameworks/pytorch/__init__.py +22 -23
  136. mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
  137. mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
  138. mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
  139. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
  140. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
  141. mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
  142. mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
  143. mlrun/frameworks/pytorch/model_handler.py +21 -17
  144. mlrun/frameworks/pytorch/model_server.py +13 -9
  145. mlrun/frameworks/sklearn/__init__.py +19 -18
  146. mlrun/frameworks/sklearn/estimator.py +2 -2
  147. mlrun/frameworks/sklearn/metric.py +3 -3
  148. mlrun/frameworks/sklearn/metrics_library.py +8 -6
  149. mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
  150. mlrun/frameworks/sklearn/model_handler.py +4 -3
  151. mlrun/frameworks/tf_keras/__init__.py +11 -12
  152. mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
  153. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
  154. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
  155. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
  156. mlrun/frameworks/tf_keras/model_handler.py +17 -13
  157. mlrun/frameworks/tf_keras/model_server.py +12 -8
  158. mlrun/frameworks/xgboost/__init__.py +19 -18
  159. mlrun/frameworks/xgboost/model_handler.py +13 -9
  160. mlrun/k8s_utils.py +2 -5
  161. mlrun/launcher/base.py +3 -4
  162. mlrun/launcher/client.py +2 -2
  163. mlrun/launcher/local.py +6 -2
  164. mlrun/launcher/remote.py +1 -1
  165. mlrun/lists.py +8 -4
  166. mlrun/model.py +132 -46
  167. mlrun/model_monitoring/__init__.py +3 -5
  168. mlrun/model_monitoring/api.py +113 -98
  169. mlrun/model_monitoring/applications/__init__.py +0 -5
  170. mlrun/model_monitoring/applications/_application_steps.py +81 -50
  171. mlrun/model_monitoring/applications/base.py +467 -14
  172. mlrun/model_monitoring/applications/context.py +212 -134
  173. mlrun/model_monitoring/{db/stores/base → applications/evidently}/__init__.py +6 -2
  174. mlrun/model_monitoring/applications/evidently/base.py +146 -0
  175. mlrun/model_monitoring/applications/histogram_data_drift.py +89 -56
  176. mlrun/model_monitoring/applications/results.py +67 -15
  177. mlrun/model_monitoring/controller.py +701 -315
  178. mlrun/model_monitoring/db/__init__.py +0 -2
  179. mlrun/model_monitoring/db/_schedules.py +242 -0
  180. mlrun/model_monitoring/db/_stats.py +189 -0
  181. mlrun/model_monitoring/db/tsdb/__init__.py +33 -22
  182. mlrun/model_monitoring/db/tsdb/base.py +243 -49
  183. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +76 -36
  184. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
  185. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +213 -0
  186. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +534 -88
  187. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
  188. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +436 -106
  189. mlrun/model_monitoring/helpers.py +356 -114
  190. mlrun/model_monitoring/stream_processing.py +190 -345
  191. mlrun/model_monitoring/tracking_policy.py +11 -4
  192. mlrun/model_monitoring/writer.py +49 -90
  193. mlrun/package/__init__.py +3 -6
  194. mlrun/package/context_handler.py +2 -2
  195. mlrun/package/packager.py +12 -9
  196. mlrun/package/packagers/__init__.py +0 -2
  197. mlrun/package/packagers/default_packager.py +14 -11
  198. mlrun/package/packagers/numpy_packagers.py +16 -7
  199. mlrun/package/packagers/pandas_packagers.py +18 -18
  200. mlrun/package/packagers/python_standard_library_packagers.py +25 -11
  201. mlrun/package/packagers_manager.py +35 -32
  202. mlrun/package/utils/__init__.py +0 -3
  203. mlrun/package/utils/_pickler.py +6 -6
  204. mlrun/platforms/__init__.py +47 -16
  205. mlrun/platforms/iguazio.py +4 -1
  206. mlrun/projects/operations.py +30 -30
  207. mlrun/projects/pipelines.py +116 -47
  208. mlrun/projects/project.py +1292 -329
  209. mlrun/render.py +5 -9
  210. mlrun/run.py +57 -14
  211. mlrun/runtimes/__init__.py +1 -3
  212. mlrun/runtimes/base.py +30 -22
  213. mlrun/runtimes/daskjob.py +9 -9
  214. mlrun/runtimes/databricks_job/databricks_runtime.py +6 -5
  215. mlrun/runtimes/function_reference.py +5 -2
  216. mlrun/runtimes/generators.py +3 -2
  217. mlrun/runtimes/kubejob.py +6 -7
  218. mlrun/runtimes/mounts.py +574 -0
  219. mlrun/runtimes/mpijob/__init__.py +0 -2
  220. mlrun/runtimes/mpijob/abstract.py +7 -6
  221. mlrun/runtimes/nuclio/api_gateway.py +7 -7
  222. mlrun/runtimes/nuclio/application/application.py +11 -13
  223. mlrun/runtimes/nuclio/application/reverse_proxy.go +66 -64
  224. mlrun/runtimes/nuclio/function.py +127 -70
  225. mlrun/runtimes/nuclio/serving.py +105 -37
  226. mlrun/runtimes/pod.py +159 -54
  227. mlrun/runtimes/remotesparkjob.py +3 -2
  228. mlrun/runtimes/sparkjob/__init__.py +0 -2
  229. mlrun/runtimes/sparkjob/spark3job.py +22 -12
  230. mlrun/runtimes/utils.py +7 -6
  231. mlrun/secrets.py +2 -2
  232. mlrun/serving/__init__.py +8 -0
  233. mlrun/serving/merger.py +7 -5
  234. mlrun/serving/remote.py +35 -22
  235. mlrun/serving/routers.py +186 -240
  236. mlrun/serving/server.py +41 -10
  237. mlrun/serving/states.py +432 -118
  238. mlrun/serving/utils.py +13 -2
  239. mlrun/serving/v1_serving.py +3 -2
  240. mlrun/serving/v2_serving.py +161 -203
  241. mlrun/track/__init__.py +1 -1
  242. mlrun/track/tracker.py +2 -2
  243. mlrun/track/trackers/mlflow_tracker.py +6 -5
  244. mlrun/utils/async_http.py +35 -22
  245. mlrun/utils/clones.py +7 -4
  246. mlrun/utils/helpers.py +511 -58
  247. mlrun/utils/logger.py +119 -13
  248. mlrun/utils/notifications/notification/__init__.py +22 -19
  249. mlrun/utils/notifications/notification/base.py +39 -15
  250. mlrun/utils/notifications/notification/console.py +6 -6
  251. mlrun/utils/notifications/notification/git.py +11 -11
  252. mlrun/utils/notifications/notification/ipython.py +10 -9
  253. mlrun/utils/notifications/notification/mail.py +176 -0
  254. mlrun/utils/notifications/notification/slack.py +16 -8
  255. mlrun/utils/notifications/notification/webhook.py +24 -8
  256. mlrun/utils/notifications/notification_pusher.py +191 -200
  257. mlrun/utils/regex.py +12 -2
  258. mlrun/utils/version/version.json +2 -2
  259. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/METADATA +69 -54
  260. mlrun-1.8.0.dist-info/RECORD +351 -0
  261. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/WHEEL +1 -1
  262. mlrun/model_monitoring/applications/evidently_base.py +0 -137
  263. mlrun/model_monitoring/db/stores/__init__.py +0 -136
  264. mlrun/model_monitoring/db/stores/base/store.py +0 -213
  265. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -71
  266. mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -190
  267. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +0 -103
  268. mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -40
  269. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +0 -659
  270. mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +0 -726
  271. mlrun/model_monitoring/model_endpoint.py +0 -118
  272. mlrun-1.7.2rc4.dist-info/RECORD +0 -351
  273. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/entry_points.txt +0 -0
  274. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info/licenses}/LICENSE +0 -0
  275. {mlrun-1.7.2rc4.dist-info → mlrun-1.8.0.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@
14
14
  #
15
15
  import typing
16
16
 
17
- import pydantic
17
+ import pydantic.v1
18
18
 
19
19
  import mlrun.common.types
20
20
 
@@ -90,42 +90,42 @@ class SecurityContextEnrichmentModes(mlrun.common.types.StrEnum):
90
90
  disabled = "disabled"
91
91
 
92
92
 
93
- class ImagePullSecret(pydantic.BaseModel):
93
+ class ImagePullSecret(pydantic.v1.BaseModel):
94
94
  default: typing.Optional[str]
95
95
 
96
96
 
97
- class Pipelines(pydantic.BaseModel):
97
+ class Pipelines(pydantic.v1.BaseModel):
98
98
  kfp_pod_user_unix_id: typing.Optional[int]
99
99
 
100
100
 
101
- class SecurityContext(pydantic.BaseModel):
101
+ class SecurityContext(pydantic.v1.BaseModel):
102
102
  default: typing.Optional[str]
103
103
  enrichment_mode: typing.Optional[SecurityContextEnrichmentModes]
104
104
  enrichment_group_id: typing.Optional[int]
105
105
  pipelines: typing.Optional[Pipelines]
106
106
 
107
107
 
108
- class ServiceAccount(pydantic.BaseModel):
108
+ class ServiceAccount(pydantic.v1.BaseModel):
109
109
  default: typing.Optional[str]
110
110
 
111
111
 
112
- class StateThresholds(pydantic.BaseModel):
112
+ class StateThresholds(pydantic.v1.BaseModel):
113
113
  default: typing.Optional[dict[str, str]]
114
114
 
115
115
 
116
- class FunctionSpec(pydantic.BaseModel):
116
+ class FunctionSpec(pydantic.v1.BaseModel):
117
117
  image_pull_secret: typing.Optional[ImagePullSecret]
118
118
  security_context: typing.Optional[SecurityContext]
119
119
  service_account: typing.Optional[ServiceAccount]
120
120
  state_thresholds: typing.Optional[StateThresholds]
121
121
 
122
122
  class Config:
123
- extra = pydantic.Extra.allow
123
+ extra = pydantic.v1.Extra.allow
124
124
 
125
125
 
126
- class Function(pydantic.BaseModel):
126
+ class Function(pydantic.v1.BaseModel):
127
127
  spec: typing.Optional[FunctionSpec]
128
128
  application: typing.Optional[dict[str, typing.Any]]
129
129
 
130
130
  class Config:
131
- extra = pydantic.Extra.allow
131
+ extra = pydantic.v1.Extra.allow
@@ -15,7 +15,7 @@
15
15
  from datetime import datetime, timezone
16
16
  from typing import Optional
17
17
 
18
- from pydantic import BaseModel, Extra, Field
18
+ from pydantic.v1 import BaseModel, Extra, Field
19
19
 
20
20
  import mlrun.common.types
21
21
  import mlrun.config
@@ -14,18 +14,18 @@
14
14
  #
15
15
  import typing
16
16
 
17
- import pydantic
17
+ import pydantic.v1
18
18
 
19
19
  import mlrun.common.types
20
20
 
21
21
 
22
- class ResourceSpec(pydantic.BaseModel):
22
+ class ResourceSpec(pydantic.v1.BaseModel):
23
23
  cpu: typing.Optional[str]
24
24
  memory: typing.Optional[str]
25
25
  gpu: typing.Optional[str]
26
26
 
27
27
 
28
- class Resources(pydantic.BaseModel):
28
+ class Resources(pydantic.v1.BaseModel):
29
29
  requests: ResourceSpec = ResourceSpec()
30
30
  limits: ResourceSpec = ResourceSpec()
31
31
 
@@ -15,14 +15,14 @@
15
15
 
16
16
  import typing
17
17
 
18
- import pydantic
18
+ import pydantic.v1
19
19
 
20
20
 
21
- class MostCommonObjectTypesReport(pydantic.BaseModel):
21
+ class MostCommonObjectTypesReport(pydantic.v1.BaseModel):
22
22
  object_types: list[tuple[str, int]]
23
23
 
24
24
 
25
- class ObjectTypeReport(pydantic.BaseModel):
25
+ class ObjectTypeReport(pydantic.v1.BaseModel):
26
26
  object_type: str
27
27
  sample_size: int
28
28
  start_index: typing.Optional[int]
@@ -13,8 +13,8 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from .constants import (
16
- V3IO_MODEL_MONITORING_DB,
17
- ControllerPolicy,
16
+ INTERSECT_DICT_KEYS,
17
+ ApplicationEvent,
18
18
  DriftStatus,
19
19
  EndpointType,
20
20
  EndpointUID,
@@ -25,18 +25,16 @@ from .constants import (
25
25
  FileTargetKind,
26
26
  FunctionURI,
27
27
  MetricData,
28
+ ModelEndpointCreationStrategy,
28
29
  ModelEndpointMonitoringMetricType,
29
- ModelEndpointTarget,
30
- ModelEndpointTargetSchemas,
30
+ ModelEndpointSchema,
31
31
  ModelMonitoringMode,
32
- ModelMonitoringStoreKinds,
33
32
  MonitoringFunctionNames,
34
33
  PredictionsQueryConstants,
35
34
  ProjectSecretKeys,
36
35
  ResultData,
37
36
  ResultKindApp,
38
37
  ResultStatusApp,
39
- SchedulingKeys,
40
38
  SpecialApps,
41
39
  TDEngineSuperTables,
42
40
  TSDBTarget,
@@ -48,11 +46,9 @@ from .constants import (
48
46
  from .grafana import (
49
47
  GrafanaColumn,
50
48
  GrafanaColumnType,
51
- GrafanaDataPoint,
52
49
  GrafanaNumberColumn,
53
50
  GrafanaStringColumn,
54
51
  GrafanaTable,
55
- GrafanaTimeSeriesTarget,
56
52
  )
57
53
  from .model_endpoints import (
58
54
  Features,
@@ -29,6 +29,54 @@ class MonitoringStrEnum(StrEnum):
29
29
  return list(map(lambda c: c.value, cls))
30
30
 
31
31
 
32
+ class ModelEndpointSchema(MonitoringStrEnum):
33
+ # metadata
34
+ UID = "uid"
35
+ PROJECT = "project"
36
+ ENDPOINT_TYPE = "endpoint_type"
37
+ NAME = "name"
38
+ CREATED = "created"
39
+ UPDATED = "updated"
40
+ LABELS = "labels"
41
+
42
+ # spec
43
+ FUNCTION_NAME = "function_name"
44
+ FUNCTION_TAG = "function_tag"
45
+ MODEL_NAME = "model_name"
46
+ MODEL_TAGS = "model_tags"
47
+ MODEL_PATH = "model_path"
48
+ MODEL_CLASS = "model_class"
49
+ FEATURE_NAMES = "feature_names"
50
+ LABEL_NAMES = "label_names"
51
+ FEATURE_STATS = "feature_stats"
52
+ MONITORING_FEATURE_SET_URI = "monitoring_feature_set_uri"
53
+ CHILDREN = "children"
54
+ CHILDREN_UIDS = "children_uids"
55
+ FUNCTION_URI = "function_uri"
56
+ MODEL_URI = "model_uri"
57
+
58
+ # status
59
+ STATE = "state"
60
+ MONITORING_MODE = "monitoring_mode"
61
+ FIRST_REQUEST = "first_request"
62
+ SAMPLING_PERCENTAGE = "sampling_percentage"
63
+
64
+ # status - operative
65
+ LAST_REQUEST = "last_request"
66
+ RESULT_STATUS = "result_status"
67
+ AVG_LATENCY = "avg_latency"
68
+ ERROR_COUNT = "error_count"
69
+ CURRENT_STATS = "current_stats"
70
+ DRIFT_MEASURES = "drift_measures"
71
+
72
+
73
+ class ModelEndpointCreationStrategy(MonitoringStrEnum):
74
+ INPLACE = "inplace"
75
+ ARCHIVE = "archive"
76
+ OVERWRITE = "overwrite"
77
+ SKIP = "skip"
78
+
79
+
32
80
  class EventFieldType:
33
81
  FUNCTION_URI = "function_uri"
34
82
  FUNCTION = "function"
@@ -40,6 +88,7 @@ class EventFieldType:
40
88
  TIMESTAMP = "timestamp"
41
89
  # `endpoint_id` is deprecated as a field in the model endpoint schema since 1.3.1, replaced by `uid`.
42
90
  ENDPOINT_ID = "endpoint_id"
91
+ ENDPOINT_NAME = "endpoint_name"
43
92
  UID = "uid"
44
93
  ENDPOINT_TYPE = "endpoint_type"
45
94
  REQUEST_ID = "request_id"
@@ -55,6 +104,8 @@ class EventFieldType:
55
104
  NAMED_PREDICTIONS = "named_predictions"
56
105
  ERROR_COUNT = "error_count"
57
106
  MODEL_ERROR = "model_error"
107
+ ERROR_TYPE = "error_type"
108
+ INFER_ERROR = "infer_error"
58
109
  ENTITIES = "entities"
59
110
  FIRST_REQUEST = "first_request"
60
111
  LAST_REQUEST = "last_request"
@@ -85,11 +136,14 @@ class EventFieldType:
85
136
  SAMPLE_PARQUET_PATH = "sample_parquet_path"
86
137
  TIME = "time"
87
138
  TABLE_COLUMN = "table_column"
139
+ SAMPLING_PERCENTAGE = "sampling_percentage"
140
+ SAMPLING_RATE = "sampling_rate"
141
+ ESTIMATED_PREDICTION_COUNT = "estimated_prediction_count"
142
+ EFFECTIVE_SAMPLE_COUNT = "effective_sample_count"
88
143
 
89
144
 
90
145
  class FeatureSetFeatures(MonitoringStrEnum):
91
146
  LATENCY = EventFieldType.LATENCY
92
- ERROR_COUNT = EventFieldType.ERROR_COUNT
93
147
  METRICS = EventFieldType.METRICS
94
148
 
95
149
  @classmethod
@@ -106,21 +160,49 @@ class ApplicationEvent:
106
160
  START_INFER_TIME = "start_infer_time"
107
161
  END_INFER_TIME = "end_infer_time"
108
162
  ENDPOINT_ID = "endpoint_id"
109
- OUTPUT_STREAM_URI = "output_stream_uri"
163
+ ENDPOINT_NAME = "endpoint_name"
164
+ ENDPOINT_UPDATED = "endpoint_updated"
110
165
 
111
166
 
112
167
  class WriterEvent(MonitoringStrEnum):
168
+ ENDPOINT_NAME = "endpoint_name"
113
169
  APPLICATION_NAME = "application_name"
114
170
  ENDPOINT_ID = "endpoint_id"
115
171
  START_INFER_TIME = "start_infer_time"
116
172
  END_INFER_TIME = "end_infer_time"
117
- EVENT_KIND = "event_kind" # metric or result
173
+ EVENT_KIND = "event_kind" # metric or result or stats
118
174
  DATA = "data"
119
175
 
120
176
 
121
177
  class WriterEventKind(MonitoringStrEnum):
122
178
  METRIC = "metric"
123
179
  RESULT = "result"
180
+ STATS = "stats"
181
+
182
+
183
+ class ControllerEvent(MonitoringStrEnum):
184
+ KIND = "kind"
185
+ ENDPOINT_ID = "endpoint_id"
186
+ ENDPOINT_NAME = "endpoint_name"
187
+ PROJECT = "project"
188
+ TIMESTAMP = "timestamp"
189
+ FIRST_REQUEST = "first_request"
190
+ FEATURE_SET_URI = "feature_set_uri"
191
+ ENDPOINT_TYPE = "endpoint_type"
192
+ ENDPOINT_POLICY = "endpoint_policy"
193
+ # Note: currently under endpoint policy we will have a dictionary including the keys: "application_names"
194
+ # "base_period", and "updated_endpoint" stand for when the MEP was updated
195
+
196
+
197
+ class ControllerEventEndpointPolicy(MonitoringStrEnum):
198
+ BASE_PERIOD = "base_period"
199
+ MONITORING_APPLICATIONS = "monitoring_applications"
200
+ ENDPOINT_UPDATED = "endpoint_updated"
201
+
202
+
203
+ class ControllerEventKind(MonitoringStrEnum):
204
+ NOP_EVENT = "nop_event"
205
+ REGULAR_EVENT = "regular_event"
124
206
 
125
207
 
126
208
  class MetricData(MonitoringStrEnum):
@@ -134,7 +216,17 @@ class ResultData(MonitoringStrEnum):
134
216
  RESULT_KIND = "result_kind"
135
217
  RESULT_STATUS = "result_status"
136
218
  RESULT_EXTRA_DATA = "result_extra_data"
219
+
220
+
221
+ class StatsData(MonitoringStrEnum):
222
+ STATS_NAME = "stats_name"
223
+ STATS = "stats"
224
+ TIMESTAMP = "timestamp"
225
+
226
+
227
+ class StatsKind(MonitoringStrEnum):
137
228
  CURRENT_STATS = "current_stats"
229
+ DRIFT_MEASURES = "drift_measures"
138
230
 
139
231
 
140
232
  class EventLiveStats:
@@ -153,52 +245,28 @@ class EventKeyMetrics:
153
245
  REAL_TIME = "real_time"
154
246
 
155
247
 
156
- class ModelEndpointTarget(MonitoringStrEnum):
157
- V3IO_NOSQL = "v3io-nosql"
158
- SQL = "sql"
159
-
160
-
161
- class StreamKind(MonitoringStrEnum):
162
- V3IO_STREAM = "v3io_stream"
163
- KAFKA = "kafka"
164
-
165
-
166
248
  class TSDBTarget(MonitoringStrEnum):
167
249
  V3IO_TSDB = "v3io-tsdb"
168
250
  TDEngine = "tdengine"
169
251
 
170
252
 
171
253
  class ProjectSecretKeys:
172
- ENDPOINT_STORE_CONNECTION = "MODEL_MONITORING_ENDPOINT_STORE_CONNECTION"
173
254
  ACCESS_KEY = "MODEL_MONITORING_ACCESS_KEY"
174
- STREAM_PATH = "STREAM_PATH"
175
- TSDB_CONNECTION = "TSDB_CONNECTION"
255
+ TSDB_PROFILE_NAME = "TSDB_PROFILE_NAME"
256
+ STREAM_PROFILE_NAME = "STREAM_PROFILE_NAME"
176
257
 
177
258
  @classmethod
178
259
  def mandatory_secrets(cls):
179
260
  return [
180
- cls.ENDPOINT_STORE_CONNECTION,
181
- cls.STREAM_PATH,
182
- cls.TSDB_CONNECTION,
261
+ cls.STREAM_PROFILE_NAME,
262
+ cls.TSDB_PROFILE_NAME,
183
263
  ]
184
264
 
185
265
 
186
- class ModelEndpointTargetSchemas(MonitoringStrEnum):
187
- V3IO = "v3io"
188
- MYSQL = "mysql"
189
- SQLITE = "sqlite"
190
-
191
-
192
- class ModelMonitoringStoreKinds:
193
- ENDPOINTS = "endpoints"
194
- EVENTS = "events"
195
-
196
-
197
- class SchedulingKeys:
198
- LAST_ANALYZED = "last_analyzed"
199
- ENDPOINT_ID = "endpoint_id"
200
- APPLICATION_NAME = "application_name"
201
- UID = "uid"
266
+ class GetEventsFormat(MonitoringStrEnum):
267
+ SINGLE = "single"
268
+ SEPARATION = "separation"
269
+ INTERSECTION = "intersection"
202
270
 
203
271
 
204
272
  class FileTargetKind:
@@ -209,22 +277,32 @@ class FileTargetKind:
209
277
  PARQUET = "parquet"
210
278
  APPS_PARQUET = "apps_parquet"
211
279
  LOG_STREAM = "log_stream"
212
- APP_RESULTS = "app_results"
213
- APP_METRICS = "app_metrics"
214
280
  MONITORING_SCHEDULES = "monitoring_schedules"
215
281
  MONITORING_APPLICATION = "monitoring_application"
216
282
  ERRORS = "errors"
283
+ STATS = "stats"
284
+ LAST_REQUEST = "last_request"
217
285
 
218
286
 
219
- class ModelMonitoringMode(str, Enum):
287
+ class ModelMonitoringMode(StrEnum):
220
288
  enabled = "enabled"
221
289
  disabled = "disabled"
222
290
 
223
291
 
292
+ class ScheduleChiefFields(StrEnum):
293
+ LAST_REQUEST = "last_request"
294
+ LAST_ANALYZED = "last_analyzed"
295
+
296
+
224
297
  class EndpointType(IntEnum):
225
298
  NODE_EP = 1 # end point that is not a child of a router
226
299
  ROUTER = 2 # endpoint that is router
227
300
  LEAF_EP = 3 # end point that is a child of a router
301
+ BATCH_EP = 4 # endpoint that is representing an offline batch endpoint
302
+
303
+ @classmethod
304
+ def top_level_list(cls):
305
+ return [cls.NODE_EP, cls.ROUTER, cls.BATCH_EP]
228
306
 
229
307
 
230
308
  class MonitoringFunctionNames(MonitoringStrEnum):
@@ -238,12 +316,14 @@ class V3IOTSDBTables(MonitoringStrEnum):
238
316
  METRICS = "metrics"
239
317
  EVENTS = "events"
240
318
  ERRORS = "errors"
319
+ PREDICTIONS = "predictions"
241
320
 
242
321
 
243
322
  class TDEngineSuperTables(MonitoringStrEnum):
244
323
  APP_RESULTS = "app_results"
245
324
  METRICS = "metrics"
246
325
  PREDICTIONS = "predictions"
326
+ ERRORS = "errors"
247
327
 
248
328
 
249
329
  @dataclass
@@ -344,10 +424,6 @@ class ModelMonitoringAppLabel:
344
424
  return f"{self.KEY}={self.VAL}"
345
425
 
346
426
 
347
- class ControllerPolicy:
348
- BASE_PERIOD = "base_period"
349
-
350
-
351
427
  class HistogramDataDriftApplicationConstants:
352
428
  NAME = "histogram-data-drift"
353
429
  GENERAL_RESULT_NAME = "general_drift"
@@ -365,9 +441,6 @@ class SpecialApps:
365
441
  _RESERVED_FUNCTION_NAMES = MonitoringFunctionNames.list() + [SpecialApps.MLRUN_INFRA]
366
442
 
367
443
 
368
- V3IO_MODEL_MONITORING_DB = "v3io"
369
-
370
-
371
444
  class ModelEndpointMonitoringMetricType(StrEnum):
372
445
  RESULT = "result"
373
446
  METRIC = "metric"
@@ -384,5 +457,13 @@ FQN_REGEX = re.compile(FQN_PATTERN)
384
457
 
385
458
  # refer to `mlrun.utils.regex.project_name`
386
459
  PROJECT_PATTERN = r"^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
387
-
388
460
  MODEL_ENDPOINT_ID_PATTERN = r"^[a-zA-Z0-9_-]+$"
461
+ RESULT_NAME_PATTERN = r"[a-zA-Z_][a-zA-Z0-9_]*"
462
+
463
+ INTERSECT_DICT_KEYS = {
464
+ ModelEndpointMonitoringMetricType.METRIC: "intersect_metrics",
465
+ ModelEndpointMonitoringMetricType.RESULT: "intersect_results",
466
+ }
467
+
468
+ CRON_TRIGGER_KINDS = ("http", "cron")
469
+ STREAM_TRIGGER_KINDS = ("v3io-stream", "kafka-cluster")
@@ -14,7 +14,7 @@
14
14
 
15
15
  from typing import Optional, Union
16
16
 
17
- from pydantic import BaseModel
17
+ from pydantic.v1 import BaseModel
18
18
 
19
19
  import mlrun.common.types
20
20
 
@@ -46,14 +46,20 @@ class GrafanaTable(BaseModel):
46
46
  self.rows.append(list(args))
47
47
 
48
48
 
49
- class GrafanaDataPoint(BaseModel):
50
- value: float
51
- timestamp: int # Unix timestamp in milliseconds
52
-
53
-
54
- class GrafanaTimeSeriesTarget(BaseModel):
55
- target: str
56
- datapoints: list[tuple[float, int]] = []
57
-
58
- def add_data_point(self, data_point: GrafanaDataPoint):
59
- self.datapoints.append((data_point.value, data_point.timestamp))
49
+ class GrafanaModelEndpointsTable(GrafanaTable):
50
+ def __init__(self):
51
+ columns = self._init_columns()
52
+ super().__init__(columns=columns)
53
+
54
+ @staticmethod
55
+ def _init_columns():
56
+ return [
57
+ GrafanaColumn(text="endpoint_id", type=GrafanaColumnType.STRING),
58
+ GrafanaColumn(text="endpoint_name", type=GrafanaColumnType.STRING),
59
+ GrafanaColumn(text="endpoint_function", type=GrafanaColumnType.STRING),
60
+ GrafanaColumn(text="endpoint_model", type=GrafanaColumnType.STRING),
61
+ GrafanaColumn(text="endpoint_model_class", type=GrafanaColumnType.STRING),
62
+ GrafanaColumn(text="error_count", type=GrafanaColumnType.NUMBER),
63
+ GrafanaColumn(text="drift_status", type=GrafanaColumnType.NUMBER),
64
+ GrafanaColumn(text="sampling_percentage", type=GrafanaColumnType.NUMBER),
65
+ ]