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/db/httpdb.py
CHANGED
|
@@ -88,9 +88,9 @@ class HTTPRunDB(RunDBInterface):
|
|
|
88
88
|
|
|
89
89
|
- Every object in MLRun exists in the context of a project (except projects themselves). When referencing an object
|
|
90
90
|
through any API, a project name must be provided. The default for most APIs is for an empty project name, which
|
|
91
|
-
will be replaced by the name of the
|
|
91
|
+
will be replaced by the name of the active project (if set). Therefore, if performing an API to
|
|
92
92
|
list functions, for example, and not providing a project name - the result will not be functions from all
|
|
93
|
-
projects but rather from the
|
|
93
|
+
projects but rather from the active project.
|
|
94
94
|
- Many objects can be assigned labels, and listed/queried by label. The label parameter for query APIs allows for
|
|
95
95
|
listing objects that:
|
|
96
96
|
|
|
@@ -398,7 +398,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
398
398
|
)
|
|
399
399
|
|
|
400
400
|
def _path_of(self, resource, project, uid=None):
|
|
401
|
-
project = project or config.
|
|
401
|
+
project = project or config.active_project
|
|
402
402
|
_path = f"projects/{project}/{resource}"
|
|
403
403
|
if uid:
|
|
404
404
|
_path += f"/{uid}"
|
|
@@ -733,7 +733,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
733
733
|
Abort a running run - will remove the run's runtime resources and mark its state as aborted.
|
|
734
734
|
:returns: :py:class:`~mlrun.common.schemas.BackgroundTask`.
|
|
735
735
|
"""
|
|
736
|
-
project = project or config.
|
|
736
|
+
project = project or config.active_project
|
|
737
737
|
params = {"iter": iter}
|
|
738
738
|
updates = {}
|
|
739
739
|
if status_text:
|
|
@@ -768,7 +768,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
768
768
|
:param project: Project that the run belongs to.
|
|
769
769
|
:returns: :py:class:`~mlrun.common.schemas.BackgroundTask`.
|
|
770
770
|
"""
|
|
771
|
-
project = project or config.
|
|
771
|
+
project = project or config.active_project
|
|
772
772
|
response = self.api_call(
|
|
773
773
|
"POST",
|
|
774
774
|
path=f"projects/{project}/runs/{uid}/push-notifications",
|
|
@@ -821,7 +821,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
821
821
|
"The 'notifications' parameter must be a list."
|
|
822
822
|
)
|
|
823
823
|
|
|
824
|
-
project = project or config.
|
|
824
|
+
project = project or config.active_project
|
|
825
825
|
|
|
826
826
|
response = self.api_call(
|
|
827
827
|
"POST",
|
|
@@ -939,7 +939,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
939
939
|
|
|
940
940
|
:param name: Name of the run to retrieve.
|
|
941
941
|
:param uid: Unique ID of the run, or a list of run UIDs.
|
|
942
|
-
:param project: Project that the runs belongs to. If not specified, the
|
|
942
|
+
:param project: Project that the runs belongs to. If not specified, the active project will be used.
|
|
943
943
|
:param labels: Filter runs by label key-value pairs or key existence. This can be provided as:
|
|
944
944
|
- A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
|
|
945
945
|
or `{"label": None}` to check for key existence.
|
|
@@ -947,7 +947,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
947
947
|
or just `"label"` for key existence.
|
|
948
948
|
- A comma-separated string formatted as `"label1=value1,label2"` to match entities with
|
|
949
949
|
the specified key-value pairs or key existence.
|
|
950
|
-
:param state: Deprecated - List only runs whose state is specified (will be removed in 1.
|
|
950
|
+
:param state: Deprecated - List only runs whose state is specified (will be removed in 1.10.0)
|
|
951
951
|
:param states: List only runs whose state is one of the provided states.
|
|
952
952
|
:param sort: Whether to sort the result according to their start time. Otherwise, results will be
|
|
953
953
|
returned by their internal order in the DB (order will not be guaranteed).
|
|
@@ -1080,7 +1080,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1080
1080
|
:param days_ago: Filter runs whose start time is newer than this parameter.
|
|
1081
1081
|
"""
|
|
1082
1082
|
|
|
1083
|
-
project = project or config.
|
|
1083
|
+
project = project or config.active_project
|
|
1084
1084
|
labels = self._parse_labels(labels)
|
|
1085
1085
|
params = {
|
|
1086
1086
|
"name": name,
|
|
@@ -1113,7 +1113,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1113
1113
|
:param tree: The tree (producer id) which generated this artifact.
|
|
1114
1114
|
:returns: The stored artifact dictionary.
|
|
1115
1115
|
"""
|
|
1116
|
-
project = project or mlrun.mlconf.
|
|
1116
|
+
project = project or mlrun.mlconf.active_project
|
|
1117
1117
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1118
1118
|
|
|
1119
1119
|
error = f"store artifact {project}/{key}"
|
|
@@ -1153,7 +1153,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1153
1153
|
:param format_: The format in which to return the artifact. Default is 'full'.
|
|
1154
1154
|
"""
|
|
1155
1155
|
|
|
1156
|
-
project = project or mlrun.mlconf.
|
|
1156
|
+
project = project or mlrun.mlconf.active_project
|
|
1157
1157
|
tag = tag or "latest"
|
|
1158
1158
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1159
1159
|
error = f"read artifact {project}/{key}"
|
|
@@ -1191,7 +1191,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1191
1191
|
:param deletion_strategy: The artifact deletion strategy types.
|
|
1192
1192
|
:param secrets: Credentials needed to access the artifact data.
|
|
1193
1193
|
"""
|
|
1194
|
-
project = project or mlrun.mlconf.
|
|
1194
|
+
project = project or mlrun.mlconf.active_project
|
|
1195
1195
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1196
1196
|
params = {
|
|
1197
1197
|
"key": key,
|
|
@@ -1225,6 +1225,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1225
1225
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
1226
1226
|
tree: Optional[str] = None,
|
|
1227
1227
|
producer_uri: Optional[str] = None,
|
|
1228
|
+
parent: Optional[str] = None,
|
|
1228
1229
|
format_: Optional[
|
|
1229
1230
|
mlrun.common.formatters.ArtifactFormat
|
|
1230
1231
|
] = mlrun.common.formatters.ArtifactFormat.full,
|
|
@@ -1253,6 +1254,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1253
1254
|
"results", tag="*", project="iris", labels=["uploaded", "type=binary"]
|
|
1254
1255
|
)
|
|
1255
1256
|
|
|
1257
|
+
:param parent: The URI or <parent_name>:<parent_tag> string of the parent artifact.
|
|
1258
|
+
Used to filter and return only artifacts that are direct children of the specified parent.
|
|
1256
1259
|
:param name: Name of artifacts to retrieve. Name with '~' prefix is used as a like query, and is not
|
|
1257
1260
|
case-sensitive. This means that querying for ``~name`` may return artifacts named
|
|
1258
1261
|
``my_Name_1`` or ``surname``.
|
|
@@ -1309,6 +1312,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1309
1312
|
partition_sort_by=partition_sort_by,
|
|
1310
1313
|
partition_order=partition_order,
|
|
1311
1314
|
return_all=not limit,
|
|
1315
|
+
parent=parent,
|
|
1312
1316
|
)
|
|
1313
1317
|
return artifacts
|
|
1314
1318
|
|
|
@@ -1402,7 +1406,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1402
1406
|
:param days_ago: This parameter is deprecated and not used.
|
|
1403
1407
|
:param tree: Delete artifacts filtered by tree.
|
|
1404
1408
|
"""
|
|
1405
|
-
project = project or config.
|
|
1409
|
+
project = project or config.active_project
|
|
1406
1410
|
labels = self._parse_labels(labels)
|
|
1407
1411
|
|
|
1408
1412
|
params = {
|
|
@@ -1423,7 +1427,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1423
1427
|
) -> list[str]:
|
|
1424
1428
|
"""Return a list of all the tags assigned to artifacts in the scope of the given project."""
|
|
1425
1429
|
|
|
1426
|
-
project = project or config.
|
|
1430
|
+
project = project or config.active_project
|
|
1427
1431
|
error_message = f"Failed listing artifact tags. project={project}"
|
|
1428
1432
|
params = {"category": category} if category else {}
|
|
1429
1433
|
|
|
@@ -1446,7 +1450,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1446
1450
|
function = function.to_dict()
|
|
1447
1451
|
|
|
1448
1452
|
params = {"tag": tag, "versioned": versioned}
|
|
1449
|
-
project = project or config.
|
|
1453
|
+
project = project or config.active_project
|
|
1450
1454
|
path = f"projects/{project}/functions/{name}"
|
|
1451
1455
|
|
|
1452
1456
|
error = f"store function {project}/{name}"
|
|
@@ -1461,7 +1465,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1461
1465
|
"""Retrieve details of a specific function, identified by its name and potentially a tag or function hash."""
|
|
1462
1466
|
|
|
1463
1467
|
params = {"tag": tag, "hash_key": hash_key}
|
|
1464
|
-
project = project or config.
|
|
1468
|
+
project = project or config.active_project
|
|
1465
1469
|
path = f"projects/{project}/functions/{name}"
|
|
1466
1470
|
error = f"get function {project}/{name}"
|
|
1467
1471
|
resp = self.api_call("GET", path, error, params=params)
|
|
@@ -1470,7 +1474,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1470
1474
|
def delete_function(self, name: str, project: str = ""):
|
|
1471
1475
|
"""Delete a function belonging to a specific project."""
|
|
1472
1476
|
|
|
1473
|
-
project = project or config.
|
|
1477
|
+
project = project or config.active_project
|
|
1474
1478
|
path = f"projects/{project}/functions/{name}"
|
|
1475
1479
|
error_message = f"Failed deleting function {project}/{name}"
|
|
1476
1480
|
response = self.api_call("DELETE", path, error_message, version="v2")
|
|
@@ -1515,7 +1519,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1515
1519
|
"""Retrieve a list of functions, filtered by specific criteria.
|
|
1516
1520
|
|
|
1517
1521
|
:param name: Return only functions with a specific name.
|
|
1518
|
-
:param project: Return functions belonging to this project. If not specified, the
|
|
1522
|
+
:param project: Return functions belonging to this project. If not specified, the active project is used.
|
|
1519
1523
|
:param tag: Return function versions with specific tags. To return only tagged functions, set tag to ``"*"``.
|
|
1520
1524
|
:param labels: Filter functions by label key-value pairs or key existence. This can be provided as:
|
|
1521
1525
|
- A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
|
|
@@ -1740,7 +1744,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1740
1744
|
):
|
|
1741
1745
|
"""Update an existing schedule, replace it with the details contained in the schedule object."""
|
|
1742
1746
|
|
|
1743
|
-
project = project or config.
|
|
1747
|
+
project = project or config.active_project
|
|
1744
1748
|
path = f"projects/{project}/schedules/{name}"
|
|
1745
1749
|
|
|
1746
1750
|
error_message = f"Failed updating schedule {project}/{name}"
|
|
@@ -1758,7 +1762,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1758
1762
|
:param include_last_run: Whether to include the results of the schedule's last run in the response.
|
|
1759
1763
|
"""
|
|
1760
1764
|
|
|
1761
|
-
project = project or config.
|
|
1765
|
+
project = project or config.active_project
|
|
1762
1766
|
path = f"projects/{project}/schedules/{name}"
|
|
1763
1767
|
error_message = f"Failed getting schedule for {project}/{name}"
|
|
1764
1768
|
resp = self.api_call(
|
|
@@ -1786,7 +1790,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1786
1790
|
:param next_run_time_until: Return only schedules with next run time before this date.
|
|
1787
1791
|
"""
|
|
1788
1792
|
|
|
1789
|
-
project = project or config.
|
|
1793
|
+
project = project or config.active_project
|
|
1790
1794
|
params = {
|
|
1791
1795
|
"kind": kind,
|
|
1792
1796
|
"name": name,
|
|
@@ -1802,7 +1806,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1802
1806
|
def delete_schedule(self, project: str, name: str):
|
|
1803
1807
|
"""Delete a specific schedule by name."""
|
|
1804
1808
|
|
|
1805
|
-
project = project or config.
|
|
1809
|
+
project = project or config.active_project
|
|
1806
1810
|
path = f"projects/{project}/schedules/{name}"
|
|
1807
1811
|
error_message = f"Failed deleting schedule {project}/{name}"
|
|
1808
1812
|
self.api_call("DELETE", path, error_message)
|
|
@@ -1810,7 +1814,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1810
1814
|
def invoke_schedule(self, project: str, name: str):
|
|
1811
1815
|
"""Execute the object referenced by the schedule immediately."""
|
|
1812
1816
|
|
|
1813
|
-
project = project or config.
|
|
1817
|
+
project = project or config.active_project
|
|
1814
1818
|
path = f"projects/{project}/schedules/{name}/invoke"
|
|
1815
1819
|
error_message = f"Failed invoking schedule {project}/{name}"
|
|
1816
1820
|
self.api_call("POST", path, error_message)
|
|
@@ -1871,7 +1875,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1871
1875
|
:param func: Function to build.
|
|
1872
1876
|
:param builder_env: Kaniko builder pod env vars dict (for config/credentials)
|
|
1873
1877
|
"""
|
|
1874
|
-
func.metadata.project = func.metadata.project or config.
|
|
1878
|
+
func.metadata.project = func.metadata.project or config.active_project
|
|
1875
1879
|
self.warn_on_s3_and_ecr_permissions_conflict(func)
|
|
1876
1880
|
try:
|
|
1877
1881
|
req = {
|
|
@@ -2057,7 +2061,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2057
2061
|
) -> mlrun.common.schemas.BackgroundTask:
|
|
2058
2062
|
"""Retrieve updated information on a project background task being executed."""
|
|
2059
2063
|
|
|
2060
|
-
project = project or config.
|
|
2064
|
+
project = project or config.active_project
|
|
2061
2065
|
path = f"projects/{project}/background-tasks/{name}"
|
|
2062
2066
|
error_message = (
|
|
2063
2067
|
f"Failed getting project background task. project={project}, name={name}"
|
|
@@ -2078,7 +2082,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2078
2082
|
Retrieve updated information on project background tasks being executed.
|
|
2079
2083
|
If no filter is provided, will return background tasks from the last week.
|
|
2080
2084
|
|
|
2081
|
-
:param project: Project name (defaults to mlrun.mlconf.
|
|
2085
|
+
:param project: Project name (defaults to mlrun.mlconf.active_project).
|
|
2082
2086
|
:param state: List only background tasks whose state is specified.
|
|
2083
2087
|
:param created_from: Filter by background task created time in ``[created_from, created_to]``.
|
|
2084
2088
|
:param created_to: Filter by background task created time in ``[created_from, created_to]``.
|
|
@@ -2087,7 +2091,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2087
2091
|
:param last_update_time_to: Filter by background task last update time in
|
|
2088
2092
|
``(last_update_time_from, last_update_time_to)``.
|
|
2089
2093
|
"""
|
|
2090
|
-
project = project or config.
|
|
2094
|
+
project = project or config.active_project
|
|
2091
2095
|
if (
|
|
2092
2096
|
not state
|
|
2093
2097
|
and not created_from
|
|
@@ -2439,7 +2443,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2439
2443
|
project = (
|
|
2440
2444
|
project
|
|
2441
2445
|
or feature_set["metadata"].get("project", None)
|
|
2442
|
-
or config.
|
|
2446
|
+
or config.active_project
|
|
2443
2447
|
)
|
|
2444
2448
|
path = f"projects/{project}/feature-sets"
|
|
2445
2449
|
params = {"versioned": versioned}
|
|
@@ -2471,7 +2475,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2471
2475
|
:param uid: uid of the object to retrieve (can only be used for versioned objects).
|
|
2472
2476
|
"""
|
|
2473
2477
|
|
|
2474
|
-
project = project or config.
|
|
2478
|
+
project = project or config.active_project
|
|
2475
2479
|
reference = self._resolve_reference(tag, uid)
|
|
2476
2480
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
2477
2481
|
error_message = f"Failed retrieving feature-set {project}/{name}"
|
|
@@ -2507,7 +2511,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2507
2511
|
of the feature-set.
|
|
2508
2512
|
"""
|
|
2509
2513
|
|
|
2510
|
-
project = project or config.
|
|
2514
|
+
project = project or config.active_project
|
|
2511
2515
|
labels = self._parse_labels(labels)
|
|
2512
2516
|
params = {
|
|
2513
2517
|
"name": name,
|
|
@@ -2549,7 +2553,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2549
2553
|
:returns: A list of features, and a list of their corresponding feature sets.
|
|
2550
2554
|
"""
|
|
2551
2555
|
|
|
2552
|
-
project = project or config.
|
|
2556
|
+
project = project or config.active_project
|
|
2553
2557
|
labels = self._parse_labels(labels)
|
|
2554
2558
|
params = {
|
|
2555
2559
|
"name": name,
|
|
@@ -2588,7 +2592,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2588
2592
|
:returns: A list of entities.
|
|
2589
2593
|
"""
|
|
2590
2594
|
|
|
2591
|
-
project = project or config.
|
|
2595
|
+
project = project or config.active_project
|
|
2592
2596
|
labels = self._parse_labels(labels)
|
|
2593
2597
|
params = {
|
|
2594
2598
|
"name": name,
|
|
@@ -2626,7 +2630,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2626
2630
|
:returns: A list of entities.
|
|
2627
2631
|
"""
|
|
2628
2632
|
|
|
2629
|
-
project = project or config.
|
|
2633
|
+
project = project or config.active_project
|
|
2630
2634
|
labels = self._parse_labels(labels)
|
|
2631
2635
|
params = {
|
|
2632
2636
|
"name": name,
|
|
@@ -2707,7 +2711,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2707
2711
|
:returns: List of matching :py:class:`~mlrun.feature_store.FeatureSet` objects.
|
|
2708
2712
|
"""
|
|
2709
2713
|
|
|
2710
|
-
project = project or config.
|
|
2714
|
+
project = project or config.active_project
|
|
2711
2715
|
labels = self._parse_labels(labels)
|
|
2712
2716
|
params = {
|
|
2713
2717
|
"name": name,
|
|
@@ -2772,7 +2776,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2772
2776
|
|
|
2773
2777
|
name = name or feature_set["metadata"]["name"]
|
|
2774
2778
|
project = (
|
|
2775
|
-
project or feature_set["metadata"].get("project") or config.
|
|
2779
|
+
project or feature_set["metadata"].get("project") or config.active_project
|
|
2776
2780
|
)
|
|
2777
2781
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
2778
2782
|
error_message = f"Failed storing feature-set {project}/{name}"
|
|
@@ -2811,7 +2815,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2811
2815
|
:param patch_mode: The strategy for merging the changes with the existing object. Can be either ``replace``
|
|
2812
2816
|
or ``additive``.
|
|
2813
2817
|
"""
|
|
2814
|
-
project = project or config.
|
|
2818
|
+
project = project or config.active_project
|
|
2815
2819
|
reference = self._resolve_reference(tag, uid)
|
|
2816
2820
|
headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
|
|
2817
2821
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
@@ -2830,7 +2834,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2830
2834
|
is not allowed.
|
|
2831
2835
|
If none are specified, then all instances of the object whose name is ``name`` will be deleted.
|
|
2832
2836
|
"""
|
|
2833
|
-
project = project or config.
|
|
2837
|
+
project = project or config.active_project
|
|
2834
2838
|
path = f"projects/{project}/feature-sets/{name}"
|
|
2835
2839
|
|
|
2836
2840
|
if tag or uid:
|
|
@@ -2862,7 +2866,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2862
2866
|
project = (
|
|
2863
2867
|
project
|
|
2864
2868
|
or feature_vector["metadata"].get("project", None)
|
|
2865
|
-
or config.
|
|
2869
|
+
or config.active_project
|
|
2866
2870
|
)
|
|
2867
2871
|
path = f"projects/{project}/feature-vectors"
|
|
2868
2872
|
params = {"versioned": versioned}
|
|
@@ -2888,7 +2892,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2888
2892
|
"""Return a specific feature-vector referenced by its tag or uid. If none are provided, ``latest`` tag will
|
|
2889
2893
|
be used."""
|
|
2890
2894
|
|
|
2891
|
-
project = project or config.
|
|
2895
|
+
project = project or config.active_project
|
|
2892
2896
|
reference = self._resolve_reference(tag, uid)
|
|
2893
2897
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
2894
2898
|
error_message = f"Failed retrieving feature-vector {project}/{name}"
|
|
@@ -2934,7 +2938,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2934
2938
|
:returns: List of matching :py:class:`~mlrun.feature_store.FeatureVector` objects.
|
|
2935
2939
|
"""
|
|
2936
2940
|
|
|
2937
|
-
project = project or config.
|
|
2941
|
+
project = project or config.active_project
|
|
2938
2942
|
labels = self._parse_labels(labels)
|
|
2939
2943
|
params = {
|
|
2940
2944
|
"name": name,
|
|
@@ -2998,7 +3002,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2998
3002
|
project = (
|
|
2999
3003
|
project
|
|
3000
3004
|
or feature_vector["metadata"].get("project")
|
|
3001
|
-
or config.
|
|
3005
|
+
or config.active_project
|
|
3002
3006
|
)
|
|
3003
3007
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
3004
3008
|
error_message = f"Failed storing feature-vector {project}/{name}"
|
|
@@ -3033,7 +3037,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3033
3037
|
or ``additive``.
|
|
3034
3038
|
"""
|
|
3035
3039
|
reference = self._resolve_reference(tag, uid)
|
|
3036
|
-
project = project or config.
|
|
3040
|
+
project = project or config.active_project
|
|
3037
3041
|
headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
|
|
3038
3042
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
3039
3043
|
error_message = f"Failed updating feature-vector {project}/{name}"
|
|
@@ -3051,7 +3055,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3051
3055
|
is not allowed.
|
|
3052
3056
|
If none are specified, then all instances of the object whose name is ``name`` will be deleted.
|
|
3053
3057
|
"""
|
|
3054
|
-
project = project or config.
|
|
3058
|
+
project = project or config.active_project
|
|
3055
3059
|
path = f"projects/{project}/feature-vectors/{name}"
|
|
3056
3060
|
if tag or uid:
|
|
3057
3061
|
reference = self._resolve_reference(tag, uid)
|
|
@@ -4358,11 +4362,11 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4358
4362
|
"""
|
|
4359
4363
|
Returns a list of Nuclio api gateways
|
|
4360
4364
|
|
|
4361
|
-
:param project: optional str parameter to filter by project, if not passed,
|
|
4365
|
+
:param project: optional str parameter to filter by project, if not passed, active project value is taken
|
|
4362
4366
|
|
|
4363
4367
|
:returns: :py:class:`~mlrun.common.schemas.APIGateways`.
|
|
4364
4368
|
"""
|
|
4365
|
-
project = project or config.
|
|
4369
|
+
project = project or config.active_project
|
|
4366
4370
|
error = "list api gateways"
|
|
4367
4371
|
endpoint_path = f"projects/{project}/api-gateways"
|
|
4368
4372
|
response = self.api_call("GET", endpoint_path, error)
|
|
@@ -4373,11 +4377,11 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4373
4377
|
Returns an API gateway
|
|
4374
4378
|
|
|
4375
4379
|
:param name: API gateway name
|
|
4376
|
-
:param project: optional str parameter to filter by project, if not passed,
|
|
4380
|
+
:param project: optional str parameter to filter by project, if not passed, active project value is taken
|
|
4377
4381
|
|
|
4378
4382
|
:returns: :py:class:`~mlrun.common.schemas.APIGateway`.
|
|
4379
4383
|
"""
|
|
4380
|
-
project = project or config.
|
|
4384
|
+
project = project or config.active_project
|
|
4381
4385
|
error = "get api gateway"
|
|
4382
4386
|
endpoint_path = f"projects/{project}/api-gateways/{name}"
|
|
4383
4387
|
response = self.api_call("GET", endpoint_path, error)
|
|
@@ -4390,7 +4394,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4390
4394
|
:param name: API gateway name
|
|
4391
4395
|
:param project: Project name
|
|
4392
4396
|
"""
|
|
4393
|
-
project = project or config.
|
|
4397
|
+
project = project or config.active_project
|
|
4394
4398
|
error = "delete api gateway"
|
|
4395
4399
|
endpoint_path = f"projects/{project}/api-gateways/{name}"
|
|
4396
4400
|
self.api_call("DELETE", endpoint_path, error)
|
|
@@ -4674,7 +4678,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4674
4678
|
def get_datastore_profile(
|
|
4675
4679
|
self, name: str, project: str
|
|
4676
4680
|
) -> Optional[mlrun.common.schemas.DatastoreProfile]:
|
|
4677
|
-
project = project or config.
|
|
4681
|
+
project = project or config.active_project
|
|
4678
4682
|
_path = self._path_of("datastore-profiles", project, name)
|
|
4679
4683
|
|
|
4680
4684
|
res = self.api_call(method="GET", path=_path)
|
|
@@ -4687,7 +4691,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4687
4691
|
return None
|
|
4688
4692
|
|
|
4689
4693
|
def delete_datastore_profile(self, name: str, project: str):
|
|
4690
|
-
project = project or config.
|
|
4694
|
+
project = project or config.active_project
|
|
4691
4695
|
_path = self._path_of("datastore-profiles", project, name)
|
|
4692
4696
|
self.api_call(method="DELETE", path=_path)
|
|
4693
4697
|
return None
|
|
@@ -4695,7 +4699,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4695
4699
|
def list_datastore_profiles(
|
|
4696
4700
|
self, project: str
|
|
4697
4701
|
) -> list[mlrun.common.schemas.DatastoreProfile]:
|
|
4698
|
-
project = project or config.
|
|
4702
|
+
project = project or config.active_project
|
|
4699
4703
|
_path = self._path_of("datastore-profiles", project)
|
|
4700
4704
|
|
|
4701
4705
|
res = self.api_call(method="GET", path=_path)
|
|
@@ -4715,7 +4719,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4715
4719
|
Create or replace a datastore profile.
|
|
4716
4720
|
:returns: None
|
|
4717
4721
|
"""
|
|
4718
|
-
project = project or config.
|
|
4722
|
+
project = project or config.active_project
|
|
4719
4723
|
_path = self._path_of("datastore-profiles", project)
|
|
4720
4724
|
|
|
4721
4725
|
self.api_call(method="PUT", path=_path, json=profile.dict())
|
|
@@ -4750,7 +4754,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4750
4754
|
if mlrun.mlconf.alerts.mode == mlrun.common.schemas.alert.AlertsModes.disabled:
|
|
4751
4755
|
logger.warning("Alerts are disabled, event will not be generated")
|
|
4752
4756
|
|
|
4753
|
-
project = project or config.
|
|
4757
|
+
project = project or config.active_project
|
|
4754
4758
|
endpoint_path = f"projects/{project}/events/{name}"
|
|
4755
4759
|
error_message = f"post event {project}/events/{name}"
|
|
4756
4760
|
if isinstance(event_data, mlrun.common.schemas.Event):
|
|
@@ -4783,7 +4787,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4783
4787
|
"Alerts are disabled, alert will still be stored but will not be triggered"
|
|
4784
4788
|
)
|
|
4785
4789
|
|
|
4786
|
-
project = project or config.
|
|
4790
|
+
project = project or config.active_project
|
|
4787
4791
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4788
4792
|
error_message = f"put alert {project}/alerts/{alert_name}"
|
|
4789
4793
|
alert_instance = (
|
|
@@ -4812,7 +4816,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4812
4816
|
|
|
4813
4817
|
:returns: The alert object.
|
|
4814
4818
|
"""
|
|
4815
|
-
project = project or config.
|
|
4819
|
+
project = project or config.active_project
|
|
4816
4820
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4817
4821
|
error_message = f"get alert {project}/alerts/{alert_name}"
|
|
4818
4822
|
response = self.api_call("GET", endpoint_path, error_message)
|
|
@@ -4831,7 +4835,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4831
4835
|
|
|
4832
4836
|
:returns: All the alerts objects of the project.
|
|
4833
4837
|
"""
|
|
4834
|
-
project = project or config.
|
|
4838
|
+
project = project or config.active_project
|
|
4835
4839
|
endpoint_path = f"projects/{project}/alerts"
|
|
4836
4840
|
error_message = f"get alerts {project}/alerts"
|
|
4837
4841
|
params = {}
|
|
@@ -4854,7 +4858,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4854
4858
|
:param alert_name: The name of the alert to delete.
|
|
4855
4859
|
:param project: The project that the alert belongs to.
|
|
4856
4860
|
"""
|
|
4857
|
-
project = project or config.
|
|
4861
|
+
project = project or config.active_project
|
|
4858
4862
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4859
4863
|
error_message = f"delete alert {project}/alerts/{alert_name}"
|
|
4860
4864
|
self.api_call("DELETE", endpoint_path, error_message)
|
|
@@ -4866,7 +4870,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4866
4870
|
:param alert_name: The name of the alert to reset.
|
|
4867
4871
|
:param project: The project that the alert belongs to.
|
|
4868
4872
|
"""
|
|
4869
|
-
project = project or config.
|
|
4873
|
+
project = project or config.active_project
|
|
4870
4874
|
endpoint_path = f"projects/{project}/alerts/{alert_name}/reset"
|
|
4871
4875
|
error_message = f"post alert {project}/alerts/{alert_name}/reset"
|
|
4872
4876
|
self.api_call("POST", endpoint_path, error_message)
|
|
@@ -5019,7 +5023,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5019
5023
|
:param activation_id: alert activation id.
|
|
5020
5024
|
:returns: alert activation object.
|
|
5021
5025
|
"""
|
|
5022
|
-
project = project or config.
|
|
5026
|
+
project = project or config.active_project
|
|
5023
5027
|
|
|
5024
5028
|
error = "get alert activation"
|
|
5025
5029
|
path = f"projects/{project}/alert-activations/{activation_id}"
|
|
@@ -5037,7 +5041,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5037
5041
|
:param project: Project name for which the summary belongs.
|
|
5038
5042
|
:returns: A summary of the project.
|
|
5039
5043
|
"""
|
|
5040
|
-
project = project or config.
|
|
5044
|
+
project = project or config.active_project
|
|
5041
5045
|
|
|
5042
5046
|
endpoint_path = f"project-summaries/{project}"
|
|
5043
5047
|
error_message = f"Failed retrieving project summary for {project}"
|
|
@@ -5080,6 +5084,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5080
5084
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
5081
5085
|
tree: Optional[str] = None,
|
|
5082
5086
|
producer_uri: Optional[str] = None,
|
|
5087
|
+
parent: Optional[str] = None,
|
|
5083
5088
|
format_: Optional[
|
|
5084
5089
|
mlrun.common.formatters.ArtifactFormat
|
|
5085
5090
|
] = mlrun.common.formatters.ArtifactFormat.full,
|
|
@@ -5101,7 +5106,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5101
5106
|
) -> tuple[ArtifactList, Optional[str]]:
|
|
5102
5107
|
"""Handles list artifacts, both paginated and not."""
|
|
5103
5108
|
|
|
5104
|
-
project = project or config.
|
|
5109
|
+
project = project or config.active_project
|
|
5105
5110
|
labels = self._parse_labels(labels)
|
|
5106
5111
|
|
|
5107
5112
|
if limit:
|
|
@@ -5128,6 +5133,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5128
5133
|
"page": page,
|
|
5129
5134
|
"page-size": page_size,
|
|
5130
5135
|
"page-token": page_token,
|
|
5136
|
+
"parent": parent,
|
|
5131
5137
|
}
|
|
5132
5138
|
|
|
5133
5139
|
if partition_by:
|
|
@@ -5177,7 +5183,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5177
5183
|
) -> tuple[list, Optional[str]]:
|
|
5178
5184
|
"""Handles list functions, both paginated and not."""
|
|
5179
5185
|
|
|
5180
|
-
project = project or config.
|
|
5186
|
+
project = project or config.active_project
|
|
5181
5187
|
labels = self._parse_labels(labels)
|
|
5182
5188
|
params = {
|
|
5183
5189
|
"name": name,
|
|
@@ -5239,7 +5245,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5239
5245
|
) -> tuple[RunList, Optional[str]]:
|
|
5240
5246
|
"""Handles list runs, both paginated and not."""
|
|
5241
5247
|
|
|
5242
|
-
project = project or config.
|
|
5248
|
+
project = project or config.active_project
|
|
5243
5249
|
if with_notifications:
|
|
5244
5250
|
logger.warning(
|
|
5245
5251
|
"Local run notifications are not persisted in the DB, therefore local runs will not be returned when "
|
|
@@ -5247,9 +5253,9 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5247
5253
|
)
|
|
5248
5254
|
|
|
5249
5255
|
if state:
|
|
5250
|
-
# TODO: Remove this in 1.
|
|
5256
|
+
# TODO: Remove this in 1.10.0
|
|
5251
5257
|
warnings.warn(
|
|
5252
|
-
"'state' is deprecated and will be removed in 1.
|
|
5258
|
+
"'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
|
|
5253
5259
|
FutureWarning,
|
|
5254
5260
|
)
|
|
5255
5261
|
|
|
@@ -5342,7 +5348,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5342
5348
|
page_token: Optional[str] = None,
|
|
5343
5349
|
return_all: bool = False,
|
|
5344
5350
|
) -> tuple[mlrun.common.schemas.AlertActivations, Optional[str]]:
|
|
5345
|
-
project = project or config.
|
|
5351
|
+
project = project or config.active_project
|
|
5346
5352
|
params = {
|
|
5347
5353
|
"name": name,
|
|
5348
5354
|
"since": datetime_to_iso(since),
|
mlrun/db/nopdb.py
CHANGED
|
@@ -208,6 +208,7 @@ class NopDB(RunDBInterface):
|
|
|
208
208
|
kind: Optional[str] = None,
|
|
209
209
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
210
210
|
tree: Optional[str] = None,
|
|
211
|
+
parent: Optional[str] = None,
|
|
211
212
|
format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
|
|
212
213
|
limit: Optional[int] = None,
|
|
213
214
|
partition_by: Optional[
|
mlrun/errors.py
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
|
|
14
|
+
import copy
|
|
15
15
|
import typing
|
|
16
16
|
from http import HTTPStatus
|
|
17
17
|
|
|
@@ -263,6 +263,27 @@ class MLRunFatalFailureError(Exception):
|
|
|
263
263
|
self.original_exception = original_exception
|
|
264
264
|
|
|
265
265
|
|
|
266
|
+
class ModelRunnerError(MLRunBaseError):
|
|
267
|
+
def __init__(self, models_errors: dict[str:str], *args) -> None:
|
|
268
|
+
self.models_errors = models_errors
|
|
269
|
+
super().__init__(self.__repr__(), *args)
|
|
270
|
+
|
|
271
|
+
def __repr__(self):
|
|
272
|
+
return f"ModelRunnerError: {repr(self.models_errors)}"
|
|
273
|
+
|
|
274
|
+
def __copy__(self):
|
|
275
|
+
return type(self)(models_errors=self.models_errors)
|
|
276
|
+
|
|
277
|
+
def __deepcopy__(self, memo):
|
|
278
|
+
return type(self)(copy.deepcopy(self.models_errors, memo))
|
|
279
|
+
|
|
280
|
+
def get_errors(self):
|
|
281
|
+
return self.models_errors
|
|
282
|
+
|
|
283
|
+
def get_model_error(self, model: str):
|
|
284
|
+
return self.models_errors.get(model)
|
|
285
|
+
|
|
286
|
+
|
|
266
287
|
STATUS_ERRORS = {
|
|
267
288
|
HTTPStatus.BAD_REQUEST.value: MLRunBadRequestError,
|
|
268
289
|
HTTPStatus.UNAUTHORIZED.value: MLRunUnauthorizedError,
|