mlrun 1.8.0rc2__py3-none-any.whl → 1.8.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/artifacts/__init__.py +1 -0
- mlrun/artifacts/document.py +313 -0
- mlrun/artifacts/manager.py +2 -0
- mlrun/common/schemas/__init__.py +1 -0
- mlrun/common/schemas/constants.py +15 -0
- mlrun/config.py +1 -1
- mlrun/datastore/datastore_profile.py +19 -0
- mlrun/datastore/vectorstore.py +186 -0
- mlrun/db/base.py +10 -0
- mlrun/db/httpdb.py +47 -7
- mlrun/db/nopdb.py +10 -0
- mlrun/execution.py +47 -1
- mlrun/platforms/__init__.py +44 -0
- mlrun/projects/project.py +214 -5
- mlrun/utils/clones.py +1 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/METADATA +5 -5
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/RECORD +22 -20
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/LICENSE +0 -0
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/WHEEL +0 -0
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/entry_points.txt +0 -0
- {mlrun-1.8.0rc2.dist-info → mlrun-1.8.0rc4.dist-info}/top_level.txt +0 -0
mlrun/db/httpdb.py
CHANGED
|
@@ -858,8 +858,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
858
858
|
:param last_update_time_from: Filter by run last update time in ``(last_update_time_from,
|
|
859
859
|
last_update_time_to)``.
|
|
860
860
|
:param last_update_time_to: Filter by run last update time in ``(last_update_time_from, last_update_time_to)``.
|
|
861
|
-
:param partition_by: Field to group results by.
|
|
862
|
-
|
|
861
|
+
:param partition_by: Field to group results by. When `partition_by` is specified, the `partition_sort_by`
|
|
862
|
+
parameter must be provided as well.
|
|
863
863
|
:param rows_per_partition: How many top rows (per sorting defined by `partition_sort_by` and `partition_order`)
|
|
864
864
|
to return per group. Default value is 1.
|
|
865
865
|
:param partition_sort_by: What field to sort the results by, within each partition defined by `partition_by`.
|
|
@@ -1137,6 +1137,16 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1137
1137
|
mlrun.common.formatters.ArtifactFormat
|
|
1138
1138
|
] = mlrun.common.formatters.ArtifactFormat.full,
|
|
1139
1139
|
limit: Optional[int] = None,
|
|
1140
|
+
partition_by: Optional[
|
|
1141
|
+
Union[mlrun.common.schemas.ArtifactPartitionByField, str]
|
|
1142
|
+
] = None,
|
|
1143
|
+
rows_per_partition: int = 1,
|
|
1144
|
+
partition_sort_by: Optional[
|
|
1145
|
+
Union[mlrun.common.schemas.SortField, str]
|
|
1146
|
+
] = mlrun.common.schemas.SortField.updated,
|
|
1147
|
+
partition_order: Union[
|
|
1148
|
+
mlrun.common.schemas.OrderType, str
|
|
1149
|
+
] = mlrun.common.schemas.OrderType.desc,
|
|
1140
1150
|
) -> ArtifactList:
|
|
1141
1151
|
"""List artifacts filtered by various parameters.
|
|
1142
1152
|
|
|
@@ -1178,6 +1188,13 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1178
1188
|
is a workflow id (artifact was created as part of a workflow).
|
|
1179
1189
|
:param format_: The format in which to return the artifacts. Default is 'full'.
|
|
1180
1190
|
:param limit: Maximum number of artifacts to return.
|
|
1191
|
+
:param partition_by: Field to group results by. When `partition_by` is specified, the `partition_sort_by`
|
|
1192
|
+
parameter must be provided as well.
|
|
1193
|
+
:param rows_per_partition: How many top rows (per sorting defined by `partition_sort_by` and `partition_order`)
|
|
1194
|
+
to return per group. Default value is 1.
|
|
1195
|
+
:param partition_sort_by: What field to sort the results by, within each partition defined by `partition_by`.
|
|
1196
|
+
Currently the only allowed values are `created` and `updated`.
|
|
1197
|
+
:param partition_order: Order of sorting within partitions - `asc` or `desc`. Default is `desc`.
|
|
1181
1198
|
"""
|
|
1182
1199
|
|
|
1183
1200
|
artifacts, _ = self._list_artifacts(
|
|
@@ -1195,6 +1212,10 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1195
1212
|
producer_uri=producer_uri,
|
|
1196
1213
|
format_=format_,
|
|
1197
1214
|
limit=limit,
|
|
1215
|
+
partition_by=partition_by,
|
|
1216
|
+
rows_per_partition=rows_per_partition,
|
|
1217
|
+
partition_sort_by=partition_sort_by,
|
|
1218
|
+
partition_order=partition_order,
|
|
1198
1219
|
return_all=True,
|
|
1199
1220
|
)
|
|
1200
1221
|
return artifacts
|
|
@@ -2471,7 +2492,6 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2471
2492
|
|
|
2472
2493
|
@staticmethod
|
|
2473
2494
|
def _generate_partition_by_params(
|
|
2474
|
-
partition_by_cls,
|
|
2475
2495
|
partition_by,
|
|
2476
2496
|
rows_per_partition,
|
|
2477
2497
|
sort_by,
|
|
@@ -2551,7 +2571,6 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2551
2571
|
if partition_by:
|
|
2552
2572
|
params.update(
|
|
2553
2573
|
self._generate_partition_by_params(
|
|
2554
|
-
mlrun.common.schemas.FeatureStorePartitionByField,
|
|
2555
2574
|
partition_by,
|
|
2556
2575
|
rows_per_partition,
|
|
2557
2576
|
partition_sort_by,
|
|
@@ -2776,7 +2795,6 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2776
2795
|
if partition_by:
|
|
2777
2796
|
params.update(
|
|
2778
2797
|
self._generate_partition_by_params(
|
|
2779
|
-
mlrun.common.schemas.FeatureStorePartitionByField,
|
|
2780
2798
|
partition_by,
|
|
2781
2799
|
rows_per_partition,
|
|
2782
2800
|
partition_sort_by,
|
|
@@ -4821,6 +4839,16 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4821
4839
|
mlrun.common.formatters.ArtifactFormat
|
|
4822
4840
|
] = mlrun.common.formatters.ArtifactFormat.full,
|
|
4823
4841
|
limit: Optional[int] = None,
|
|
4842
|
+
partition_by: Optional[
|
|
4843
|
+
Union[mlrun.common.schemas.ArtifactPartitionByField, str]
|
|
4844
|
+
] = None,
|
|
4845
|
+
rows_per_partition: int = 1,
|
|
4846
|
+
partition_sort_by: Optional[
|
|
4847
|
+
Union[mlrun.common.schemas.SortField, str]
|
|
4848
|
+
] = mlrun.common.schemas.SortField.updated,
|
|
4849
|
+
partition_order: Union[
|
|
4850
|
+
mlrun.common.schemas.OrderType, str
|
|
4851
|
+
] = mlrun.common.schemas.OrderType.desc,
|
|
4824
4852
|
page: Optional[int] = None,
|
|
4825
4853
|
page_size: Optional[int] = None,
|
|
4826
4854
|
page_token: Optional[str] = None,
|
|
@@ -4850,6 +4878,15 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4850
4878
|
"page-token": page_token,
|
|
4851
4879
|
}
|
|
4852
4880
|
|
|
4881
|
+
if partition_by:
|
|
4882
|
+
params.update(
|
|
4883
|
+
self._generate_partition_by_params(
|
|
4884
|
+
partition_by,
|
|
4885
|
+
rows_per_partition,
|
|
4886
|
+
partition_sort_by,
|
|
4887
|
+
partition_order,
|
|
4888
|
+
)
|
|
4889
|
+
)
|
|
4853
4890
|
error = "list artifacts"
|
|
4854
4891
|
endpoint_path = f"projects/{project}/artifacts"
|
|
4855
4892
|
|
|
@@ -5012,7 +5049,6 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5012
5049
|
if partition_by:
|
|
5013
5050
|
params.update(
|
|
5014
5051
|
self._generate_partition_by_params(
|
|
5015
|
-
mlrun.common.schemas.RunPartitionByField,
|
|
5016
5052
|
partition_by,
|
|
5017
5053
|
rows_per_partition,
|
|
5018
5054
|
partition_sort_by,
|
|
@@ -5072,7 +5108,11 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5072
5108
|
paginated_responses, token = self.process_paginated_responses(
|
|
5073
5109
|
responses, "activations"
|
|
5074
5110
|
)
|
|
5075
|
-
|
|
5111
|
+
paginated_results = [
|
|
5112
|
+
mlrun.common.schemas.AlertActivation(**item) for item in paginated_responses
|
|
5113
|
+
]
|
|
5114
|
+
|
|
5115
|
+
return paginated_results, token
|
|
5076
5116
|
|
|
5077
5117
|
def _wait_for_background_task_from_response(self, response):
|
|
5078
5118
|
if response.status_code == http.HTTPStatus.ACCEPTED:
|
mlrun/db/nopdb.py
CHANGED
|
@@ -182,6 +182,16 @@ class NopDB(RunDBInterface):
|
|
|
182
182
|
tree: Optional[str] = None,
|
|
183
183
|
format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
|
|
184
184
|
limit: Optional[int] = None,
|
|
185
|
+
partition_by: Optional[
|
|
186
|
+
Union[mlrun.common.schemas.ArtifactPartitionByField, str]
|
|
187
|
+
] = None,
|
|
188
|
+
rows_per_partition: int = 1,
|
|
189
|
+
partition_sort_by: Optional[
|
|
190
|
+
Union[mlrun.common.schemas.SortField, str]
|
|
191
|
+
] = mlrun.common.schemas.SortField.updated,
|
|
192
|
+
partition_order: Union[
|
|
193
|
+
mlrun.common.schemas.OrderType, str
|
|
194
|
+
] = mlrun.common.schemas.OrderType.desc,
|
|
185
195
|
):
|
|
186
196
|
return mlrun.lists.ArtifactList()
|
|
187
197
|
|
mlrun/execution.py
CHANGED
|
@@ -26,7 +26,13 @@ from dateutil import parser
|
|
|
26
26
|
import mlrun
|
|
27
27
|
import mlrun.common.constants as mlrun_constants
|
|
28
28
|
import mlrun.common.formatters
|
|
29
|
-
from mlrun.artifacts import
|
|
29
|
+
from mlrun.artifacts import (
|
|
30
|
+
Artifact,
|
|
31
|
+
DatasetArtifact,
|
|
32
|
+
DocumentArtifact,
|
|
33
|
+
DocumentLoaderSpec,
|
|
34
|
+
ModelArtifact,
|
|
35
|
+
)
|
|
30
36
|
from mlrun.datastore.store_resources import get_store_resource
|
|
31
37
|
from mlrun.errors import MLRunInvalidArgumentError
|
|
32
38
|
|
|
@@ -861,6 +867,46 @@ class MLClientCtx:
|
|
|
861
867
|
self._update_run()
|
|
862
868
|
return item
|
|
863
869
|
|
|
870
|
+
def log_document(
|
|
871
|
+
self,
|
|
872
|
+
key: str,
|
|
873
|
+
artifact_path: Optional[str] = None,
|
|
874
|
+
document_loader: DocumentLoaderSpec = DocumentLoaderSpec(),
|
|
875
|
+
tag: str = "",
|
|
876
|
+
upload: Optional[bool] = False,
|
|
877
|
+
labels: Optional[dict[str, str]] = None,
|
|
878
|
+
**kwargs,
|
|
879
|
+
) -> DocumentArtifact:
|
|
880
|
+
"""
|
|
881
|
+
Log a document as an artifact.
|
|
882
|
+
|
|
883
|
+
:param key: Artifact key
|
|
884
|
+
:param target_path: Path to the local file
|
|
885
|
+
:param artifact_path: Target path for artifact storage
|
|
886
|
+
:param document_loader: Spec to use to load the artifact as langchain document
|
|
887
|
+
:param tag: Version tag
|
|
888
|
+
:param upload: Whether to upload the artifact
|
|
889
|
+
:param labels: Key-value labels
|
|
890
|
+
:param kwargs: Additional keyword arguments
|
|
891
|
+
:return: DocumentArtifact object
|
|
892
|
+
"""
|
|
893
|
+
doc_artifact = DocumentArtifact(
|
|
894
|
+
key=key,
|
|
895
|
+
document_loader=document_loader,
|
|
896
|
+
**kwargs,
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
item = self._artifacts_manager.log_artifact(
|
|
900
|
+
self,
|
|
901
|
+
doc_artifact,
|
|
902
|
+
artifact_path=extend_artifact_path(artifact_path, self.artifact_path),
|
|
903
|
+
tag=tag,
|
|
904
|
+
upload=upload,
|
|
905
|
+
labels=labels,
|
|
906
|
+
)
|
|
907
|
+
self._update_run()
|
|
908
|
+
return item
|
|
909
|
+
|
|
864
910
|
def get_cached_artifact(self, key):
|
|
865
911
|
"""Return a logged artifact from cache (for potential updates)"""
|
|
866
912
|
warnings.warn(
|
mlrun/platforms/__init__.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
import json
|
|
16
|
+
import warnings
|
|
16
17
|
from pprint import pprint
|
|
17
18
|
from time import sleep
|
|
18
19
|
from typing import Optional
|
|
@@ -24,6 +25,49 @@ from .iguazio import (
|
|
|
24
25
|
)
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
class _DeprecationHelper:
|
|
29
|
+
"""A helper class to deprecate old schemas"""
|
|
30
|
+
|
|
31
|
+
def __init__(self, new_target: str, version="1.8.0"):
|
|
32
|
+
self._new_target = new_target
|
|
33
|
+
self._version = version
|
|
34
|
+
|
|
35
|
+
def __call__(self, *args, **kwargs):
|
|
36
|
+
self._warn()
|
|
37
|
+
return self._lazy_load()(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
def __getattr__(self, attr):
|
|
40
|
+
self._warn()
|
|
41
|
+
return getattr(self._lazy_load(), attr)
|
|
42
|
+
|
|
43
|
+
def _lazy_load(self, *args, **kwargs):
|
|
44
|
+
import mlrun.runtimes.mounts as mlrun_mounts
|
|
45
|
+
|
|
46
|
+
return getattr(mlrun_mounts, self._new_target)
|
|
47
|
+
|
|
48
|
+
def _warn(self):
|
|
49
|
+
warnings.warn(
|
|
50
|
+
f"mlrun.platforms.{self._new_target} is deprecated since version {self._version}, "
|
|
51
|
+
f"and will be removed in 1.10. Use mlrun.runtimes.mounts.{self._new_target} instead.",
|
|
52
|
+
FutureWarning,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# TODO: Remove in 1.10
|
|
57
|
+
# For backwards compatibility
|
|
58
|
+
VolumeMount = _DeprecationHelper("VolumeMount")
|
|
59
|
+
auto_mount = _DeprecationHelper("auto_mount")
|
|
60
|
+
mount_configmap = _DeprecationHelper("mount_configmap")
|
|
61
|
+
mount_hostpath = _DeprecationHelper("mount_hostpath")
|
|
62
|
+
mount_pvc = _DeprecationHelper("mount_pvc")
|
|
63
|
+
mount_s3 = _DeprecationHelper("mount_s3")
|
|
64
|
+
mount_secret = _DeprecationHelper("mount_secret")
|
|
65
|
+
mount_v3io = _DeprecationHelper("mount_v3io")
|
|
66
|
+
set_env_variables = _DeprecationHelper("set_env_variables")
|
|
67
|
+
v3io_cred = _DeprecationHelper("v3io_cred")
|
|
68
|
+
# eof 'For backwards compatibility'
|
|
69
|
+
|
|
70
|
+
|
|
27
71
|
def watch_stream(
|
|
28
72
|
url,
|
|
29
73
|
shard_ids: Optional[list] = None,
|
mlrun/projects/project.py
CHANGED
|
@@ -41,6 +41,7 @@ import mlrun.artifacts.model
|
|
|
41
41
|
import mlrun.common.formatters
|
|
42
42
|
import mlrun.common.helpers
|
|
43
43
|
import mlrun.common.runtimes.constants
|
|
44
|
+
import mlrun.common.schemas.alert
|
|
44
45
|
import mlrun.common.schemas.artifact
|
|
45
46
|
import mlrun.common.schemas.model_monitoring.constants as mm_constants
|
|
46
47
|
import mlrun.db
|
|
@@ -58,12 +59,24 @@ import mlrun.utils
|
|
|
58
59
|
import mlrun.utils.regex
|
|
59
60
|
import mlrun_pipelines.common.models
|
|
60
61
|
from mlrun.alerts.alert import AlertConfig
|
|
61
|
-
from mlrun.
|
|
62
|
-
|
|
62
|
+
from mlrun.datastore.datastore_profile import (
|
|
63
|
+
DatastoreProfile,
|
|
64
|
+
DatastoreProfile2Json,
|
|
65
|
+
VectorStoreProfile,
|
|
66
|
+
datastore_profile_read,
|
|
67
|
+
)
|
|
68
|
+
from mlrun.datastore.vectorstore import VectorStoreCollection
|
|
63
69
|
from mlrun.runtimes.nuclio.function import RemoteRuntime
|
|
64
70
|
from mlrun_pipelines.models import PipelineNodeWrapper
|
|
65
71
|
|
|
66
|
-
from ..artifacts import
|
|
72
|
+
from ..artifacts import (
|
|
73
|
+
Artifact,
|
|
74
|
+
ArtifactProducer,
|
|
75
|
+
DatasetArtifact,
|
|
76
|
+
DocumentArtifact,
|
|
77
|
+
DocumentLoaderSpec,
|
|
78
|
+
ModelArtifact,
|
|
79
|
+
)
|
|
67
80
|
from ..artifacts.manager import ArtifactManager, dict_to_artifact, extend_artifact_path
|
|
68
81
|
from ..datastore import store_manager
|
|
69
82
|
from ..features import Feature
|
|
@@ -1520,6 +1533,10 @@ class MlrunProject(ModelObj):
|
|
|
1520
1533
|
is_retained_producer=is_retained_producer,
|
|
1521
1534
|
)
|
|
1522
1535
|
|
|
1536
|
+
def update_artifact(self, artifact_object: Artifact):
|
|
1537
|
+
artifacts_manager = self._get_artifact_manager()
|
|
1538
|
+
artifacts_manager.update_artifact(artifact_object, artifact_object)
|
|
1539
|
+
|
|
1523
1540
|
def _get_artifact_manager(self):
|
|
1524
1541
|
if self._artifact_manager:
|
|
1525
1542
|
return self._artifact_manager
|
|
@@ -1839,6 +1856,72 @@ class MlrunProject(ModelObj):
|
|
|
1839
1856
|
)
|
|
1840
1857
|
return item
|
|
1841
1858
|
|
|
1859
|
+
def get_or_create_vector_store_collection(
|
|
1860
|
+
self,
|
|
1861
|
+
collection_name: str,
|
|
1862
|
+
profile: Union[str, VectorStoreProfile],
|
|
1863
|
+
**kwargs,
|
|
1864
|
+
) -> VectorStoreCollection:
|
|
1865
|
+
"""
|
|
1866
|
+
Create or retrieve a VectorStoreCollection.
|
|
1867
|
+
|
|
1868
|
+
:param collection_name: Name of the collection
|
|
1869
|
+
:param profile: Name of the VectorStoreProfile or a VectorStoreProfile object
|
|
1870
|
+
:param kwargs: Additional arguments for the VectorStoreCollection
|
|
1871
|
+
:return: VectorStoreCollection object
|
|
1872
|
+
"""
|
|
1873
|
+
if isinstance(profile, str):
|
|
1874
|
+
profile = datastore_profile_read(f"ds://{profile}")
|
|
1875
|
+
|
|
1876
|
+
if not isinstance(profile, VectorStoreProfile):
|
|
1877
|
+
raise ValueError(
|
|
1878
|
+
"Profile must be a VectorStoreProfile object or a profile name"
|
|
1879
|
+
)
|
|
1880
|
+
return VectorStoreCollection(
|
|
1881
|
+
profile.vector_store_class,
|
|
1882
|
+
self,
|
|
1883
|
+
profile.name,
|
|
1884
|
+
collection_name,
|
|
1885
|
+
**profile.attributes(kwargs),
|
|
1886
|
+
)
|
|
1887
|
+
|
|
1888
|
+
def log_document(
|
|
1889
|
+
self,
|
|
1890
|
+
key: str,
|
|
1891
|
+
artifact_path: Optional[str] = None,
|
|
1892
|
+
document_loader: DocumentLoaderSpec = DocumentLoaderSpec(),
|
|
1893
|
+
tag: str = "",
|
|
1894
|
+
upload: Optional[bool] = False,
|
|
1895
|
+
labels: Optional[dict[str, str]] = None,
|
|
1896
|
+
**kwargs,
|
|
1897
|
+
) -> DocumentArtifact:
|
|
1898
|
+
"""
|
|
1899
|
+
Log a document as an artifact.
|
|
1900
|
+
|
|
1901
|
+
:param key: Artifact key
|
|
1902
|
+
:param target_path: Path to the local file
|
|
1903
|
+
:param artifact_path: Target path for artifact storage
|
|
1904
|
+
:param document_loader: Spec to use to load the artifact as langchain document
|
|
1905
|
+
:param tag: Version tag
|
|
1906
|
+
:param upload: Whether to upload the artifact
|
|
1907
|
+
:param labels: Key-value labels
|
|
1908
|
+
:param kwargs: Additional keyword arguments
|
|
1909
|
+
:return: DocumentArtifact object
|
|
1910
|
+
"""
|
|
1911
|
+
doc_artifact = DocumentArtifact(
|
|
1912
|
+
key=key,
|
|
1913
|
+
document_loader=document_loader,
|
|
1914
|
+
**kwargs,
|
|
1915
|
+
)
|
|
1916
|
+
|
|
1917
|
+
return self.log_artifact(
|
|
1918
|
+
doc_artifact,
|
|
1919
|
+
artifact_path=artifact_path,
|
|
1920
|
+
tag=tag,
|
|
1921
|
+
upload=upload,
|
|
1922
|
+
labels=labels,
|
|
1923
|
+
)
|
|
1924
|
+
|
|
1842
1925
|
def import_artifact(
|
|
1843
1926
|
self, item_path: str, new_key=None, artifact_path=None, tag=None
|
|
1844
1927
|
):
|
|
@@ -3858,6 +3941,16 @@ class MlrunProject(ModelObj):
|
|
|
3858
3941
|
format_: Optional[
|
|
3859
3942
|
mlrun.common.formatters.ArtifactFormat
|
|
3860
3943
|
] = mlrun.common.formatters.ArtifactFormat.full,
|
|
3944
|
+
partition_by: Optional[
|
|
3945
|
+
Union[mlrun.common.schemas.ArtifactPartitionByField, str]
|
|
3946
|
+
] = None,
|
|
3947
|
+
rows_per_partition: int = 1,
|
|
3948
|
+
partition_sort_by: Optional[
|
|
3949
|
+
Union[mlrun.common.schemas.SortField, str]
|
|
3950
|
+
] = mlrun.common.schemas.SortField.updated,
|
|
3951
|
+
partition_order: Union[
|
|
3952
|
+
mlrun.common.schemas.OrderType, str
|
|
3953
|
+
] = mlrun.common.schemas.OrderType.desc,
|
|
3861
3954
|
) -> mlrun.lists.ArtifactList:
|
|
3862
3955
|
"""List artifacts filtered by various parameters.
|
|
3863
3956
|
|
|
@@ -3894,6 +3987,13 @@ class MlrunProject(ModelObj):
|
|
|
3894
3987
|
:param tree: Return artifacts of the requested tree.
|
|
3895
3988
|
:param limit: Maximum number of artifacts to return.
|
|
3896
3989
|
:param format_: The format in which to return the artifacts. Default is 'full'.
|
|
3990
|
+
:param partition_by: Field to group results by. When `partition_by` is specified, the `partition_sort_by`
|
|
3991
|
+
parameter must be provided as well.
|
|
3992
|
+
:param rows_per_partition: How many top rows (per sorting defined by `partition_sort_by` and `partition_order`)
|
|
3993
|
+
to return per group. Default value is 1.
|
|
3994
|
+
:param partition_sort_by: What field to sort the results by, within each partition defined by `partition_by`.
|
|
3995
|
+
Currently the only allowed values are `created` and `updated`.
|
|
3996
|
+
:param partition_order: Order of sorting within partitions - `asc` or `desc`. Default is `desc`.
|
|
3897
3997
|
"""
|
|
3898
3998
|
db = mlrun.db.get_run_db(secrets=self._secrets)
|
|
3899
3999
|
return db.list_artifacts(
|
|
@@ -3910,6 +4010,10 @@ class MlrunProject(ModelObj):
|
|
|
3910
4010
|
tree=tree,
|
|
3911
4011
|
format_=format_,
|
|
3912
4012
|
limit=limit,
|
|
4013
|
+
partition_by=partition_by,
|
|
4014
|
+
rows_per_partition=rows_per_partition,
|
|
4015
|
+
partition_sort_by=partition_sort_by,
|
|
4016
|
+
partition_order=partition_order,
|
|
3913
4017
|
)
|
|
3914
4018
|
|
|
3915
4019
|
def paginated_list_artifacts(
|
|
@@ -4616,7 +4720,9 @@ class MlrunProject(ModelObj):
|
|
|
4616
4720
|
alert_name = alert_data.name
|
|
4617
4721
|
db.reset_alert_config(alert_name, self.metadata.name)
|
|
4618
4722
|
|
|
4619
|
-
def get_alert_template(
|
|
4723
|
+
def get_alert_template(
|
|
4724
|
+
self, template_name: str
|
|
4725
|
+
) -> mlrun.common.schemas.alert.AlertTemplate:
|
|
4620
4726
|
"""
|
|
4621
4727
|
Retrieve a specific alert template.
|
|
4622
4728
|
|
|
@@ -4626,7 +4732,7 @@ class MlrunProject(ModelObj):
|
|
|
4626
4732
|
db = mlrun.db.get_run_db(secrets=self._secrets)
|
|
4627
4733
|
return db.get_alert_template(template_name)
|
|
4628
4734
|
|
|
4629
|
-
def list_alert_templates(self) -> list[AlertTemplate]:
|
|
4735
|
+
def list_alert_templates(self) -> list[mlrun.common.schemas.alert.AlertTemplate]:
|
|
4630
4736
|
"""
|
|
4631
4737
|
Retrieve list of all alert templates.
|
|
4632
4738
|
|
|
@@ -4635,6 +4741,109 @@ class MlrunProject(ModelObj):
|
|
|
4635
4741
|
db = mlrun.db.get_run_db(secrets=self._secrets)
|
|
4636
4742
|
return db.list_alert_templates()
|
|
4637
4743
|
|
|
4744
|
+
def list_alert_activations(
|
|
4745
|
+
self,
|
|
4746
|
+
name: Optional[str] = None,
|
|
4747
|
+
since: Optional[datetime.datetime] = None,
|
|
4748
|
+
until: Optional[datetime.datetime] = None,
|
|
4749
|
+
entity: Optional[str] = None,
|
|
4750
|
+
severity: Optional[
|
|
4751
|
+
list[Union[mlrun.common.schemas.alert.AlertSeverity, str]]
|
|
4752
|
+
] = None,
|
|
4753
|
+
entity_kind: Optional[
|
|
4754
|
+
Union[mlrun.common.schemas.alert.EventEntityKind, str]
|
|
4755
|
+
] = None,
|
|
4756
|
+
event_kind: Optional[Union[mlrun.common.schemas.alert.EventKind, str]] = None,
|
|
4757
|
+
) -> list[mlrun.common.schemas.alert.AlertActivation]:
|
|
4758
|
+
"""
|
|
4759
|
+
Retrieve a list of alert activations for a project.
|
|
4760
|
+
|
|
4761
|
+
:param name: The alert name to filter by. Supports exact matching or partial matching if prefixed with `~`.
|
|
4762
|
+
:param since: Filters for alert activations occurring after this timestamp.
|
|
4763
|
+
:param until: Filters for alert activations occurring before this timestamp.
|
|
4764
|
+
:param entity: The entity ID to filter by. Supports wildcard matching if prefixed with `~`.
|
|
4765
|
+
:param severity: A list of severity levels to filter by (e.g., ["high", "low"]).
|
|
4766
|
+
:param entity_kind: The kind of entity (e.g., "job", "endpoint") to filter by.
|
|
4767
|
+
:param event_kind: The kind of event (e.g., ""data-drift-detected"", "failed") to filter by.
|
|
4768
|
+
|
|
4769
|
+
:returns: A list of alert activations matching the provided filters.
|
|
4770
|
+
"""
|
|
4771
|
+
db = mlrun.db.get_run_db(secrets=self._secrets)
|
|
4772
|
+
return db.list_alert_activations(
|
|
4773
|
+
project=self.metadata.name,
|
|
4774
|
+
name=name,
|
|
4775
|
+
since=since,
|
|
4776
|
+
until=until,
|
|
4777
|
+
entity=entity,
|
|
4778
|
+
severity=severity,
|
|
4779
|
+
entity_kind=entity_kind,
|
|
4780
|
+
event_kind=event_kind,
|
|
4781
|
+
)
|
|
4782
|
+
|
|
4783
|
+
def paginated_list_alert_activations(
|
|
4784
|
+
self,
|
|
4785
|
+
*args,
|
|
4786
|
+
page: Optional[int] = None,
|
|
4787
|
+
page_size: Optional[int] = None,
|
|
4788
|
+
page_token: Optional[str] = None,
|
|
4789
|
+
**kwargs,
|
|
4790
|
+
) -> tuple[mlrun.common.schemas.alert.AlertActivation, Optional[str]]:
|
|
4791
|
+
"""
|
|
4792
|
+
List alerts activations with support for pagination and various filtering options.
|
|
4793
|
+
|
|
4794
|
+
This method retrieves a paginated list of alert activations based on the specified filter parameters.
|
|
4795
|
+
Pagination is controlled using the `page`, `page_size`, and `page_token` parameters. The method
|
|
4796
|
+
will return a list of alert activations that match the filtering criteria provided.
|
|
4797
|
+
|
|
4798
|
+
For detailed information about the parameters, refer to the list_alert_activations method:
|
|
4799
|
+
See :py:func:`~list_alert_activations` for more details.
|
|
4800
|
+
|
|
4801
|
+
Examples::
|
|
4802
|
+
|
|
4803
|
+
# Fetch first page of alert activations with page size of 5
|
|
4804
|
+
alert_activations, token = project.paginated_list_alert_activations(page_size=5)
|
|
4805
|
+
# Fetch next page using the pagination token from the previous response
|
|
4806
|
+
alert_activations, token = project.paginated_list_alert_activations(
|
|
4807
|
+
page_token=token
|
|
4808
|
+
)
|
|
4809
|
+
# Fetch alert activations for a specific page (e.g., page 3)
|
|
4810
|
+
alert_activations, token = project.paginated_list_alert_activations(
|
|
4811
|
+
page=3, page_size=5
|
|
4812
|
+
)
|
|
4813
|
+
|
|
4814
|
+
# Automatically iterate over all pages without explicitly specifying the page number
|
|
4815
|
+
alert_activations = []
|
|
4816
|
+
token = None
|
|
4817
|
+
while True:
|
|
4818
|
+
page_alert_activations, token = project.paginated_list_alert_activations(
|
|
4819
|
+
page_token=token, page_size=5
|
|
4820
|
+
)
|
|
4821
|
+
alert_activations.extend(page_alert_activations)
|
|
4822
|
+
|
|
4823
|
+
# If token is None and page_alert_activations is empty, we've reached the end (no more activations).
|
|
4824
|
+
# If token is None and page_alert_activations is not empty, we've fetched the last page of activations.
|
|
4825
|
+
if not token:
|
|
4826
|
+
break
|
|
4827
|
+
print(f"Total alert activations retrieved: {len(alert_activations)}")
|
|
4828
|
+
|
|
4829
|
+
:param page: The page number to retrieve. If not provided, the next page will be retrieved.
|
|
4830
|
+
:param page_size: The number of items per page to retrieve. Up to `page_size` responses are expected.
|
|
4831
|
+
:param page_token: A pagination token used to retrieve the next page of results. Should not be provided
|
|
4832
|
+
for the first request.
|
|
4833
|
+
|
|
4834
|
+
:returns: A tuple containing the list of alert activations and an optional `page_token` for pagination.
|
|
4835
|
+
"""
|
|
4836
|
+
db = mlrun.db.get_run_db(secrets=self._secrets)
|
|
4837
|
+
return db.paginated_list_alert_activations(
|
|
4838
|
+
*args,
|
|
4839
|
+
project=self.metadata.name,
|
|
4840
|
+
page=page,
|
|
4841
|
+
page_size=page_size,
|
|
4842
|
+
page_token=page_token,
|
|
4843
|
+
return_all=False,
|
|
4844
|
+
**kwargs,
|
|
4845
|
+
)
|
|
4846
|
+
|
|
4638
4847
|
def _run_authenticated_git_action(
|
|
4639
4848
|
self,
|
|
4640
4849
|
action: Callable,
|
mlrun/utils/clones.py
CHANGED
|
@@ -122,7 +122,7 @@ def add_credentials_git_remote_url(url: str, secrets=None) -> tuple[str, bool]:
|
|
|
122
122
|
username, password = get_git_username_password_from_token(token)
|
|
123
123
|
|
|
124
124
|
if username:
|
|
125
|
-
return f"https://{username}:{password}@{url_obj.
|
|
125
|
+
return f"https://{username}:{password}@{url_obj.netloc}{url_obj.path}", True
|
|
126
126
|
return url, False
|
|
127
127
|
|
|
128
128
|
|
mlrun/utils/version/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mlrun
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.0rc4
|
|
4
4
|
Summary: Tracking and config of machine learning runs
|
|
5
5
|
Home-page: https://github.com/mlrun/mlrun
|
|
6
6
|
Author: Yaron Haviv
|
|
@@ -50,8 +50,8 @@ Requires-Dist: setuptools>=75.2
|
|
|
50
50
|
Requires-Dist: deprecated~=1.2
|
|
51
51
|
Requires-Dist: jinja2>=3.1.3,~=3.1
|
|
52
52
|
Requires-Dist: orjson<4,>=3.9.15
|
|
53
|
-
Requires-Dist: mlrun-pipelines-kfp-common~=0.2.
|
|
54
|
-
Requires-Dist: mlrun-pipelines-kfp-v1-8~=0.2.
|
|
53
|
+
Requires-Dist: mlrun-pipelines-kfp-common~=0.2.3
|
|
54
|
+
Requires-Dist: mlrun-pipelines-kfp-v1-8~=0.2.2
|
|
55
55
|
Requires-Dist: docstring_parser~=0.16
|
|
56
56
|
Requires-Dist: aiosmtplib~=3.0
|
|
57
57
|
Provides-Extra: s3
|
|
@@ -104,7 +104,7 @@ Requires-Dist: snowflake-connector-python~=3.7; extra == "snowflake"
|
|
|
104
104
|
Provides-Extra: api
|
|
105
105
|
Requires-Dist: uvicorn~=0.27.1; extra == "api"
|
|
106
106
|
Requires-Dist: dask-kubernetes~=0.11.0; extra == "api"
|
|
107
|
-
Requires-Dist: apscheduler<4,>=3.
|
|
107
|
+
Requires-Dist: apscheduler<4,>=3.11; extra == "api"
|
|
108
108
|
Requires-Dist: objgraph~=3.6; extra == "api"
|
|
109
109
|
Requires-Dist: igz-mgmt~=0.4.1; extra == "api"
|
|
110
110
|
Requires-Dist: humanfriendly~=10.0; extra == "api"
|
|
@@ -181,7 +181,7 @@ Requires-Dist: adlfs==2023.9.0; extra == "complete-api"
|
|
|
181
181
|
Requires-Dist: aiobotocore<2.16,>=2.5.0; extra == "complete-api"
|
|
182
182
|
Requires-Dist: aiosmtplib~=3.0; extra == "complete-api"
|
|
183
183
|
Requires-Dist: alembic~=1.9; extra == "complete-api"
|
|
184
|
-
Requires-Dist: apscheduler<4,>=3.
|
|
184
|
+
Requires-Dist: apscheduler<4,>=3.11; extra == "complete-api"
|
|
185
185
|
Requires-Dist: avro~=1.11; extra == "complete-api"
|
|
186
186
|
Requires-Dist: azure-core~=1.24; extra == "complete-api"
|
|
187
187
|
Requires-Dist: azure-identity~=1.5; extra == "complete-api"
|