mlrun 1.8.0rc54__py3-none-any.whl → 1.8.0rc55__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/common/schemas/model_monitoring/model_endpoints.py +32 -8
- mlrun/utils/notifications/notification/webhook.py +17 -9
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/METADATA +1 -1
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/RECORD +9 -9
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/WHEEL +1 -1
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/entry_points.txt +0 -0
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/licenses/LICENSE +0 -0
- {mlrun-1.8.0rc54.dist-info → mlrun-1.8.0rc55.dist-info}/top_level.txt +0 -0
|
@@ -88,13 +88,18 @@ class ModelEndpointParser(abc.ABC, BaseModel):
|
|
|
88
88
|
|
|
89
89
|
@classmethod
|
|
90
90
|
def from_flat_dict(
|
|
91
|
-
cls,
|
|
91
|
+
cls,
|
|
92
|
+
endpoint_dict: dict,
|
|
93
|
+
json_parse_values: Optional[list] = None,
|
|
94
|
+
validate: bool = True,
|
|
92
95
|
) -> "ModelEndpointParser":
|
|
93
96
|
"""Create a `ModelEndpointParser` object from an endpoint dictionary
|
|
94
97
|
|
|
95
98
|
:param endpoint_dict: Model endpoint dictionary.
|
|
96
99
|
:param json_parse_values: List of dictionary keys with a JSON string value that will be parsed into a
|
|
97
100
|
dictionary using json.loads().
|
|
101
|
+
:param validate: Whether to validate the flattened dictionary.
|
|
102
|
+
Skip validation to optimize performance when it is safe to do so.
|
|
98
103
|
"""
|
|
99
104
|
if json_parse_values is None:
|
|
100
105
|
json_parse_values = cls.json_parse_values()
|
|
@@ -103,6 +108,7 @@ class ModelEndpointParser(abc.ABC, BaseModel):
|
|
|
103
108
|
model_class=cls,
|
|
104
109
|
flattened_dictionary=endpoint_dict,
|
|
105
110
|
json_parse_values=json_parse_values,
|
|
111
|
+
validate=validate,
|
|
106
112
|
)
|
|
107
113
|
|
|
108
114
|
|
|
@@ -213,17 +219,27 @@ class ModelEndpoint(BaseModel):
|
|
|
213
219
|
return flatten_dict
|
|
214
220
|
|
|
215
221
|
@classmethod
|
|
216
|
-
def from_flat_dict(
|
|
222
|
+
def from_flat_dict(
|
|
223
|
+
cls, endpoint_dict: dict, validate: bool = True
|
|
224
|
+
) -> "ModelEndpoint":
|
|
217
225
|
"""Create a `ModelEndpoint` object from an endpoint flattened dictionary. Because the provided dictionary
|
|
218
226
|
is flattened, we pass it as is to the subclasses without splitting the keys into spec, metadata, and status.
|
|
219
227
|
|
|
220
228
|
:param endpoint_dict: Model endpoint dictionary.
|
|
229
|
+
:param validate: Whether to validate the flattened dictionary.
|
|
230
|
+
Skip validation to optimize performance when it is safe to do so.
|
|
221
231
|
"""
|
|
222
232
|
|
|
223
233
|
return cls(
|
|
224
|
-
metadata=ModelEndpointMetadata.from_flat_dict(
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
metadata=ModelEndpointMetadata.from_flat_dict(
|
|
235
|
+
endpoint_dict=endpoint_dict, validate=validate
|
|
236
|
+
),
|
|
237
|
+
spec=ModelEndpointSpec.from_flat_dict(
|
|
238
|
+
endpoint_dict=endpoint_dict, validate=validate
|
|
239
|
+
),
|
|
240
|
+
status=ModelEndpointStatus.from_flat_dict(
|
|
241
|
+
endpoint_dict=endpoint_dict, validate=validate
|
|
242
|
+
),
|
|
227
243
|
)
|
|
228
244
|
|
|
229
245
|
def get(self, field, default=None):
|
|
@@ -311,7 +327,10 @@ class ModelEndpointMonitoringMetricNoData(_ModelEndpointMonitoringMetricValuesBa
|
|
|
311
327
|
|
|
312
328
|
|
|
313
329
|
def _mapping_attributes(
|
|
314
|
-
model_class: type[Model],
|
|
330
|
+
model_class: type[Model],
|
|
331
|
+
flattened_dictionary: dict,
|
|
332
|
+
json_parse_values: list,
|
|
333
|
+
validate: bool = True,
|
|
315
334
|
) -> Model:
|
|
316
335
|
"""Generate a `BaseModel` object with the provided dictionary attributes.
|
|
317
336
|
|
|
@@ -319,8 +338,10 @@ def _mapping_attributes(
|
|
|
319
338
|
:param flattened_dictionary: Flattened dictionary that contains the model endpoint attributes.
|
|
320
339
|
:param json_parse_values: List of dictionary keys with a JSON string value that will be parsed into a
|
|
321
340
|
dictionary using json.loads().
|
|
341
|
+
:param validate: Whether to validate the flattened dictionary.
|
|
342
|
+
Skip validation to optimize performance when it is safe to do so.
|
|
322
343
|
"""
|
|
323
|
-
# Get the fields of the provided base model object. These fields will be used to filter to
|
|
344
|
+
# Get the fields of the provided base model object. These fields will be used to filter to relevant keys
|
|
324
345
|
# from the flattened dictionary.
|
|
325
346
|
wanted_keys = model_class.__fields__.keys()
|
|
326
347
|
|
|
@@ -338,7 +359,10 @@ def _mapping_attributes(
|
|
|
338
359
|
else:
|
|
339
360
|
dict_to_parse[field_key] = None
|
|
340
361
|
|
|
341
|
-
|
|
362
|
+
if validate:
|
|
363
|
+
return model_class.parse_obj(dict_to_parse)
|
|
364
|
+
|
|
365
|
+
return model_class.construct(**dict_to_parse)
|
|
342
366
|
|
|
343
367
|
|
|
344
368
|
def _json_loads_if_not_none(field: Any) -> Any:
|
|
@@ -80,13 +80,6 @@ class WebhookNotification(NotificationBase):
|
|
|
80
80
|
if override_body:
|
|
81
81
|
request_body = self._serialize_runs_in_request_body(override_body, runs)
|
|
82
82
|
|
|
83
|
-
request_body = orjson.dumps(
|
|
84
|
-
request_body,
|
|
85
|
-
option=orjson.OPT_NAIVE_UTC
|
|
86
|
-
| orjson.OPT_SERIALIZE_NUMPY
|
|
87
|
-
| orjson.OPT_NON_STR_KEYS
|
|
88
|
-
| orjson.OPT_SORT_KEYS,
|
|
89
|
-
).decode()
|
|
90
83
|
# Specify the `verify_ssl` parameter value only for HTTPS urls.
|
|
91
84
|
# The `ClientSession` allows using `ssl=None` for the default SSL check,
|
|
92
85
|
# and `ssl=False` to skip SSL certificate validation.
|
|
@@ -94,9 +87,14 @@ class WebhookNotification(NotificationBase):
|
|
|
94
87
|
# we automatically handle it as `ssl=None` for their convenience.
|
|
95
88
|
verify_ssl = verify_ssl and None if url.startswith("https") else None
|
|
96
89
|
|
|
97
|
-
async with aiohttp.ClientSession(
|
|
90
|
+
async with aiohttp.ClientSession(
|
|
91
|
+
json_serialize=self._encoder,
|
|
92
|
+
) as session:
|
|
98
93
|
response = await getattr(session, method)(
|
|
99
|
-
url,
|
|
94
|
+
url,
|
|
95
|
+
headers=headers,
|
|
96
|
+
json=request_body,
|
|
97
|
+
ssl=verify_ssl,
|
|
100
98
|
)
|
|
101
99
|
response.raise_for_status()
|
|
102
100
|
|
|
@@ -136,3 +134,13 @@ class WebhookNotification(NotificationBase):
|
|
|
136
134
|
)
|
|
137
135
|
|
|
138
136
|
return override_body
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def _encoder(self):
|
|
140
|
+
return lambda body: orjson.dumps(
|
|
141
|
+
body,
|
|
142
|
+
option=orjson.OPT_NAIVE_UTC
|
|
143
|
+
| orjson.OPT_SERIALIZE_NUMPY
|
|
144
|
+
| orjson.OPT_NON_STR_KEYS
|
|
145
|
+
| orjson.OPT_SORT_KEYS,
|
|
146
|
+
).decode()
|
mlrun/utils/version/version.json
CHANGED
|
@@ -75,7 +75,7 @@ mlrun/common/schemas/workflow.py,sha256=6u9niXfXpV-_c2rZL97gFIdAnOfM5WK-OCbrM5Kk
|
|
|
75
75
|
mlrun/common/schemas/model_monitoring/__init__.py,sha256=SxHG-GIdcTEuFxpKzkUdT9zKaU5Xqz9qF1uCwXvZ2z8,1709
|
|
76
76
|
mlrun/common/schemas/model_monitoring/constants.py,sha256=wbNe_n5wX98gD1XQ6jmt97Jh59S9GsE54UBPZl9Pg20,12570
|
|
77
77
|
mlrun/common/schemas/model_monitoring/grafana.py,sha256=THQlLfPBevBksta8p5OaIsBaJtsNSXexLvHrDxOaVns,2095
|
|
78
|
-
mlrun/common/schemas/model_monitoring/model_endpoints.py,sha256=
|
|
78
|
+
mlrun/common/schemas/model_monitoring/model_endpoints.py,sha256=YYFai89qBTnKM8dSUncVD25uwz8QdcTLrEb7vMefyTc,12391
|
|
79
79
|
mlrun/data_types/__init__.py,sha256=wdxGS1PTnaKXiNZ7PYGxxo86OifHH7NYoArIjDJksLA,1054
|
|
80
80
|
mlrun/data_types/data_types.py,sha256=0_oKLC6-sXL2_nnaDMP_HSXB3fD1nJAG4J2Jq6sGNNw,4998
|
|
81
81
|
mlrun/data_types/infer.py,sha256=Ogp3rsENVkjU0GDaGa9J1vjGrvMxgzwbSEuG51nt61E,6477
|
|
@@ -338,13 +338,13 @@ mlrun/utils/notifications/notification/git.py,sha256=t2lqRrPRBO4awf_uhxJreH9Cpcb
|
|
|
338
338
|
mlrun/utils/notifications/notification/ipython.py,sha256=9uZvI1uOLFaNuAsfJPXmL3l6dOzFoWdBK5GYNYFAfks,2282
|
|
339
339
|
mlrun/utils/notifications/notification/mail.py,sha256=ZyJ3eqd8simxffQmXzqd3bgbAqp1vij7C6aRJ9h2mgs,6012
|
|
340
340
|
mlrun/utils/notifications/notification/slack.py,sha256=eQvmctTh6wIG5xVOesLLV9S1-UUCu5UEQ9JIJOor3ts,7183
|
|
341
|
-
mlrun/utils/notifications/notification/webhook.py,sha256=
|
|
341
|
+
mlrun/utils/notifications/notification/webhook.py,sha256=zxh8CAlbPnTazsk6r05X5TKwqUZVOH5KBU2fJbzQlG4,5330
|
|
342
342
|
mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
|
|
343
|
-
mlrun/utils/version/version.json,sha256
|
|
343
|
+
mlrun/utils/version/version.json,sha256=uGWC8p0f3GV14zi6vIEuExlx7M_nQbyFGSfe0CccBo0,89
|
|
344
344
|
mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
|
|
345
|
-
mlrun-1.8.
|
|
346
|
-
mlrun-1.8.
|
|
347
|
-
mlrun-1.8.
|
|
348
|
-
mlrun-1.8.
|
|
349
|
-
mlrun-1.8.
|
|
350
|
-
mlrun-1.8.
|
|
345
|
+
mlrun-1.8.0rc55.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
346
|
+
mlrun-1.8.0rc55.dist-info/METADATA,sha256=yAY1-rwKAxNl2yJh7mfkg4z5rrgQ9XBPWPztSLswSNc,26009
|
|
347
|
+
mlrun-1.8.0rc55.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
|
348
|
+
mlrun-1.8.0rc55.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
|
|
349
|
+
mlrun-1.8.0rc55.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
|
|
350
|
+
mlrun-1.8.0rc55.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|