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.
- mlrun/artifacts/base.py +2 -1
- mlrun/artifacts/plots.py +9 -5
- mlrun/common/constants.py +6 -0
- mlrun/common/schemas/__init__.py +2 -0
- mlrun/common/schemas/model_monitoring/__init__.py +4 -0
- mlrun/common/schemas/model_monitoring/constants.py +35 -18
- mlrun/common/schemas/project.py +1 -0
- mlrun/common/types.py +7 -1
- mlrun/config.py +19 -6
- mlrun/data_types/data_types.py +4 -0
- mlrun/datastore/alibaba_oss.py +130 -0
- mlrun/datastore/azure_blob.py +4 -5
- mlrun/datastore/base.py +22 -16
- mlrun/datastore/datastore.py +4 -0
- mlrun/datastore/google_cloud_storage.py +1 -1
- mlrun/datastore/sources.py +7 -7
- mlrun/db/base.py +14 -6
- mlrun/db/factory.py +1 -1
- mlrun/db/httpdb.py +61 -56
- mlrun/db/nopdb.py +3 -0
- mlrun/launcher/__init__.py +1 -1
- mlrun/launcher/base.py +1 -1
- mlrun/launcher/client.py +1 -1
- mlrun/launcher/factory.py +1 -1
- mlrun/launcher/local.py +1 -1
- mlrun/launcher/remote.py +1 -1
- mlrun/model.py +1 -0
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +104 -301
- mlrun/model_monitoring/application.py +21 -21
- mlrun/model_monitoring/applications/histogram_data_drift.py +130 -40
- mlrun/model_monitoring/controller.py +26 -33
- mlrun/model_monitoring/db/__init__.py +16 -0
- mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -34
- mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
- mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +47 -6
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +49 -0
- mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +76 -3
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +68 -0
- mlrun/model_monitoring/{stores → db/stores/sqldb}/models/sqlite.py +13 -1
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +662 -0
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
- mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +134 -3
- mlrun/model_monitoring/features_drift_table.py +34 -22
- mlrun/model_monitoring/helpers.py +45 -6
- mlrun/model_monitoring/stream_processing.py +43 -9
- mlrun/model_monitoring/tracking_policy.py +7 -1
- mlrun/model_monitoring/writer.py +4 -36
- mlrun/projects/pipelines.py +13 -1
- mlrun/projects/project.py +279 -117
- mlrun/run.py +72 -74
- mlrun/runtimes/__init__.py +35 -0
- mlrun/runtimes/base.py +7 -1
- mlrun/runtimes/nuclio/api_gateway.py +188 -61
- mlrun/runtimes/nuclio/application/__init__.py +15 -0
- mlrun/runtimes/nuclio/application/application.py +283 -0
- mlrun/runtimes/nuclio/application/reverse_proxy.go +87 -0
- mlrun/runtimes/nuclio/function.py +53 -1
- mlrun/runtimes/nuclio/serving.py +28 -32
- mlrun/runtimes/pod.py +27 -1
- mlrun/serving/server.py +4 -6
- mlrun/serving/states.py +41 -33
- mlrun/utils/helpers.py +34 -0
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/METADATA +14 -5
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/RECORD +71 -64
- mlrun/model_monitoring/batch.py +0 -974
- mlrun/model_monitoring/stores/models/__init__.py +0 -27
- mlrun/model_monitoring/stores/models/mysql.py +0 -34
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/entry_points.txt +0 -0
- {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
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|