mlrun 1.10.0rc15__py3-none-any.whl → 1.10.0rc17__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/llm_prompt.py +6 -0
- mlrun/common/constants.py +3 -0
- mlrun/common/schemas/__init__.py +1 -0
- mlrun/common/schemas/model_monitoring/__init__.py +1 -0
- mlrun/common/schemas/model_monitoring/constants.py +19 -0
- mlrun/common/schemas/serving.py +3 -0
- mlrun/common/schemas/workflow.py +3 -0
- mlrun/config.py +1 -5
- mlrun/db/base.py +7 -0
- mlrun/db/httpdb.py +26 -0
- mlrun/db/nopdb.py +5 -0
- mlrun/launcher/local.py +13 -0
- mlrun/model_monitoring/controller.py +175 -121
- mlrun/model_monitoring/stream_processing.py +29 -2
- mlrun/projects/pipelines.py +44 -24
- mlrun/projects/project.py +7 -3
- mlrun/runtimes/utils.py +0 -2
- mlrun/serving/server.py +125 -38
- mlrun/serving/states.py +119 -62
- mlrun/serving/system_steps.py +100 -64
- mlrun/utils/helpers.py +46 -0
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/METADATA +1 -1
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/RECORD +28 -28
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/WHEEL +0 -0
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/entry_points.txt +0 -0
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/licenses/LICENSE +0 -0
- {mlrun-1.10.0rc15.dist-info → mlrun-1.10.0rc17.dist-info}/top_level.txt +0 -0
mlrun/artifacts/llm_prompt.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import json
|
|
15
15
|
import tempfile
|
|
16
|
+
from collections import defaultdict
|
|
16
17
|
from typing import Optional, Union
|
|
17
18
|
|
|
18
19
|
import mlrun
|
|
@@ -253,3 +254,8 @@ class LLMPromptArtifact(Artifact):
|
|
|
253
254
|
self.spec.prompt_template = None
|
|
254
255
|
self._src_is_temp = True
|
|
255
256
|
super().before_log()
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class PlaceholderDefaultDict(defaultdict):
|
|
260
|
+
def __missing__(self, key):
|
|
261
|
+
return f"{{{key}}}"
|
mlrun/common/constants.py
CHANGED
|
@@ -83,6 +83,9 @@ class MLRunInternalLabels:
|
|
|
83
83
|
mlrun_type = "mlrun__type"
|
|
84
84
|
original_workflow_id = "original-workflow-id"
|
|
85
85
|
workflow_id = "workflow-id"
|
|
86
|
+
retrying = "retrying"
|
|
87
|
+
rerun_counter = "rerun-counter"
|
|
88
|
+
rerun_index = "rerun-index"
|
|
86
89
|
|
|
87
90
|
owner = "owner"
|
|
88
91
|
v3io_user = "v3io_user"
|
mlrun/common/schemas/__init__.py
CHANGED
|
@@ -133,6 +133,7 @@ from .k8s import NodeSelectorOperator, Resources, ResourceSpec
|
|
|
133
133
|
from .memory_reports import MostCommonObjectTypesReport, ObjectTypeReport
|
|
134
134
|
from .model_monitoring import (
|
|
135
135
|
DriftStatus,
|
|
136
|
+
EndpointMode,
|
|
136
137
|
EndpointType,
|
|
137
138
|
EndpointUID,
|
|
138
139
|
EventFieldType,
|
|
@@ -205,6 +205,11 @@ class ControllerEvent(MonitoringStrEnum):
|
|
|
205
205
|
FIRST_REQUEST = "first_request"
|
|
206
206
|
FEATURE_SET_URI = "feature_set_uri"
|
|
207
207
|
ENDPOINT_TYPE = "endpoint_type"
|
|
208
|
+
|
|
209
|
+
# first_timestamp and last_timestamp are used to batch completed events
|
|
210
|
+
FIRST_TIMESTAMP = "first_timestamp"
|
|
211
|
+
LAST_TIMESTAMP = "last_timestamp"
|
|
212
|
+
|
|
208
213
|
ENDPOINT_POLICY = "endpoint_policy"
|
|
209
214
|
# Note: currently under endpoint policy we will have a dictionary including the keys: "application_names"
|
|
210
215
|
# "base_period", and "updated_endpoint" stand for when the MEP was updated
|
|
@@ -219,6 +224,7 @@ class ControllerEventEndpointPolicy(MonitoringStrEnum):
|
|
|
219
224
|
class ControllerEventKind(MonitoringStrEnum):
|
|
220
225
|
NOP_EVENT = "nop_event"
|
|
221
226
|
REGULAR_EVENT = "regular_event"
|
|
227
|
+
BATCH_COMPLETE = "batch_complete"
|
|
222
228
|
|
|
223
229
|
|
|
224
230
|
class MetricData(MonitoringStrEnum):
|
|
@@ -320,6 +326,19 @@ class EndpointType(IntEnum):
|
|
|
320
326
|
def top_level_list(cls):
|
|
321
327
|
return [cls.NODE_EP, cls.ROUTER, cls.BATCH_EP]
|
|
322
328
|
|
|
329
|
+
@classmethod
|
|
330
|
+
def real_time_list(cls):
|
|
331
|
+
return [cls.NODE_EP, cls.ROUTER, cls.LEAF_EP]
|
|
332
|
+
|
|
333
|
+
@classmethod
|
|
334
|
+
def batch_list(cls):
|
|
335
|
+
return [cls.BATCH_EP]
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class EndpointMode(StrEnum):
|
|
339
|
+
REAL_TIME = "real_time"
|
|
340
|
+
BATCH = "batch"
|
|
341
|
+
|
|
323
342
|
|
|
324
343
|
class MonitoringFunctionNames(MonitoringStrEnum):
|
|
325
344
|
STREAM = "model-monitoring-stream"
|
mlrun/common/schemas/serving.py
CHANGED
mlrun/common/schemas/workflow.py
CHANGED
|
@@ -51,6 +51,9 @@ class RerunWorkflowRequest(pydantic.v1.BaseModel):
|
|
|
51
51
|
run_id: typing.Optional[str] = None
|
|
52
52
|
notifications: typing.Optional[list[Notification]] = None
|
|
53
53
|
workflow_runner_node_selector: typing.Optional[dict[str, str]] = None
|
|
54
|
+
original_workflow_runner_uid: typing.Optional[str] = None
|
|
55
|
+
original_workflow_name: typing.Optional[str] = None
|
|
56
|
+
rerun_index: typing.Optional[int] = None
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
class WorkflowResponse(pydantic.v1.BaseModel):
|
mlrun/config.py
CHANGED
|
@@ -406,11 +406,7 @@ default_config = {
|
|
|
406
406
|
#
|
|
407
407
|
# if set to "nil" or "none", nothing would be set
|
|
408
408
|
"modes": (
|
|
409
|
-
"STRICT_TRANS_TABLES"
|
|
410
|
-
",NO_ZERO_IN_DATE"
|
|
411
|
-
",NO_ZERO_DATE"
|
|
412
|
-
",ERROR_FOR_DIVISION_BY_ZERO"
|
|
413
|
-
",NO_ENGINE_SUBSTITUTION",
|
|
409
|
+
"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
|
|
414
410
|
)
|
|
415
411
|
},
|
|
416
412
|
},
|
mlrun/db/base.py
CHANGED
|
@@ -55,6 +55,12 @@ class RunDBInterface(ABC):
|
|
|
55
55
|
def update_run(self, updates: dict, uid, project="", iter=0):
|
|
56
56
|
pass
|
|
57
57
|
|
|
58
|
+
@abstractmethod
|
|
59
|
+
def set_run_retrying_status(
|
|
60
|
+
self, project: str, name: str, run_id: str, retrying: bool
|
|
61
|
+
):
|
|
62
|
+
pass
|
|
63
|
+
|
|
58
64
|
@abstractmethod
|
|
59
65
|
def abort_run(self, uid, project="", iter=0, timeout=45, status_text=""):
|
|
60
66
|
pass
|
|
@@ -735,6 +741,7 @@ class RunDBInterface(ABC):
|
|
|
735
741
|
tsdb_metrics: bool = False,
|
|
736
742
|
metric_list: Optional[list[str]] = None,
|
|
737
743
|
top_level: bool = False,
|
|
744
|
+
mode: Optional[mlrun.common.schemas.EndpointMode] = None,
|
|
738
745
|
uids: Optional[list[str]] = None,
|
|
739
746
|
latest_only: bool = False,
|
|
740
747
|
) -> mlrun.common.schemas.ModelEndpointList:
|
mlrun/db/httpdb.py
CHANGED
|
@@ -3813,6 +3813,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3813
3813
|
tsdb_metrics: bool = False,
|
|
3814
3814
|
metric_list: Optional[list[str]] = None,
|
|
3815
3815
|
top_level: bool = False,
|
|
3816
|
+
mode: mm_constants.EndpointMode = None,
|
|
3816
3817
|
uids: Optional[list[str]] = None,
|
|
3817
3818
|
latest_only: bool = False,
|
|
3818
3819
|
) -> mlrun.common.schemas.ModelEndpointList:
|
|
@@ -3833,6 +3834,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3833
3834
|
If tsdb_metrics=False, this parameter will be ignored and no tsdb metrics
|
|
3834
3835
|
will be included.
|
|
3835
3836
|
:param top_level: Whether to return only top level model endpoints.
|
|
3837
|
+
:param mode: Specifies the mode of the model endpoint. Can be "real-time", "batch", or both if set
|
|
3838
|
+
to None.
|
|
3836
3839
|
:param uids: A list of unique ids to filter by.
|
|
3837
3840
|
:param latest_only: Whether to return only the latest model endpoint version.
|
|
3838
3841
|
:return: A list of model endpoints.
|
|
@@ -3856,6 +3859,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3856
3859
|
"tsdb-metrics": tsdb_metrics,
|
|
3857
3860
|
"metric": metric_list,
|
|
3858
3861
|
"top-level": top_level,
|
|
3862
|
+
"mode": mode,
|
|
3859
3863
|
"uid": uids,
|
|
3860
3864
|
"latest-only": latest_only,
|
|
3861
3865
|
},
|
|
@@ -4741,6 +4745,28 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4741
4745
|
)
|
|
4742
4746
|
return mlrun.common.schemas.GetWorkflowResponse(**response.json())
|
|
4743
4747
|
|
|
4748
|
+
def set_run_retrying_status(
|
|
4749
|
+
self, project: str, name: str, run_id: str, retrying: bool = False
|
|
4750
|
+
):
|
|
4751
|
+
"""
|
|
4752
|
+
Toggle the “retrying” label on a workflow-runner run.
|
|
4753
|
+
|
|
4754
|
+
This will POST to the workflows endpoint to either add or remove the
|
|
4755
|
+
`retrying` flag on a specific run, which prevents parallel retries.
|
|
4756
|
+
|
|
4757
|
+
:param project: The project name under which the workflow is defined.
|
|
4758
|
+
:param name: The workflow name (as in the URL path).
|
|
4759
|
+
:param run_id: The UID of the workflow-runner run to update.
|
|
4760
|
+
:param retrying: True to add the `retrying` label, False to remove it.
|
|
4761
|
+
|
|
4762
|
+
:raises MLRunHTTPError: If the HTTP request fails or returns an error status.
|
|
4763
|
+
"""
|
|
4764
|
+
path = f"projects/{project}/workflows/{name}/runs/{run_id}/set-retry-status"
|
|
4765
|
+
params = {"retrying": retrying}
|
|
4766
|
+
self.api_call(
|
|
4767
|
+
"POST", path, f"set retrying on {project}/{run_id}", params=params
|
|
4768
|
+
)
|
|
4769
|
+
|
|
4744
4770
|
def load_project(
|
|
4745
4771
|
self,
|
|
4746
4772
|
name: str,
|
mlrun/db/nopdb.py
CHANGED
|
@@ -72,6 +72,11 @@ class NopDB(RunDBInterface):
|
|
|
72
72
|
def update_run(self, updates: dict, uid, project="", iter=0):
|
|
73
73
|
pass
|
|
74
74
|
|
|
75
|
+
def set_run_retrying_status(
|
|
76
|
+
self, project: str, name: str, run_id: str, retrying: bool
|
|
77
|
+
):
|
|
78
|
+
pass
|
|
79
|
+
|
|
75
80
|
def abort_run(self, uid, project="", iter=0, timeout=45, status_text=""):
|
|
76
81
|
pass
|
|
77
82
|
|
mlrun/launcher/local.py
CHANGED
|
@@ -276,6 +276,19 @@ class ClientLocalLauncher(launcher.ClientBaseLauncher):
|
|
|
276
276
|
args = sp[1:]
|
|
277
277
|
return command, args
|
|
278
278
|
|
|
279
|
+
def _validate_run(
|
|
280
|
+
self,
|
|
281
|
+
runtime: "mlrun.runtimes.BaseRuntime",
|
|
282
|
+
run: "mlrun.run.RunObject",
|
|
283
|
+
):
|
|
284
|
+
super()._validate_run(runtime, run)
|
|
285
|
+
if self._is_run_local and run.spec.retry.count:
|
|
286
|
+
logger.warning(
|
|
287
|
+
"Retry is not supported for local runs, ignoring retry settings",
|
|
288
|
+
retry=run.spec.retry.to_dict(),
|
|
289
|
+
)
|
|
290
|
+
run.spec.retry.count = 0
|
|
291
|
+
|
|
279
292
|
def _push_notifications(
|
|
280
293
|
self, runobj: "mlrun.run.RunObject", runtime: "mlrun.runtimes.BaseRuntime"
|
|
281
294
|
):
|