mlrun 1.7.0rc5__py3-none-any.whl → 1.7.0rc7__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 (75) hide show
  1. mlrun/artifacts/base.py +2 -1
  2. mlrun/artifacts/plots.py +9 -5
  3. mlrun/common/constants.py +6 -0
  4. mlrun/common/schemas/__init__.py +2 -0
  5. mlrun/common/schemas/model_monitoring/__init__.py +4 -0
  6. mlrun/common/schemas/model_monitoring/constants.py +35 -18
  7. mlrun/common/schemas/project.py +1 -0
  8. mlrun/common/types.py +7 -1
  9. mlrun/config.py +19 -6
  10. mlrun/data_types/data_types.py +4 -0
  11. mlrun/datastore/alibaba_oss.py +130 -0
  12. mlrun/datastore/azure_blob.py +4 -5
  13. mlrun/datastore/base.py +22 -16
  14. mlrun/datastore/datastore.py +4 -0
  15. mlrun/datastore/google_cloud_storage.py +1 -1
  16. mlrun/datastore/sources.py +7 -7
  17. mlrun/db/base.py +14 -6
  18. mlrun/db/factory.py +1 -1
  19. mlrun/db/httpdb.py +61 -56
  20. mlrun/db/nopdb.py +3 -0
  21. mlrun/launcher/__init__.py +1 -1
  22. mlrun/launcher/base.py +1 -1
  23. mlrun/launcher/client.py +1 -1
  24. mlrun/launcher/factory.py +1 -1
  25. mlrun/launcher/local.py +1 -1
  26. mlrun/launcher/remote.py +1 -1
  27. mlrun/model.py +1 -0
  28. mlrun/model_monitoring/__init__.py +1 -1
  29. mlrun/model_monitoring/api.py +104 -301
  30. mlrun/model_monitoring/application.py +21 -21
  31. mlrun/model_monitoring/applications/histogram_data_drift.py +130 -40
  32. mlrun/model_monitoring/controller.py +26 -33
  33. mlrun/model_monitoring/db/__init__.py +16 -0
  34. mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -34
  35. mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
  36. mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +47 -6
  37. mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
  38. mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +49 -0
  39. mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +76 -3
  40. mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +68 -0
  41. mlrun/model_monitoring/{stores → db/stores/sqldb}/models/sqlite.py +13 -1
  42. mlrun/model_monitoring/db/stores/sqldb/sql_store.py +662 -0
  43. mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
  44. mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +134 -3
  45. mlrun/model_monitoring/features_drift_table.py +34 -22
  46. mlrun/model_monitoring/helpers.py +45 -6
  47. mlrun/model_monitoring/stream_processing.py +43 -9
  48. mlrun/model_monitoring/tracking_policy.py +7 -1
  49. mlrun/model_monitoring/writer.py +4 -36
  50. mlrun/projects/pipelines.py +13 -1
  51. mlrun/projects/project.py +279 -117
  52. mlrun/run.py +72 -74
  53. mlrun/runtimes/__init__.py +35 -0
  54. mlrun/runtimes/base.py +7 -1
  55. mlrun/runtimes/nuclio/api_gateway.py +188 -61
  56. mlrun/runtimes/nuclio/application/__init__.py +15 -0
  57. mlrun/runtimes/nuclio/application/application.py +283 -0
  58. mlrun/runtimes/nuclio/application/reverse_proxy.go +87 -0
  59. mlrun/runtimes/nuclio/function.py +53 -1
  60. mlrun/runtimes/nuclio/serving.py +28 -32
  61. mlrun/runtimes/pod.py +27 -1
  62. mlrun/serving/server.py +4 -6
  63. mlrun/serving/states.py +41 -33
  64. mlrun/utils/helpers.py +34 -0
  65. mlrun/utils/version/version.json +2 -2
  66. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/METADATA +14 -5
  67. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/RECORD +71 -64
  68. mlrun/model_monitoring/batch.py +0 -974
  69. mlrun/model_monitoring/stores/models/__init__.py +0 -27
  70. mlrun/model_monitoring/stores/models/mysql.py +0 -34
  71. mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
  72. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/LICENSE +0 -0
  73. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/WHEEL +0 -0
  74. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/entry_points.txt +0 -0
  75. {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,49 @@
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
+ from typing import Optional, Union
16
+
17
+ from .mysql import ApplicationResultTable as MySQLApplicationResultTable
18
+ from .mysql import ModelEndpointsTable as MySQLModelEndpointsTable
19
+ from .mysql import MonitoringSchedulesTable as MySQLMonitoringSchedulesTable
20
+ from .sqlite import ApplicationResultTable as SQLiteApplicationResultTable
21
+ from .sqlite import ModelEndpointsTable as SQLiteModelEndpointsTable
22
+ from .sqlite import MonitoringSchedulesTable as SQLiteMonitoringSchedulesTable
23
+
24
+
25
+ def _get_model_endpoints_table(
26
+ connection_string: Optional[str] = None,
27
+ ) -> Union[type[MySQLModelEndpointsTable], type[SQLiteModelEndpointsTable]]:
28
+ """Return ModelEndpointsTable based on the provided connection string"""
29
+ if connection_string and "mysql:" in connection_string:
30
+ return MySQLModelEndpointsTable
31
+ return SQLiteModelEndpointsTable
32
+
33
+
34
+ def _get_application_result_table(
35
+ connection_string: Optional[str] = None,
36
+ ) -> Union[type[MySQLApplicationResultTable], type[SQLiteApplicationResultTable]]:
37
+ """Return ModelEndpointsTable based on the provided connection string"""
38
+ if connection_string and "mysql:" in connection_string:
39
+ return MySQLApplicationResultTable
40
+ return SQLiteApplicationResultTable
41
+
42
+
43
+ def _get_monitoring_schedules_table(
44
+ connection_string: Optional[str] = None,
45
+ ) -> Union[type[MySQLMonitoringSchedulesTable], type[SQLiteMonitoringSchedulesTable]]:
46
+ """Return ModelEndpointsTable based on the provided connection string"""
47
+ if connection_string and "mysql:" in connection_string:
48
+ return MySQLMonitoringSchedulesTable
49
+ return SQLiteMonitoringSchedulesTable
@@ -11,10 +11,22 @@
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
+ SchedulingKeys,
28
+ WriterEvent,
29
+ )
18
30
  from mlrun.utils.db import BaseModel
