mlrun 1.10.0rc2__py3-none-any.whl → 1.10.0rc4__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 -2
- mlrun/__main__.py +2 -2
- mlrun/artifacts/__init__.py +1 -0
- mlrun/artifacts/base.py +20 -8
- mlrun/artifacts/dataset.py +1 -1
- mlrun/artifacts/document.py +1 -1
- mlrun/artifacts/helpers.py +40 -0
- mlrun/artifacts/llm_prompt.py +165 -0
- mlrun/artifacts/manager.py +13 -1
- mlrun/artifacts/model.py +92 -12
- mlrun/artifacts/plots.py +2 -2
- mlrun/common/formatters/artifact.py +1 -0
- mlrun/common/runtimes/constants.py +0 -21
- mlrun/common/schemas/artifact.py +12 -12
- mlrun/common/schemas/pipeline.py +0 -16
- mlrun/common/schemas/project.py +0 -17
- mlrun/common/schemas/runs.py +0 -17
- mlrun/config.py +3 -3
- mlrun/datastore/base.py +2 -2
- mlrun/datastore/datastore.py +1 -1
- mlrun/datastore/datastore_profile.py +3 -11
- mlrun/datastore/redis.py +2 -3
- mlrun/datastore/sources.py +0 -9
- mlrun/datastore/store_resources.py +3 -3
- mlrun/datastore/storeytargets.py +2 -5
- mlrun/datastore/targets.py +7 -57
- mlrun/datastore/utils.py +1 -11
- mlrun/db/base.py +7 -6
- mlrun/db/httpdb.py +72 -66
- mlrun/db/nopdb.py +1 -0
- mlrun/errors.py +22 -1
- mlrun/execution.py +87 -1
- mlrun/feature_store/common.py +5 -5
- mlrun/feature_store/feature_set.py +10 -6
- mlrun/feature_store/feature_vector.py +8 -6
- mlrun/launcher/base.py +1 -1
- mlrun/lists.py +1 -1
- mlrun/model.py +0 -5
- mlrun/model_monitoring/__init__.py +0 -1
- mlrun/model_monitoring/api.py +0 -44
- mlrun/model_monitoring/applications/evidently/base.py +3 -41
- mlrun/model_monitoring/controller.py +1 -1
- mlrun/model_monitoring/writer.py +1 -4
- mlrun/projects/operations.py +3 -3
- mlrun/projects/project.py +260 -23
- mlrun/run.py +9 -27
- mlrun/runtimes/base.py +6 -6
- mlrun/runtimes/kubejob.py +2 -2
- mlrun/runtimes/nuclio/function.py +3 -3
- mlrun/runtimes/nuclio/serving.py +13 -23
- mlrun/runtimes/remotesparkjob.py +6 -0
- mlrun/runtimes/sparkjob/spark3job.py +6 -0
- mlrun/serving/__init__.py +5 -1
- mlrun/serving/server.py +39 -3
- mlrun/serving/states.py +101 -4
- mlrun/serving/v2_serving.py +1 -1
- mlrun/utils/helpers.py +66 -9
- mlrun/utils/notifications/notification/slack.py +5 -1
- mlrun/utils/notifications/notification_pusher.py +2 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/METADATA +22 -10
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/RECORD +66 -65
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/WHEEL +1 -1
- mlrun/model_monitoring/tracking_policy.py +0 -124
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/entry_points.txt +0 -0
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/licenses/LICENSE +0 -0
- {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc4.dist-info}/top_level.txt +0 -0
mlrun/execution.py
CHANGED
|
@@ -31,6 +31,7 @@ from mlrun.artifacts import (
|
|
|
31
31
|
DatasetArtifact,
|
|
32
32
|
DocumentArtifact,
|
|
33
33
|
DocumentLoaderSpec,
|
|
34
|
+
LLMPromptArtifact,
|
|
34
35
|
ModelArtifact,
|
|
35
36
|
)
|
|
36
37
|
from mlrun.datastore.store_resources import get_store_resource
|
|
@@ -808,6 +809,8 @@ class MLClientCtx:
|
|
|
808
809
|
label_column: Optional[Union[str, list]] = None,
|
|
809
810
|
extra_data=None,
|
|
810
811
|
db_key=None,
|
|
812
|
+
model_url: Optional[str] = None,
|
|
813
|
+
default_config=None,
|
|
811
814
|
**kwargs,
|
|
812
815
|
) -> ModelArtifact:
|
|
813
816
|
"""Log a model artifact and optionally upload it to datastore
|
|
@@ -850,6 +853,9 @@ class MLClientCtx:
|
|
|
850
853
|
value can be absolute path | relative path (to model dir) | bytes | artifact object
|
|
851
854
|
:param db_key: The key to use in the artifact DB table, by default its run name + '_' + key
|
|
852
855
|
db_key=False will not register it in the artifacts table
|
|
856
|
+
:param model_url: Remote model url.
|
|
857
|
+
:param default_config: Default configuration for client building
|
|
858
|
+
Saved as a sub-dictionary under the parameter.
|
|
853
859
|
|
|
854
860
|
:returns: Model artifact object
|
|
855
861
|
"""
|
|
@@ -858,7 +864,6 @@ class MLClientCtx:
|
|
|
858
864
|
raise MLRunInvalidArgumentError(
|
|
859
865
|
"Cannot specify inputs and training set together"
|
|
860
866
|
)
|
|
861
|
-
|
|
862
867
|
model = ModelArtifact(
|
|
863
868
|
key,
|
|
864
869
|
body,
|
|
@@ -873,6 +878,8 @@ class MLClientCtx:
|
|
|
873
878
|
feature_vector=feature_vector,
|
|
874
879
|
feature_weights=feature_weights,
|
|
875
880
|
extra_data=extra_data,
|
|
881
|
+
model_url=model_url,
|
|
882
|
+
default_config=default_config,
|
|
876
883
|
**kwargs,
|
|
877
884
|
)
|
|
878
885
|
if training_set is not None:
|
|
@@ -893,6 +900,85 @@ class MLClientCtx:
|
|
|
893
900
|
self._update_run()
|
|
894
901
|
return item
|
|
895
902
|
|
|
903
|
+
def log_llm_prompt(
|
|
904
|
+
self,
|
|
905
|
+
key,
|
|
906
|
+
prompt_string: Optional[str] = None,
|
|
907
|
+
prompt_path: Optional[str] = None,
|
|
908
|
+
prompt_legend: Optional[dict] = None,
|
|
909
|
+
model_artifact: Union[ModelArtifact, str] = None,
|
|
910
|
+
model_configuration: Optional[dict] = None,
|
|
911
|
+
description: Optional[str] = None,
|
|
912
|
+
target_path: Optional[str] = None,
|
|
913
|
+
artifact_path: Optional[str] = None,
|
|
914
|
+
tag: Optional[str] = None,
|
|
915
|
+
labels: Optional[Union[list[str], str]] = None,
|
|
916
|
+
upload: Optional[bool] = None,
|
|
917
|
+
**kwargs,
|
|
918
|
+
) -> LLMPromptArtifact:
|
|
919
|
+
"""Log an LLM prompt artifact and optionally upload it to the artifact store.
|
|
920
|
+
|
|
921
|
+
This function allows you to log a prompt artifact for large language model (LLM) usage. Prompts can be defined
|
|
922
|
+
as a string or by referencing a file path. Optionally, you can link the prompt to a parent model artifact and
|
|
923
|
+
provide metadata like a prompt legend (e.g., input variable mapping) and generation configuration.
|
|
924
|
+
|
|
925
|
+
Examples::
|
|
926
|
+
|
|
927
|
+
# Log an inline prompt
|
|
928
|
+
context.log_llm_prompt(
|
|
929
|
+
key="qa-prompt",
|
|
930
|
+
prompt_string="Q: {question}",
|
|
931
|
+
model_artifact=model,
|
|
932
|
+
prompt_legend={"question": "user_input"},
|
|
933
|
+
model_configuration={"temperature": 0.7, "max_tokens": 128},
|
|
934
|
+
tag="latest",
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
:param key: Unique name of the artifact.
|
|
938
|
+
:param prompt_string: Raw prompt text as a string. Cannot be used with `prompt_path`.
|
|
939
|
+
:param prompt_path: Path to a file containing the prompt content. Cannot be used with `prompt_string`.
|
|
940
|
+
:param prompt_legend: A dictionary where each key is a placeholder in the prompt (e.g., ``{user_name}``)
|
|
941
|
+
and the value is a description or explanation of what that placeholder represents.
|
|
942
|
+
Useful for documenting and clarifying dynamic parts of the prompt.
|
|
943
|
+
:param model_artifact: Reference to the parent model (either `ModelArtifact` or model URI string).
|
|
944
|
+
:param model_configuration: Dictionary of generation parameters (e.g., temperature, max_tokens).
|
|
945
|
+
:param description: Optional description of the prompt.
|
|
946
|
+
:param target_path: Path to write the artifact locally.
|
|
947
|
+
:param artifact_path: Path in the artifact store (defaults to project artifact path).
|
|
948
|
+
:param tag: Tag/version to assign to the prompt artifact.
|
|
949
|
+
:param labels: Labels to tag the artifact (e.g., list or dict of key-value pairs).
|
|
950
|
+
:param upload: Whether to upload the artifact to the store (defaults to True).
|
|
951
|
+
:param kwargs: Additional fields to pass to the `LLMPromptArtifact` constructor.
|
|
952
|
+
|
|
953
|
+
:returns: The logged `LLMPromptArtifact` object.
|
|
954
|
+
"""
|
|
955
|
+
|
|
956
|
+
llm_prompt = LLMPromptArtifact(
|
|
957
|
+
key=key,
|
|
958
|
+
project=self.project or "",
|
|
959
|
+
prompt_string=prompt_string,
|
|
960
|
+
prompt_path=prompt_path,
|
|
961
|
+
prompt_legend=prompt_legend,
|
|
962
|
+
model_artifact=model_artifact,
|
|
963
|
+
model_configuration=model_configuration,
|
|
964
|
+
target_path=target_path,
|
|
965
|
+
description=description,
|
|
966
|
+
**kwargs,
|
|
967
|
+
)
|
|
968
|
+
|
|
969
|
+
item = cast(
|
|
970
|
+
LLMPromptArtifact,
|
|
971
|
+
self.log_artifact(
|
|
972
|
+
llm_prompt,
|
|
973
|
+
artifact_path=artifact_path,
|
|
974
|
+
tag=tag,
|
|
975
|
+
upload=upload,
|
|
976
|
+
labels=labels,
|
|
977
|
+
),
|
|
978
|
+
)
|
|
979
|
+
self._update_run()
|
|
980
|
+
return item
|
|
981
|
+
|
|
896
982
|
def log_document(
|
|
897
983
|
self,
|
|
898
984
|
key: str = "",
|
mlrun/feature_store/common.py
CHANGED
|
@@ -63,7 +63,7 @@ def parse_project_name_from_feature_string(feature):
|
|
|
63
63
|
|
|
64
64
|
def parse_feature_set_uri(uri, project=None):
|
|
65
65
|
"""get feature set object from db by uri"""
|
|
66
|
-
|
|
66
|
+
active_project = project or config.active_project
|
|
67
67
|
|
|
68
68
|
# parse store://.. uri
|
|
69
69
|
if mlrun.datastore.is_store_uri(uri):
|
|
@@ -74,7 +74,7 @@ def parse_feature_set_uri(uri, project=None):
|
|
|
74
74
|
)
|
|
75
75
|
uri = new_uri
|
|
76
76
|
|
|
77
|
-
return parse_versioned_object_uri(uri,
|
|
77
|
+
return parse_versioned_object_uri(uri, active_project)
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def get_feature_set_by_uri(uri, project=None):
|
|
@@ -98,7 +98,7 @@ def get_feature_set_by_uri(uri, project=None):
|
|
|
98
98
|
def get_feature_vector_by_uri(uri, project=None, update=True):
|
|
99
99
|
"""get feature vector object from db by uri"""
|
|
100
100
|
db = mlrun.get_run_db()
|
|
101
|
-
|
|
101
|
+
active_project = project or config.active_project
|
|
102
102
|
|
|
103
103
|
# parse store://.. uri
|
|
104
104
|
if mlrun.datastore.is_store_uri(uri):
|
|
@@ -109,7 +109,7 @@ def get_feature_vector_by_uri(uri, project=None, update=True):
|
|
|
109
109
|
)
|
|
110
110
|
uri = new_uri
|
|
111
111
|
|
|
112
|
-
project, name, tag, uid = parse_versioned_object_uri(uri,
|
|
112
|
+
project, name, tag, uid = parse_versioned_object_uri(uri, active_project)
|
|
113
113
|
|
|
114
114
|
resource = mlrun.common.schemas.AuthorizationResourceTypes.feature_vector.to_resource_string(
|
|
115
115
|
project, "feature-vector"
|
|
@@ -161,7 +161,7 @@ def verify_feature_set_exists(feature_set):
|
|
|
161
161
|
def verify_feature_vector_permissions(
|
|
162
162
|
feature_vector, action: mlrun.common.schemas.AuthorizationAction
|
|
163
163
|
):
|
|
164
|
-
project = feature_vector._metadata.project or config.
|
|
164
|
+
project = feature_vector._metadata.project or config.active_project
|
|
165
165
|
|
|
166
166
|
resource = mlrun.common.schemas.AuthorizationResourceTypes.feature_vector.to_resource_string(
|
|
167
167
|
project, "feature-vector"
|
|
@@ -413,11 +413,15 @@ class FeatureSet(ModelObj):
|
|
|
413
413
|
@property
|
|
414
414
|
def fullname(self) -> str:
|
|
415
415
|
"""full name in the form ``{project}/{name}[:{tag}]``"""
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
project = self._metadata.project or mlconf.active_project
|
|
417
|
+
name = self._metadata.name
|
|
418
|
+
tag = self._metadata.tag
|
|
419
|
+
|
|
420
|
+
fullname = name
|
|
421
|
+
if project:
|
|
422
|
+
fullname = f"{project}/{fullname}"
|
|
423
|
+
if tag:
|
|
424
|
+
fullname += f":{tag}"
|
|
421
425
|
return fullname
|
|
422
426
|
|
|
423
427
|
def _get_run_db(self):
|
|
@@ -971,7 +975,7 @@ class FeatureSet(ModelObj):
|
|
|
971
975
|
def save(self, tag="", versioned=False):
|
|
972
976
|
"""save to mlrun db"""
|
|
973
977
|
db = self._get_run_db()
|
|
974
|
-
self.metadata.project = self.metadata.project or mlconf.
|
|
978
|
+
self.metadata.project = self.metadata.project or mlconf.active_project
|
|
975
979
|
tag = tag or self.metadata.tag or "latest"
|
|
976
980
|
as_dict = self.to_dict()
|
|
977
981
|
as_dict["spec"]["features"] = as_dict["spec"].get(
|
|
@@ -333,12 +333,14 @@ class FeatureVector(ModelObj):
|
|
|
333
333
|
@property
|
|
334
334
|
def uri(self):
|
|
335
335
|
"""fully qualified feature vector uri"""
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
336
|
+
project = self._metadata.project or mlconf.active_project
|
|
337
|
+
name = self._metadata.name
|
|
338
|
+
|
|
339
|
+
base = name if not project else f"{project}/{name}"
|
|
340
|
+
uri = get_store_uri(StorePrefix.FeatureVector, base)
|
|
341
|
+
|
|
340
342
|
if self._metadata.tag:
|
|
341
|
-
uri += ":
|
|
343
|
+
uri += f":{self._metadata.tag}"
|
|
342
344
|
return uri
|
|
343
345
|
|
|
344
346
|
def link_analysis(self, name, uri):
|
|
@@ -385,7 +387,7 @@ class FeatureVector(ModelObj):
|
|
|
385
387
|
def save(self, tag="", versioned=False):
|
|
386
388
|
"""save to mlrun db"""
|
|
387
389
|
db = mlrun.get_run_db()
|
|
388
|
-
self.metadata.project = self.metadata.project or mlconf.
|
|
390
|
+
self.metadata.project = self.metadata.project or mlconf.active_project
|
|
389
391
|
tag = tag or self.metadata.tag
|
|
390
392
|
as_dict = self.to_dict()
|
|
391
393
|
db.store_feature_vector(as_dict, tag=tag, versioned=versioned)
|
mlrun/launcher/base.py
CHANGED
|
@@ -273,7 +273,7 @@ class BaseLauncher(abc.ABC):
|
|
|
273
273
|
project_name
|
|
274
274
|
or run.metadata.project
|
|
275
275
|
or runtime.metadata.project
|
|
276
|
-
or mlrun.mlconf.
|
|
276
|
+
or mlrun.mlconf.active_project
|
|
277
277
|
)
|
|
278
278
|
run.spec.parameters = params or run.spec.parameters
|
|
279
279
|
run.spec.inputs = inputs or run.spec.inputs
|
mlrun/lists.py
CHANGED
|
@@ -55,7 +55,7 @@ class RunList(list):
|
|
|
55
55
|
for run in self:
|
|
56
56
|
iterations = get_in(run, "status.iterations", "")
|
|
57
57
|
row = [
|
|
58
|
-
get_in(run, "metadata.project", config.
|
|
58
|
+
get_in(run, "metadata.project", config.active_project),
|
|
59
59
|
get_in(run, "metadata.uid", ""),
|
|
60
60
|
get_in(run, "metadata.iteration", ""),
|
|
61
61
|
get_in(run, "status.start_time", ""),
|
mlrun/model.py
CHANGED
|
@@ -2155,7 +2155,6 @@ class DataSource(ModelObj):
|
|
|
2155
2155
|
"max_age",
|
|
2156
2156
|
"start_time",
|
|
2157
2157
|
"end_time",
|
|
2158
|
-
"credentials_prefix",
|
|
2159
2158
|
]
|
|
2160
2159
|
kind = None
|
|
2161
2160
|
|
|
@@ -2218,7 +2217,6 @@ class DataTargetBase(ModelObj):
|
|
|
2218
2217
|
"storage_options",
|
|
2219
2218
|
"run_id",
|
|
2220
2219
|
"schema",
|
|
2221
|
-
"credentials_prefix",
|
|
2222
2220
|
]
|
|
2223
2221
|
|
|
2224
2222
|
@classmethod
|
|
@@ -2253,7 +2251,6 @@ class DataTargetBase(ModelObj):
|
|
|
2253
2251
|
flush_after_seconds: Optional[int] = None,
|
|
2254
2252
|
storage_options: Optional[dict[str, str]] = None,
|
|
2255
2253
|
schema: Optional[dict[str, Any]] = None,
|
|
2256
|
-
credentials_prefix=None,
|
|
2257
2254
|
):
|
|
2258
2255
|
self.name = name
|
|
2259
2256
|
self.kind: str = kind
|
|
@@ -2270,7 +2267,6 @@ class DataTargetBase(ModelObj):
|
|
|
2270
2267
|
self.storage_options = storage_options
|
|
2271
2268
|
self.run_id = None
|
|
2272
2269
|
self.schema = schema
|
|
2273
|
-
self.credentials_prefix = credentials_prefix
|
|
2274
2270
|
|
|
2275
2271
|
|
|
2276
2272
|
class FeatureSetProducer(ModelObj):
|
|
@@ -2303,7 +2299,6 @@ class DataTarget(DataTargetBase):
|
|
|
2303
2299
|
"key_bucketing_number",
|
|
2304
2300
|
"partition_cols",
|
|
2305
2301
|
"time_partitioning_granularity",
|
|
2306
|
-
"credentials_prefix",
|
|
2307
2302
|
]
|
|
2308
2303
|
|
|
2309
2304
|
def __init__(
|
mlrun/model_monitoring/api.py
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
import hashlib
|
|
16
16
|
import typing
|
|
17
|
-
import warnings
|
|
18
17
|
from datetime import datetime
|
|
19
18
|
|
|
20
19
|
import numpy as np
|
|
@@ -136,12 +135,6 @@ def record_results(
|
|
|
136
135
|
infer_results_df: typing.Optional[pd.DataFrame] = None,
|
|
137
136
|
sample_set_statistics: typing.Optional[dict[str, typing.Any]] = None,
|
|
138
137
|
monitoring_mode: mm_constants.ModelMonitoringMode = mm_constants.ModelMonitoringMode.enabled,
|
|
139
|
-
# Deprecated arguments:
|
|
140
|
-
drift_threshold: typing.Optional[float] = None,
|
|
141
|
-
possible_drift_threshold: typing.Optional[float] = None,
|
|
142
|
-
trigger_monitoring_job: bool = False,
|
|
143
|
-
artifacts_tag: str = "",
|
|
144
|
-
default_batch_image: str = "mlrun/mlrun",
|
|
145
138
|
) -> ModelEndpoint:
|
|
146
139
|
"""
|
|
147
140
|
Write a provided inference dataset to model endpoint parquet target. If not exist, generate a new model endpoint
|
|
@@ -166,47 +159,10 @@ def record_results(
|
|
|
166
159
|
the current model endpoint.
|
|
167
160
|
:param monitoring_mode: If enabled, apply model monitoring features on the provided endpoint id. Enabled
|
|
168
161
|
by default.
|
|
169
|
-
:param drift_threshold: (deprecated) The threshold of which to mark drifts.
|
|
170
|
-
:param possible_drift_threshold: (deprecated) The threshold of which to mark possible drifts.
|
|
171
|
-
:param trigger_monitoring_job: (deprecated) If true, run the batch drift job. If not exists, the monitoring
|
|
172
|
-
batch function will be registered through MLRun API with the provided image.
|
|
173
|
-
:param artifacts_tag: (deprecated) Tag to use for all the artifacts resulted from the function.
|
|
174
|
-
Will be relevant only if the monitoring batch job has been triggered.
|
|
175
|
-
:param default_batch_image: (deprecated) The image that will be used when registering the model monitoring
|
|
176
|
-
batch job.
|
|
177
162
|
|
|
178
163
|
:return: A ModelEndpoint object
|
|
179
164
|
"""
|
|
180
165
|
|
|
181
|
-
if drift_threshold is not None or possible_drift_threshold is not None:
|
|
182
|
-
warnings.warn(
|
|
183
|
-
"Custom drift threshold arguments are deprecated since version "
|
|
184
|
-
"1.7.0 and have no effect. They will be removed in version 1.9.0.\n"
|
|
185
|
-
"To enable the default histogram data drift application, run:\n"
|
|
186
|
-
"`project.enable_model_monitoring()`.",
|
|
187
|
-
FutureWarning,
|
|
188
|
-
)
|
|
189
|
-
if trigger_monitoring_job is not False:
|
|
190
|
-
warnings.warn(
|
|
191
|
-
"`trigger_monitoring_job` argument is deprecated since version "
|
|
192
|
-
"1.7.0 and has no effect. It will be removed in version 1.9.0.\n"
|
|
193
|
-
"To enable the default histogram data drift application, run:\n"
|
|
194
|
-
"`project.enable_model_monitoring()`.",
|
|
195
|
-
FutureWarning,
|
|
196
|
-
)
|
|
197
|
-
if artifacts_tag != "":
|
|
198
|
-
warnings.warn(
|
|
199
|
-
"`artifacts_tag` argument is deprecated since version "
|
|
200
|
-
"1.7.0 and has no effect. It will be removed in version 1.9.0.",
|
|
201
|
-
FutureWarning,
|
|
202
|
-
)
|
|
203
|
-
if default_batch_image != "mlrun/mlrun":
|
|
204
|
-
warnings.warn(
|
|
205
|
-
"`default_batch_image` argument is deprecated since version "
|
|
206
|
-
"1.7.0 and has no effect. It will be removed in version 1.9.0.",
|
|
207
|
-
FutureWarning,
|
|
208
|
-
)
|
|
209
|
-
|
|
210
166
|
db = mlrun.get_run_db()
|
|
211
167
|
|
|
212
168
|
model_endpoint = get_or_create_model_endpoint(
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
import json
|
|
16
|
-
import posixpath
|
|
17
15
|
import warnings
|
|
18
16
|
from abc import ABC
|
|
19
17
|
from tempfile import NamedTemporaryFile
|
|
@@ -60,7 +58,6 @@ except ModuleNotFoundError:
|
|
|
60
58
|
|
|
61
59
|
if _HAS_EVIDENTLY:
|
|
62
60
|
from evidently.core.report import Snapshot
|
|
63
|
-
from evidently.legacy.ui.storage.local.base import METADATA_PATH, FSLocation
|
|
64
61
|
from evidently.ui.workspace import (
|
|
65
62
|
STR_UUID,
|
|
66
63
|
CloudWorkspace,
|
|
@@ -100,14 +97,13 @@ class EvidentlyModelMonitoringApplicationBase(
|
|
|
100
97
|
self.evidently_project_id = evidently_project_id
|
|
101
98
|
self.evidently_project = self.load_project()
|
|
102
99
|
|
|
103
|
-
def load_project(self) -> Project:
|
|
100
|
+
def load_project(self) -> "Project":
|
|
104
101
|
"""Load the Evidently project."""
|
|
105
102
|
return self.evidently_workspace.get_project(self.evidently_project_id)
|
|
106
103
|
|
|
107
|
-
def get_workspace(self) -> WorkspaceBase:
|
|
104
|
+
def get_workspace(self) -> "WorkspaceBase":
|
|
108
105
|
"""Get the Evidently workspace. Override this method for customize access to the workspace."""
|
|
109
106
|
if self.evidently_workspace_path:
|
|
110
|
-
self._log_location(self.evidently_workspace_path)
|
|
111
107
|
return Workspace.create(self.evidently_workspace_path)
|
|
112
108
|
else:
|
|
113
109
|
raise MLRunValueError(
|
|
@@ -116,44 +112,10 @@ class EvidentlyModelMonitoringApplicationBase(
|
|
|
116
112
|
"`EVIDENTLY_API_KEY` environment variable. In other cases, override this method."
|
|
117
113
|
)
|
|
118
114
|
|
|
119
|
-
def get_cloud_workspace(self) -> CloudWorkspace:
|
|
115
|
+
def get_cloud_workspace(self) -> "CloudWorkspace":
|
|
120
116
|
"""Load the Evidently cloud workspace according to the `EVIDENTLY_API_KEY` environment variable."""
|
|
121
117
|
return CloudWorkspace()
|
|
122
118
|
|
|
123
|
-
@staticmethod
|
|
124
|
-
def _log_location(evidently_workspace_path):
|
|
125
|
-
# TODO remove function + usage after solving issue ML-9530
|
|
126
|
-
location = FSLocation(base_path=evidently_workspace_path)
|
|
127
|
-
location.invalidate_cache("")
|
|
128
|
-
paths = [p for p in location.listdir("") if location.isdir(p)]
|
|
129
|
-
|
|
130
|
-
for path in paths:
|
|
131
|
-
metadata_path = posixpath.join(path, METADATA_PATH)
|
|
132
|
-
full_path = posixpath.join(location.path, metadata_path)
|
|
133
|
-
print(f"evidently json issue, working on path: {full_path}")
|
|
134
|
-
try:
|
|
135
|
-
with location.open(metadata_path) as f:
|
|
136
|
-
content = json.load(f)
|
|
137
|
-
print(
|
|
138
|
-
f"evidently json issue, successful load path: {full_path}, content: {content}"
|
|
139
|
-
)
|
|
140
|
-
except FileNotFoundError:
|
|
141
|
-
print(f"evidently json issue, path not found: {full_path}")
|
|
142
|
-
continue
|
|
143
|
-
except json.decoder.JSONDecodeError as json_error:
|
|
144
|
-
print(
|
|
145
|
-
f"evidently json issue, path got json error, path:{full_path}, error: {json_error}"
|
|
146
|
-
)
|
|
147
|
-
print("evidently json issue, file content:")
|
|
148
|
-
with location.open(metadata_path) as f:
|
|
149
|
-
print(f.read())
|
|
150
|
-
continue
|
|
151
|
-
except Exception as error:
|
|
152
|
-
print(
|
|
153
|
-
f"evidently json issue, path got general error, path:{full_path}, error: {error}"
|
|
154
|
-
)
|
|
155
|
-
continue
|
|
156
|
-
|
|
157
119
|
@staticmethod
|
|
158
120
|
def log_evidently_object(
|
|
159
121
|
monitoring_context: mm_context.MonitoringApplicationContext,
|
|
@@ -251,7 +251,7 @@ class MonitoringApplicationController:
|
|
|
251
251
|
|
|
252
252
|
def __init__(self) -> None:
|
|
253
253
|
"""Initialize Monitoring Application Controller"""
|
|
254
|
-
self.project = cast(str, mlrun.mlconf.
|
|
254
|
+
self.project = cast(str, mlrun.mlconf.active_project)
|
|
255
255
|
self.project_obj = mlrun.get_run_db().get_project(name=self.project)
|
|
256
256
|
logger.debug(f"Initializing {self.__class__.__name__}", project=self.project)
|
|
257
257
|
|
mlrun/model_monitoring/writer.py
CHANGED
|
@@ -129,10 +129,7 @@ class ModelMonitoringWriter(StepToDict):
|
|
|
129
129
|
)
|
|
130
130
|
kind = event.pop(WriterEvent.EVENT_KIND, WriterEventKind.RESULT)
|
|
131
131
|
result_event = _AppResultEvent(json.loads(event.pop(WriterEvent.DATA, "{}")))
|
|
132
|
-
|
|
133
|
-
result_event = _AppResultEvent(event)
|
|
134
|
-
else:
|
|
135
|
-
result_event.update(_AppResultEvent(event))
|
|
132
|
+
result_event.update(_AppResultEvent(event))
|
|
136
133
|
|
|
137
134
|
expected_keys = list(
|
|
138
135
|
set(WriterEvent.list()).difference(
|
mlrun/projects/operations.py
CHANGED
|
@@ -309,9 +309,9 @@ def build_function(
|
|
|
309
309
|
:param force_build: Force building the image, even when no changes were made
|
|
310
310
|
"""
|
|
311
311
|
if not overwrite_build_params:
|
|
312
|
-
# TODO: change overwrite_build_params default to True in 1.
|
|
312
|
+
# TODO: change overwrite_build_params default to True in 1.10.0
|
|
313
313
|
warnings.warn(
|
|
314
|
-
"The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.
|
|
314
|
+
"The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
|
|
315
315
|
mlrun.utils.OverwriteBuildParamsWarning,
|
|
316
316
|
)
|
|
317
317
|
|
|
@@ -340,7 +340,7 @@ def build_function(
|
|
|
340
340
|
skip_deployed=skip_deployed,
|
|
341
341
|
)
|
|
342
342
|
else:
|
|
343
|
-
# TODO: remove filter once overwrite_build_params default is changed to True in 1.
|
|
343
|
+
# TODO: remove filter once overwrite_build_params default is changed to True in 1.10.0
|
|
344
344
|
with warnings.catch_warnings():
|
|
345
345
|
warnings.simplefilter(
|
|
346
346
|
"ignore", category=mlrun.utils.OverwriteBuildParamsWarning
|