mlrun 1.4.0rc25__py3-none-any.whl → 1.5.0rc2__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/__init__.py +2 -35
- mlrun/__main__.py +3 -41
- mlrun/api/api/api.py +6 -0
- mlrun/api/api/endpoints/feature_store.py +0 -4
- mlrun/api/api/endpoints/files.py +14 -2
- mlrun/api/api/endpoints/frontend_spec.py +2 -1
- mlrun/api/api/endpoints/functions.py +95 -59
- mlrun/api/api/endpoints/grafana_proxy.py +9 -9
- mlrun/api/api/endpoints/logs.py +17 -3
- mlrun/api/api/endpoints/model_endpoints.py +3 -2
- mlrun/api/api/endpoints/pipelines.py +1 -5
- mlrun/api/api/endpoints/projects.py +88 -0
- mlrun/api/api/endpoints/runs.py +48 -6
- mlrun/api/api/endpoints/submit.py +2 -1
- mlrun/api/api/endpoints/workflows.py +355 -0
- mlrun/api/api/utils.py +3 -4
- mlrun/api/crud/__init__.py +1 -0
- mlrun/api/crud/client_spec.py +6 -2
- mlrun/api/crud/feature_store.py +5 -0
- mlrun/api/crud/model_monitoring/__init__.py +1 -0
- mlrun/api/crud/model_monitoring/deployment.py +497 -0
- mlrun/api/crud/model_monitoring/grafana.py +96 -42
- mlrun/api/crud/model_monitoring/helpers.py +159 -0
- mlrun/api/crud/model_monitoring/model_endpoints.py +202 -476
- mlrun/api/crud/notifications.py +9 -4
- mlrun/api/crud/pipelines.py +6 -11
- mlrun/api/crud/projects.py +2 -2
- mlrun/api/crud/runtime_resources.py +4 -3
- mlrun/api/crud/runtimes/nuclio/helpers.py +5 -1
- mlrun/api/crud/secrets.py +21 -0
- mlrun/api/crud/workflows.py +352 -0
- mlrun/api/db/base.py +16 -1
- mlrun/api/db/init_db.py +2 -4
- mlrun/api/db/session.py +1 -1
- mlrun/api/db/sqldb/db.py +129 -31
- mlrun/api/db/sqldb/models/models_mysql.py +15 -1
- mlrun/api/db/sqldb/models/models_sqlite.py +16 -2
- mlrun/api/launcher.py +38 -6
- mlrun/api/main.py +3 -2
- mlrun/api/rundb/__init__.py +13 -0
- mlrun/{db → api/rundb}/sqldb.py +36 -84
- mlrun/api/runtime_handlers/__init__.py +56 -0
- mlrun/api/runtime_handlers/base.py +1247 -0
- mlrun/api/runtime_handlers/daskjob.py +209 -0
- mlrun/api/runtime_handlers/kubejob.py +37 -0
- mlrun/api/runtime_handlers/mpijob.py +147 -0
- mlrun/api/runtime_handlers/remotesparkjob.py +29 -0
- mlrun/api/runtime_handlers/sparkjob.py +148 -0
- mlrun/api/schemas/__init__.py +17 -6
- mlrun/api/utils/builder.py +1 -4
- mlrun/api/utils/clients/chief.py +14 -0
- mlrun/api/utils/clients/iguazio.py +33 -33
- mlrun/api/utils/clients/nuclio.py +2 -2
- mlrun/api/utils/periodic.py +9 -2
- mlrun/api/utils/projects/follower.py +14 -7
- mlrun/api/utils/projects/leader.py +2 -1
- mlrun/api/utils/projects/remotes/nop_follower.py +2 -2
- mlrun/api/utils/projects/remotes/nop_leader.py +2 -2
- mlrun/api/utils/runtimes/__init__.py +14 -0
- mlrun/api/utils/runtimes/nuclio.py +43 -0
- mlrun/api/utils/scheduler.py +98 -15
- mlrun/api/utils/singletons/db.py +5 -1
- mlrun/api/utils/singletons/project_member.py +4 -1
- mlrun/api/utils/singletons/scheduler.py +1 -1
- mlrun/artifacts/base.py +6 -6
- mlrun/artifacts/dataset.py +4 -4
- mlrun/artifacts/manager.py +2 -3
- mlrun/artifacts/model.py +2 -2
- mlrun/artifacts/plots.py +8 -8
- mlrun/common/db/__init__.py +14 -0
- mlrun/common/helpers.py +37 -0
- mlrun/{mlutils → common/model_monitoring}/__init__.py +3 -2
- mlrun/common/model_monitoring/helpers.py +69 -0
- mlrun/common/schemas/__init__.py +13 -1
- mlrun/common/schemas/auth.py +4 -1
- mlrun/common/schemas/client_spec.py +1 -1
- mlrun/common/schemas/function.py +17 -0
- mlrun/common/schemas/model_monitoring/__init__.py +48 -0
- mlrun/common/{model_monitoring.py → schemas/model_monitoring/constants.py} +11 -23
- mlrun/common/schemas/model_monitoring/grafana.py +55 -0
- mlrun/common/schemas/{model_endpoints.py → model_monitoring/model_endpoints.py} +32 -65
- mlrun/common/schemas/notification.py +1 -0
- mlrun/common/schemas/object.py +4 -0
- mlrun/common/schemas/project.py +1 -0
- mlrun/common/schemas/regex.py +1 -1
- mlrun/common/schemas/runs.py +1 -8
- mlrun/common/schemas/schedule.py +1 -8
- mlrun/common/schemas/workflow.py +54 -0
- mlrun/config.py +45 -42
- mlrun/datastore/__init__.py +21 -0
- mlrun/datastore/base.py +1 -1
- mlrun/datastore/datastore.py +9 -0
- mlrun/datastore/dbfs_store.py +168 -0
- mlrun/datastore/helpers.py +18 -0
- mlrun/datastore/sources.py +1 -0
- mlrun/datastore/store_resources.py +2 -5
- mlrun/datastore/v3io.py +1 -2
- mlrun/db/__init__.py +4 -68
- mlrun/db/base.py +12 -0
- mlrun/db/factory.py +65 -0
- mlrun/db/httpdb.py +175 -20
- mlrun/db/nopdb.py +4 -2
- mlrun/execution.py +4 -2
- mlrun/feature_store/__init__.py +1 -0
- mlrun/feature_store/api.py +1 -2
- mlrun/feature_store/common.py +2 -1
- mlrun/feature_store/feature_set.py +1 -11
- mlrun/feature_store/feature_vector.py +340 -2
- mlrun/feature_store/ingestion.py +5 -10
- mlrun/feature_store/retrieval/base.py +118 -104
- mlrun/feature_store/retrieval/dask_merger.py +17 -10
- mlrun/feature_store/retrieval/job.py +4 -1
- mlrun/feature_store/retrieval/local_merger.py +18 -18
- mlrun/feature_store/retrieval/spark_merger.py +21 -14
- mlrun/feature_store/retrieval/storey_merger.py +22 -16
- mlrun/kfpops.py +3 -9
- mlrun/launcher/base.py +57 -53
- mlrun/launcher/client.py +5 -4
- mlrun/launcher/factory.py +24 -13
- mlrun/launcher/local.py +6 -6
- mlrun/launcher/remote.py +4 -4
- mlrun/lists.py +0 -11
- mlrun/model.py +11 -17
- mlrun/model_monitoring/__init__.py +2 -22
- mlrun/model_monitoring/features_drift_table.py +1 -1
- mlrun/model_monitoring/helpers.py +22 -210
- mlrun/model_monitoring/model_endpoint.py +1 -1
- mlrun/model_monitoring/model_monitoring_batch.py +127 -50
- mlrun/model_monitoring/prometheus.py +219 -0
- mlrun/model_monitoring/stores/__init__.py +16 -11
- mlrun/model_monitoring/stores/kv_model_endpoint_store.py +95 -23
- mlrun/model_monitoring/stores/models/mysql.py +47 -29
- mlrun/model_monitoring/stores/models/sqlite.py +47 -29
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +31 -19
- mlrun/model_monitoring/{stream_processing_fs.py → stream_processing.py} +206 -64
- mlrun/model_monitoring/tracking_policy.py +104 -0
- mlrun/package/packager.py +6 -8
- mlrun/package/packagers/default_packager.py +121 -10
- mlrun/package/packagers/numpy_packagers.py +1 -1
- mlrun/platforms/__init__.py +0 -2
- mlrun/platforms/iguazio.py +0 -56
- mlrun/projects/pipelines.py +53 -159
- mlrun/projects/project.py +10 -37
- mlrun/render.py +1 -1
- mlrun/run.py +8 -124
- mlrun/runtimes/__init__.py +6 -42
- mlrun/runtimes/base.py +29 -1249
- mlrun/runtimes/daskjob.py +2 -198
- mlrun/runtimes/funcdoc.py +0 -9
- mlrun/runtimes/function.py +25 -29
- mlrun/runtimes/kubejob.py +5 -29
- mlrun/runtimes/local.py +1 -1
- mlrun/runtimes/mpijob/__init__.py +2 -2
- mlrun/runtimes/mpijob/abstract.py +10 -1
- mlrun/runtimes/mpijob/v1.py +0 -76
- mlrun/runtimes/mpijob/v1alpha1.py +1 -74
- mlrun/runtimes/nuclio.py +3 -2
- mlrun/runtimes/pod.py +28 -18
- mlrun/runtimes/remotesparkjob.py +1 -15
- mlrun/runtimes/serving.py +14 -6
- mlrun/runtimes/sparkjob/__init__.py +0 -1
- mlrun/runtimes/sparkjob/abstract.py +4 -131
- mlrun/runtimes/utils.py +0 -26
- mlrun/serving/routers.py +7 -7
- mlrun/serving/server.py +11 -8
- mlrun/serving/states.py +7 -1
- mlrun/serving/v2_serving.py +6 -6
- mlrun/utils/helpers.py +23 -42
- mlrun/utils/notifications/notification/__init__.py +4 -0
- mlrun/utils/notifications/notification/webhook.py +61 -0
- mlrun/utils/notifications/notification_pusher.py +5 -25
- mlrun/utils/regex.py +7 -2
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/METADATA +26 -25
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/RECORD +180 -158
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/WHEEL +1 -1
- mlrun/mlutils/data.py +0 -160
- mlrun/mlutils/models.py +0 -78
- mlrun/mlutils/plots.py +0 -902
- mlrun/utils/model_monitoring.py +0 -249
- /mlrun/{api/db/sqldb/session.py → common/db/sql_session.py} +0 -0
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/LICENSE +0 -0
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/entry_points.txt +0 -0
- {mlrun-1.4.0rc25.dist-info → mlrun-1.5.0rc2.dist-info}/top_level.txt +0 -0
mlrun/utils/model_monitoring.py
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
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
|
-
|
|
16
|
-
import json
|
|
17
|
-
import warnings
|
|
18
|
-
from typing import Union
|
|
19
|
-
|
|
20
|
-
import mlrun
|
|
21
|
-
import mlrun.common.model_monitoring as model_monitoring_constants
|
|
22
|
-
import mlrun.model
|
|
23
|
-
import mlrun.platforms.iguazio
|
|
24
|
-
from mlrun.common.schemas.schedule import ScheduleCronTrigger
|
|
25
|
-
from mlrun.config import is_running_as_api
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def parse_model_endpoint_project_prefix(path: str, project_name: str):
|
|
29
|
-
return path.split(project_name, 1)[0] + project_name
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def parse_model_endpoint_store_prefix(store_prefix: str):
|
|
33
|
-
endpoint, parsed_url = mlrun.platforms.iguazio.parse_path(store_prefix)
|
|
34
|
-
container, path = parsed_url.split("/", 1)
|
|
35
|
-
return endpoint, container, path
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def set_project_model_monitoring_credentials(access_key: str, project: str = None):
|
|
39
|
-
"""Set the credentials that will be used by the project's model monitoring
|
|
40
|
-
infrastructure functions.
|
|
41
|
-
The supplied credentials must have data access
|
|
42
|
-
:param access_key: Model Monitoring access key for managing user permissions.
|
|
43
|
-
:param project: The name of the model monitoring project.
|
|
44
|
-
"""
|
|
45
|
-
mlrun.get_run_db().create_project_secrets(
|
|
46
|
-
project=project or mlrun.mlconf.default_project,
|
|
47
|
-
provider=mlrun.common.schemas.SecretProviderName.kubernetes,
|
|
48
|
-
secrets={model_monitoring_constants.ProjectSecretKeys.ACCESS_KEY: access_key},
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class TrackingPolicy(mlrun.model.ModelObj):
|
|
53
|
-
"""
|
|
54
|
-
Modified model monitoring configurations. By using TrackingPolicy, the user can apply his model monitoring
|
|
55
|
-
requirements, such as setting the scheduling policy of the model monitoring batch job or changing the image of the
|
|
56
|
-
model monitoring stream.
|
|
57
|
-
"""
|
|
58
|
-
|
|
59
|
-
_dict_fields = [
|
|
60
|
-
"default_batch_image",
|
|
61
|
-
"stream_image",
|
|
62
|
-
]
|
|
63
|
-
|
|
64
|
-
def __init__(
|
|
65
|
-
self,
|
|
66
|
-
default_batch_intervals: Union[ScheduleCronTrigger, str] = ScheduleCronTrigger(
|
|
67
|
-
minute="0", hour="*/1"
|
|
68
|
-
),
|
|
69
|
-
default_batch_image: str = "mlrun/mlrun",
|
|
70
|
-
stream_image: str = "mlrun/mlrun",
|
|
71
|
-
):
|
|
72
|
-
"""
|
|
73
|
-
Initialize TrackingPolicy object.
|
|
74
|
-
:param default_batch_intervals: Model monitoring batch scheduling policy. By default, executed on the hour
|
|
75
|
-
every hour. Can be either a string or a ScheduleCronTrigger object. The
|
|
76
|
-
string time format is based on ScheduleCronTrigger expression:
|
|
77
|
-
minute, hour, day of month, month, day of week. It will be converted into
|
|
78
|
-
a ScheduleCronTrigger object.
|
|
79
|
-
:param default_batch_image: The default image of the model monitoring batch job. By default, the image
|
|
80
|
-
is mlrun/mlrun.
|
|
81
|
-
:param stream_image: The image of the model monitoring stream real-time function. By default,
|
|
82
|
-
the image is mlrun/mlrun.
|
|
83
|
-
"""
|
|
84
|
-
if isinstance(default_batch_intervals, str):
|
|
85
|
-
default_batch_intervals = ScheduleCronTrigger.from_crontab(
|
|
86
|
-
default_batch_intervals
|
|
87
|
-
)
|
|
88
|
-
self.default_batch_intervals = default_batch_intervals
|
|
89
|
-
self.default_batch_image = default_batch_image
|
|
90
|
-
self.stream_image = stream_image
|
|
91
|
-
|
|
92
|
-
@classmethod
|
|
93
|
-
def from_dict(cls, struct=None, fields=None, deprecated_fields: dict = None):
|
|
94
|
-
new_obj = super().from_dict(
|
|
95
|
-
struct, fields=cls._dict_fields, deprecated_fields=deprecated_fields
|
|
96
|
-
)
|
|
97
|
-
# Convert default batch interval into ScheduleCronTrigger object
|
|
98
|
-
if model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS in struct:
|
|
99
|
-
if isinstance(
|
|
100
|
-
struct[
|
|
101
|
-
model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS
|
|
102
|
-
],
|
|
103
|
-
str,
|
|
104
|
-
):
|
|
105
|
-
new_obj.default_batch_intervals = ScheduleCronTrigger.from_crontab(
|
|
106
|
-
struct[
|
|
107
|
-
model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS
|
|
108
|
-
]
|
|
109
|
-
)
|
|
110
|
-
else:
|
|
111
|
-
new_obj.default_batch_intervals = ScheduleCronTrigger.parse_obj(
|
|
112
|
-
struct[
|
|
113
|
-
model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS
|
|
114
|
-
]
|
|
115
|
-
)
|
|
116
|
-
return new_obj
|
|
117
|
-
|
|
118
|
-
def to_dict(self, fields=None, exclude=None):
|
|
119
|
-
struct = super().to_dict(
|
|
120
|
-
fields,
|
|
121
|
-
exclude=[model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS],
|
|
122
|
-
)
|
|
123
|
-
if self.default_batch_intervals:
|
|
124
|
-
struct[
|
|
125
|
-
model_monitoring_constants.EventFieldType.DEFAULT_BATCH_INTERVALS
|
|
126
|
-
] = self.default_batch_intervals.dict()
|
|
127
|
-
return struct
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def get_connection_string(project: str = None):
|
|
131
|
-
"""Get endpoint store connection string from the project secret.
|
|
132
|
-
If wasn't set, take it from the system configurations"""
|
|
133
|
-
if is_running_as_api():
|
|
134
|
-
# Running on API server side
|
|
135
|
-
import mlrun.api.crud.secrets
|
|
136
|
-
import mlrun.common.schemas
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
mlrun.api.crud.secrets.Secrets().get_project_secret(
|
|
140
|
-
project=project,
|
|
141
|
-
provider=mlrun.common.schemas.secret.SecretProviderName.kubernetes,
|
|
142
|
-
allow_secrets_from_k8s=True,
|
|
143
|
-
secret_key=model_monitoring_constants.ProjectSecretKeys.ENDPOINT_STORE_CONNECTION,
|
|
144
|
-
)
|
|
145
|
-
or mlrun.mlconf.model_endpoint_monitoring.endpoint_store_connection
|
|
146
|
-
)
|
|
147
|
-
else:
|
|
148
|
-
# Running on stream server side
|
|
149
|
-
import mlrun
|
|
150
|
-
|
|
151
|
-
return (
|
|
152
|
-
mlrun.get_secret_or_env(
|
|
153
|
-
model_monitoring_constants.ProjectSecretKeys.ENDPOINT_STORE_CONNECTION
|
|
154
|
-
)
|
|
155
|
-
or mlrun.mlconf.model_endpoint_monitoring.endpoint_store_connection
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def get_stream_path(project: str = None):
|
|
160
|
-
# TODO: This function (as well as other methods in this file) includes both client and server side code. We will
|
|
161
|
-
# need to refactor and adjust this file in the future.
|
|
162
|
-
"""Get stream path from the project secret. If wasn't set, take it from the system configurations"""
|
|
163
|
-
|
|
164
|
-
if is_running_as_api():
|
|
165
|
-
# Running on API server side
|
|
166
|
-
import mlrun.api.crud.secrets
|
|
167
|
-
import mlrun.common.schemas
|
|
168
|
-
|
|
169
|
-
stream_uri = mlrun.api.crud.secrets.Secrets().get_project_secret(
|
|
170
|
-
project=project,
|
|
171
|
-
provider=mlrun.common.schemas.secret.SecretProviderName.kubernetes,
|
|
172
|
-
allow_secrets_from_k8s=True,
|
|
173
|
-
secret_key=model_monitoring_constants.ProjectSecretKeys.STREAM_PATH,
|
|
174
|
-
) or mlrun.mlconf.get_model_monitoring_file_target_path(
|
|
175
|
-
project=project,
|
|
176
|
-
kind=model_monitoring_constants.FileTargetKind.STREAM,
|
|
177
|
-
target="online",
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
else:
|
|
181
|
-
import mlrun
|
|
182
|
-
|
|
183
|
-
stream_uri = mlrun.get_secret_or_env(
|
|
184
|
-
model_monitoring_constants.ProjectSecretKeys.STREAM_PATH
|
|
185
|
-
) or mlrun.mlconf.get_model_monitoring_file_target_path(
|
|
186
|
-
project=project,
|
|
187
|
-
kind=model_monitoring_constants.FileTargetKind.STREAM,
|
|
188
|
-
target="online",
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
if stream_uri.startswith("kafka://"):
|
|
192
|
-
if "?topic" in stream_uri:
|
|
193
|
-
raise mlrun.errors.MLRunInvalidArgumentError(
|
|
194
|
-
"Custom kafka topic is not allowed"
|
|
195
|
-
)
|
|
196
|
-
# Add topic to stream kafka uri
|
|
197
|
-
stream_uri += f"?topic=monitoring_stream_{project}"
|
|
198
|
-
|
|
199
|
-
elif stream_uri.startswith("v3io://") and mlrun.mlconf.is_ce_mode():
|
|
200
|
-
# V3IO is not supported in CE mode, generating a default http stream path
|
|
201
|
-
stream_uri = mlrun.mlconf.model_endpoint_monitoring.default_http_sink
|
|
202
|
-
|
|
203
|
-
return stream_uri
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def validate_old_schema_fields(endpoint: dict):
|
|
207
|
-
"""
|
|
208
|
-
Replace default null values for `error_count` and `metrics` for users that logged a model endpoint before 1.3.0.
|
|
209
|
-
In addition, this function also validates that the key name of the endpoint unique id is `uid` and not
|
|
210
|
-
`endpoint_id` that has been used before 1.3.0.
|
|
211
|
-
|
|
212
|
-
Leaving here for backwards compatibility which related to the model endpoint schema.
|
|
213
|
-
|
|
214
|
-
:param endpoint: An endpoint flattened dictionary.
|
|
215
|
-
"""
|
|
216
|
-
warnings.warn(
|
|
217
|
-
"This will be deprecated in 1.3.0, and will be removed in 1.5.0",
|
|
218
|
-
# TODO: In 1.3.0 do changes in examples & demos In 1.5.0 remove
|
|
219
|
-
FutureWarning,
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
# Validate default value for `error_count`
|
|
223
|
-
# For backwards compatibility reasons, we validate that the model endpoint includes the `error_count` key
|
|
224
|
-
if (
|
|
225
|
-
model_monitoring_constants.EventFieldType.ERROR_COUNT in endpoint
|
|
226
|
-
and endpoint[model_monitoring_constants.EventFieldType.ERROR_COUNT] == "null"
|
|
227
|
-
):
|
|
228
|
-
endpoint[model_monitoring_constants.EventFieldType.ERROR_COUNT] = "0"
|
|
229
|
-
|
|
230
|
-
# Validate default value for `metrics`
|
|
231
|
-
# For backwards compatibility reasons, we validate that the model endpoint includes the `metrics` key
|
|
232
|
-
if (
|
|
233
|
-
model_monitoring_constants.EventFieldType.METRICS in endpoint
|
|
234
|
-
and endpoint[model_monitoring_constants.EventFieldType.METRICS] == "null"
|
|
235
|
-
):
|
|
236
|
-
endpoint[model_monitoring_constants.EventFieldType.METRICS] = json.dumps(
|
|
237
|
-
{
|
|
238
|
-
model_monitoring_constants.EventKeyMetrics.GENERIC: {
|
|
239
|
-
model_monitoring_constants.EventLiveStats.LATENCY_AVG_1H: 0,
|
|
240
|
-
model_monitoring_constants.EventLiveStats.PREDICTIONS_PER_SECOND: 0,
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
)
|
|
244
|
-
# Validate key `uid` instead of `endpoint_id`
|
|
245
|
-
# For backwards compatibility reasons, we replace the `endpoint_id` with `uid` which is the updated key name
|
|
246
|
-
if model_monitoring_constants.EventFieldType.ENDPOINT_ID in endpoint:
|
|
247
|
-
endpoint[model_monitoring_constants.EventFieldType.UID] = endpoint[
|
|
248
|
-
model_monitoring_constants.EventFieldType.ENDPOINT_ID
|
|
249
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|