19
31
 
20
32
 
@@ -82,3 +94,64 @@ class ModelEndpointsBaseTable(BaseModel):
82
94
  EventFieldType.LAST_REQUEST,
83
95
  TIMESTAMP,
84
96
  )
97
+
98
+
99
+ class ApplicationResultBaseTable(BaseModel):
100
+ __tablename__ = FileTargetKind.APP_RESULTS
101
+
102
+ uid = Column(EventFieldType.UID, String(120), primary_key=True)
103
+
104
+ application_name = Column(
105
+ WriterEvent.APPLICATION_NAME,
106
+ String(40),
107
+ nullable=True,
108
+ )
109
+
110
+ endpoint_id = Column(
111
+ WriterEvent.ENDPOINT_ID,
112
+ String(40),
113
+ nullable=True,
114
+ )
115
+
116
+ result_name = Column(
117
+ WriterEvent.RESULT_NAME,
118
+ String(40),
119
+ )
120
+
121
+ start_infer_time = Column(
122
+ WriterEvent.START_INFER_TIME,
123
+ TIMESTAMP(timezone=True),
124
+ )
125
+ end_infer_time = Column(
126
+ WriterEvent.END_INFER_TIME,
127
+ TIMESTAMP(timezone=True),
128
+ )
129
+
130
+ result_status = Column(WriterEvent.RESULT_STATUS, String(10))
131
+ result_kind = Column(WriterEvent.RESULT_KIND, String(40))
132
+ result_value = Column(WriterEvent.RESULT_VALUE, Float)
133
+ result_extra_data = Column(WriterEvent.RESULT_EXTRA_DATA, Text)
134
+ current_stats = Column(WriterEvent.CURRENT_STATS, Text)
135
+
136
+
137
+ class MonitoringSchedulesBaseTable(BaseModel):
138
+ __tablename__ = FileTargetKind.MONITORING_SCHEDULES
139
+
140
+ uid = Column(SchedulingKeys.UID, String(32), primary_key=True)
141
+
142
+ application_name = Column(
143
+ SchedulingKeys.APPLICATION_NAME,
144
+ String(40),
145
+ nullable=False,
146
+ )
147
+
148
+ endpoint_id = Column(
149
+ SchedulingKeys.ENDPOINT_ID,
150
+ String(40),
151
+ nullable=False,
152
+ )
153
+
154
+ last_analyzed = Column(
155
+ SchedulingKeys.LAST_ANALYZED,
156
+ Integer,
157
+ )
@@ -0,0 +1,68 @@
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
+ ApplicationResultBaseTable,
26
+ ModelEndpointsBaseTable,
27
+ MonitoringSchedulesBaseTable,
28
+ )
29
+
30
+ Base = declarative_base()
31
+
32
+
33
+ class ModelEndpointsTable(Base, ModelEndpointsBaseTable):
34
+ first_request = Column(
35
+ EventFieldType.FIRST_REQUEST,
36
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
37
+ )
38
+ last_request = Column(
39
+ EventFieldType.LAST_REQUEST,
40
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
41
+ )
42
+
43
+
44
+ class ApplicationResultTable(Base, ApplicationResultBaseTable):
45
+ start_infer_time = Column(
46
+ WriterEvent.START_INFER_TIME,
47
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
48
+ )
49
+ end_infer_time = Column(
50
+ WriterEvent.END_INFER_TIME,
51
+ sqlalchemy.dialects.mysql.TIMESTAMP(fsp=3),
52
+ )
53
+
54
+ @declared_attr
55
+ def endpoint_id(cls):
56
+ return Column(
57
+ String(40),
58
+ ForeignKey(f"{EventFieldType.MODEL_ENDPOINTS}.{EventFieldType.UID}"),
59
+ )
60
+
61
+
62
+ class MonitoringSchedulesTable(Base, MonitoringSchedulesBaseTable):
63
+ @declared_attr
64
+ def endpoint_id(cls):
65
+ return Column(
66
+ String(40),
67
+ ForeignKey(f"{EventFieldType.MODEL_ENDPOINTS}.{EventFieldType.UID}"),
68
+ )
@@ -14,10 +14,22 @@
14
14
 
15
15
  from sqlalchemy.ext.declarative import declarative_base
16
16
 
17
- from .base import ModelEndpointsBaseTable
17
+ from .base import (
18
+ ApplicationResultBaseTable,
19
+ ModelEndpointsBaseTable,
20
+ MonitoringSchedulesBaseTable,
21
+ )
18
22
 
19
23
  Base = declarative_base()
20
24
 
21
25
 
22
26
  class ModelEndpointsTable(Base, ModelEndpointsBaseTable):
23
27
  pass
28
+
29
+
30
+ class ApplicationResultTable(Base, ApplicationResultBaseTable):
31
+ pass
32
+
33
+
34
+ class MonitoringSchedulesTable(Base, MonitoringSchedulesBaseTable):
35
+ pass