mlrun 1.10.0rc1__py3-none-any.whl → 1.10.0rc3__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 +15 -4
- mlrun/artifacts/base.py +6 -6
- mlrun/artifacts/dataset.py +1 -1
- mlrun/artifacts/document.py +1 -1
- mlrun/artifacts/model.py +1 -1
- mlrun/artifacts/plots.py +2 -2
- mlrun/common/constants.py +7 -0
- mlrun/common/runtimes/constants.py +1 -1
- mlrun/common/schemas/__init__.py +1 -0
- mlrun/common/schemas/artifact.py +1 -1
- mlrun/common/schemas/pipeline.py +1 -1
- mlrun/common/schemas/project.py +1 -1
- mlrun/common/schemas/runs.py +1 -1
- mlrun/common/schemas/serving.py +17 -0
- mlrun/config.py +4 -4
- mlrun/datastore/datastore_profile.py +7 -57
- mlrun/datastore/sources.py +24 -16
- mlrun/datastore/store_resources.py +3 -3
- mlrun/datastore/targets.py +5 -5
- mlrun/datastore/utils.py +21 -6
- mlrun/db/base.py +7 -7
- mlrun/db/httpdb.py +88 -76
- mlrun/db/nopdb.py +1 -1
- mlrun/errors.py +29 -1
- mlrun/execution.py +9 -0
- 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/launcher/client.py +1 -1
- mlrun/lists.py +1 -1
- mlrun/model_monitoring/__init__.py +0 -1
- mlrun/model_monitoring/api.py +0 -44
- mlrun/model_monitoring/applications/evidently/base.py +57 -107
- mlrun/model_monitoring/controller.py +27 -14
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +13 -5
- mlrun/model_monitoring/writer.py +1 -4
- mlrun/projects/operations.py +3 -3
- mlrun/projects/project.py +114 -52
- mlrun/render.py +5 -9
- mlrun/run.py +10 -10
- mlrun/runtimes/base.py +7 -7
- mlrun/runtimes/kubejob.py +2 -2
- mlrun/runtimes/nuclio/function.py +3 -3
- mlrun/runtimes/nuclio/serving.py +13 -23
- mlrun/runtimes/utils.py +25 -8
- mlrun/serving/__init__.py +5 -1
- mlrun/serving/server.py +39 -3
- mlrun/serving/states.py +176 -10
- mlrun/utils/helpers.py +10 -4
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/METADATA +27 -15
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/RECORD +58 -59
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/WHEEL +1 -1
- mlrun/model_monitoring/tracking_policy.py +0 -124
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/entry_points.txt +0 -0
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/licenses/LICENSE +0 -0
- {mlrun-1.10.0rc1.dist-info → mlrun-1.10.0rc3.dist-info}/top_level.txt +0 -0
mlrun/db/httpdb.py
CHANGED
|
@@ -21,7 +21,7 @@ import typing
|
|
|
21
21
|
import warnings
|
|
22
22
|
from copy import deepcopy
|
|
23
23
|
from datetime import datetime, timedelta
|
|
24
|
-
from os import path, remove
|
|
24
|
+
from os import environ, path, remove
|
|
25
25
|
from typing import Literal, Optional, Union
|
|
26
26
|
from urllib.parse import urlparse
|
|
27
27
|
|
|
@@ -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
|
|
|
@@ -129,7 +129,9 @@ class HTTPRunDB(RunDBInterface):
|
|
|
129
129
|
self._wait_for_background_task_terminal_state_retry_interval = 3
|
|
130
130
|
self._wait_for_project_deletion_interval = 3
|
|
131
131
|
self.client_version = version.Version().get()["version"]
|
|
132
|
-
self.python_version =
|
|
132
|
+
self.python_version = environ.get("MLRUN_PYTHON_VERSION") or str(
|
|
133
|
+
version.Version().get_python_version()
|
|
134
|
+
)
|
|
133
135
|
|
|
134
136
|
self._enrich_and_validate(url)
|
|
135
137
|
|
|
@@ -396,7 +398,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
396
398
|
)
|
|
397
399
|
|
|
398
400
|
def _path_of(self, resource, project, uid=None):
|
|
399
|
-
project = project or config.
|
|
401
|
+
project = project or config.active_project
|
|
400
402
|
_path = f"projects/{project}/{resource}"
|
|
401
403
|
if uid:
|
|
402
404
|
_path += f"/{uid}"
|
|
@@ -731,7 +733,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
731
733
|
Abort a running run - will remove the run's runtime resources and mark its state as aborted.
|
|
732
734
|
:returns: :py:class:`~mlrun.common.schemas.BackgroundTask`.
|
|
733
735
|
"""
|
|
734
|
-
project = project or config.
|
|
736
|
+
project = project or config.active_project
|
|
735
737
|
params = {"iter": iter}
|
|
736
738
|
updates = {}
|
|
737
739
|
if status_text:
|
|
@@ -766,7 +768,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
766
768
|
:param project: Project that the run belongs to.
|
|
767
769
|
:returns: :py:class:`~mlrun.common.schemas.BackgroundTask`.
|
|
768
770
|
"""
|
|
769
|
-
project = project or config.
|
|
771
|
+
project = project or config.active_project
|
|
770
772
|
response = self.api_call(
|
|
771
773
|
"POST",
|
|
772
774
|
path=f"projects/{project}/runs/{uid}/push-notifications",
|
|
@@ -819,7 +821,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
819
821
|
"The 'notifications' parameter must be a list."
|
|
820
822
|
)
|
|
821
823
|
|
|
822
|
-
project = project or config.
|
|
824
|
+
project = project or config.active_project
|
|
823
825
|
|
|
824
826
|
response = self.api_call(
|
|
825
827
|
"POST",
|
|
@@ -937,7 +939,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
937
939
|
|
|
938
940
|
:param name: Name of the run to retrieve.
|
|
939
941
|
:param uid: Unique ID of the run, or a list of run UIDs.
|
|
940
|
-
: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.
|
|
941
943
|
:param labels: Filter runs by label key-value pairs or key existence. This can be provided as:
|
|
942
944
|
- A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
|
|
943
945
|
or `{"label": None}` to check for key existence.
|
|
@@ -945,7 +947,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
945
947
|
or just `"label"` for key existence.
|
|
946
948
|
- A comma-separated string formatted as `"label1=value1,label2"` to match entities with
|
|
947
949
|
the specified key-value pairs or key existence.
|
|
948
|
-
: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)
|
|
949
951
|
:param states: List only runs whose state is one of the provided states.
|
|
950
952
|
:param sort: Whether to sort the result according to their start time. Otherwise, results will be
|
|
951
953
|
returned by their internal order in the DB (order will not be guaranteed).
|
|
@@ -1078,7 +1080,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1078
1080
|
:param days_ago: Filter runs whose start time is newer than this parameter.
|
|
1079
1081
|
"""
|
|
1080
1082
|
|
|
1081
|
-
project = project or config.
|
|
1083
|
+
project = project or config.active_project
|
|
1082
1084
|
labels = self._parse_labels(labels)
|
|
1083
1085
|
params = {
|
|
1084
1086
|
"name": name,
|
|
@@ -1111,7 +1113,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1111
1113
|
:param tree: The tree (producer id) which generated this artifact.
|
|
1112
1114
|
:returns: The stored artifact dictionary.
|
|
1113
1115
|
"""
|
|
1114
|
-
project = project or mlrun.mlconf.
|
|
1116
|
+
project = project or mlrun.mlconf.active_project
|
|
1115
1117
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1116
1118
|
|
|
1117
1119
|
error = f"store artifact {project}/{key}"
|
|
@@ -1151,7 +1153,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1151
1153
|
:param format_: The format in which to return the artifact. Default is 'full'.
|
|
1152
1154
|
"""
|
|
1153
1155
|
|
|
1154
|
-
project = project or mlrun.mlconf.
|
|
1156
|
+
project = project or mlrun.mlconf.active_project
|
|
1155
1157
|
tag = tag or "latest"
|
|
1156
1158
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1157
1159
|
error = f"read artifact {project}/{key}"
|
|
@@ -1189,7 +1191,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1189
1191
|
:param deletion_strategy: The artifact deletion strategy types.
|
|
1190
1192
|
:param secrets: Credentials needed to access the artifact data.
|
|
1191
1193
|
"""
|
|
1192
|
-
project = project or mlrun.mlconf.
|
|
1194
|
+
project = project or mlrun.mlconf.active_project
|
|
1193
1195
|
endpoint_path = f"projects/{project}/artifacts/{key}"
|
|
1194
1196
|
params = {
|
|
1195
1197
|
"key": key,
|
|
@@ -1276,8 +1278,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1276
1278
|
:param producer_uri: Return artifacts produced by the requested producer URI. Producer URI usually
|
|
1277
1279
|
points to a run and is used to filter artifacts by the run that produced them when the artifact producer id
|
|
1278
1280
|
is a workflow id (artifact was created as part of a workflow).
|
|
1279
|
-
:param format_:
|
|
1280
|
-
:param limit:
|
|
1281
|
+
:param format_: The format in which to return the artifacts. Default is 'full'.
|
|
1282
|
+
:param limit: Deprecated - Maximum number of artifacts to return (will be removed in 1.11.0).
|
|
1281
1283
|
:param partition_by: Field to group results by. When `partition_by` is specified, the `partition_sort_by`
|
|
1282
1284
|
parameter must be provided as well.
|
|
1283
1285
|
:param rows_per_partition: How many top rows (per sorting defined by `partition_sort_by` and `partition_order`)
|
|
@@ -1400,7 +1402,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1400
1402
|
:param days_ago: This parameter is deprecated and not used.
|
|
1401
1403
|
:param tree: Delete artifacts filtered by tree.
|
|
1402
1404
|
"""
|
|
1403
|
-
project = project or config.
|
|
1405
|
+
project = project or config.active_project
|
|
1404
1406
|
labels = self._parse_labels(labels)
|
|
1405
1407
|
|
|
1406
1408
|
params = {
|
|
@@ -1421,7 +1423,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1421
1423
|
) -> list[str]:
|
|
1422
1424
|
"""Return a list of all the tags assigned to artifacts in the scope of the given project."""
|
|
1423
1425
|
|
|
1424
|
-
project = project or config.
|
|
1426
|
+
project = project or config.active_project
|
|
1425
1427
|
error_message = f"Failed listing artifact tags. project={project}"
|
|
1426
1428
|
params = {"category": category} if category else {}
|
|
1427
1429
|
|
|
@@ -1444,7 +1446,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1444
1446
|
function = function.to_dict()
|
|
1445
1447
|
|
|
1446
1448
|
params = {"tag": tag, "versioned": versioned}
|
|
1447
|
-
project = project or config.
|
|
1449
|
+
project = project or config.active_project
|
|
1448
1450
|
path = f"projects/{project}/functions/{name}"
|
|
1449
1451
|
|
|
1450
1452
|
error = f"store function {project}/{name}"
|
|
@@ -1459,7 +1461,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1459
1461
|
"""Retrieve details of a specific function, identified by its name and potentially a tag or function hash."""
|
|
1460
1462
|
|
|
1461
1463
|
params = {"tag": tag, "hash_key": hash_key}
|
|
1462
|
-
project = project or config.
|
|
1464
|
+
project = project or config.active_project
|
|
1463
1465
|
path = f"projects/{project}/functions/{name}"
|
|
1464
1466
|
error = f"get function {project}/{name}"
|
|
1465
1467
|
resp = self.api_call("GET", path, error, params=params)
|
|
@@ -1468,7 +1470,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1468
1470
|
def delete_function(self, name: str, project: str = ""):
|
|
1469
1471
|
"""Delete a function belonging to a specific project."""
|
|
1470
1472
|
|
|
1471
|
-
project = project or config.
|
|
1473
|
+
project = project or config.active_project
|
|
1472
1474
|
path = f"projects/{project}/functions/{name}"
|
|
1473
1475
|
error_message = f"Failed deleting function {project}/{name}"
|
|
1474
1476
|
response = self.api_call("DELETE", path, error_message, version="v2")
|
|
@@ -1513,7 +1515,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1513
1515
|
"""Retrieve a list of functions, filtered by specific criteria.
|
|
1514
1516
|
|
|
1515
1517
|
:param name: Return only functions with a specific name.
|
|
1516
|
-
:param project: Return functions belonging to this project. If not specified, the
|
|
1518
|
+
:param project: Return functions belonging to this project. If not specified, the active project is used.
|
|
1517
1519
|
:param tag: Return function versions with specific tags. To return only tagged functions, set tag to ``"*"``.
|
|
1518
1520
|
:param labels: Filter functions by label key-value pairs or key existence. This can be provided as:
|
|
1519
1521
|
- A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
|
|
@@ -1738,7 +1740,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1738
1740
|
):
|
|
1739
1741
|
"""Update an existing schedule, replace it with the details contained in the schedule object."""
|
|
1740
1742
|
|
|
1741
|
-
project = project or config.
|
|
1743
|
+
project = project or config.active_project
|
|
1742
1744
|
path = f"projects/{project}/schedules/{name}"
|
|
1743
1745
|
|
|
1744
1746
|
error_message = f"Failed updating schedule {project}/{name}"
|
|
@@ -1756,7 +1758,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1756
1758
|
:param include_last_run: Whether to include the results of the schedule's last run in the response.
|
|
1757
1759
|
"""
|
|
1758
1760
|
|
|
1759
|
-
project = project or config.
|
|
1761
|
+
project = project or config.active_project
|
|
1760
1762
|
path = f"projects/{project}/schedules/{name}"
|
|
1761
1763
|
error_message = f"Failed getting schedule for {project}/{name}"
|
|
1762
1764
|
resp = self.api_call(
|
|
@@ -1784,7 +1786,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1784
1786
|
:param next_run_time_until: Return only schedules with next run time before this date.
|
|
1785
1787
|
"""
|
|
1786
1788
|
|
|
1787
|
-
project = project or config.
|
|
1789
|
+
project = project or config.active_project
|
|
1788
1790
|
params = {
|
|
1789
1791
|
"kind": kind,
|
|
1790
1792
|
"name": name,
|
|
@@ -1800,7 +1802,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1800
1802
|
def delete_schedule(self, project: str, name: str):
|
|
1801
1803
|
"""Delete a specific schedule by name."""
|
|
1802
1804
|
|
|
1803
|
-
project = project or config.
|
|
1805
|
+
project = project or config.active_project
|
|
1804
1806
|
path = f"projects/{project}/schedules/{name}"
|
|
1805
1807
|
error_message = f"Failed deleting schedule {project}/{name}"
|
|
1806
1808
|
self.api_call("DELETE", path, error_message)
|
|
@@ -1808,7 +1810,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1808
1810
|
def invoke_schedule(self, project: str, name: str):
|
|
1809
1811
|
"""Execute the object referenced by the schedule immediately."""
|
|
1810
1812
|
|
|
1811
|
-
project = project or config.
|
|
1813
|
+
project = project or config.active_project
|
|
1812
1814
|
path = f"projects/{project}/schedules/{name}/invoke"
|
|
1813
1815
|
error_message = f"Failed invoking schedule {project}/{name}"
|
|
1814
1816
|
self.api_call("POST", path, error_message)
|
|
@@ -1869,7 +1871,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1869
1871
|
:param func: Function to build.
|
|
1870
1872
|
:param builder_env: Kaniko builder pod env vars dict (for config/credentials)
|
|
1871
1873
|
"""
|
|
1872
|
-
func.metadata.project = func.metadata.project or config.
|
|
1874
|
+
func.metadata.project = func.metadata.project or config.active_project
|
|
1873
1875
|
self.warn_on_s3_and_ecr_permissions_conflict(func)
|
|
1874
1876
|
try:
|
|
1875
1877
|
req = {
|
|
@@ -2055,7 +2057,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2055
2057
|
) -> mlrun.common.schemas.BackgroundTask:
|
|
2056
2058
|
"""Retrieve updated information on a project background task being executed."""
|
|
2057
2059
|
|
|
2058
|
-
project = project or config.
|
|
2060
|
+
project = project or config.active_project
|
|
2059
2061
|
path = f"projects/{project}/background-tasks/{name}"
|
|
2060
2062
|
error_message = (
|
|
2061
2063
|
f"Failed getting project background task. project={project}, name={name}"
|
|
@@ -2076,7 +2078,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2076
2078
|
Retrieve updated information on project background tasks being executed.
|
|
2077
2079
|
If no filter is provided, will return background tasks from the last week.
|
|
2078
2080
|
|
|
2079
|
-
:param project: Project name (defaults to mlrun.mlconf.
|
|
2081
|
+
:param project: Project name (defaults to mlrun.mlconf.active_project).
|
|
2080
2082
|
:param state: List only background tasks whose state is specified.
|
|
2081
2083
|
:param created_from: Filter by background task created time in ``[created_from, created_to]``.
|
|
2082
2084
|
:param created_to: Filter by background task created time in ``[created_from, created_to]``.
|
|
@@ -2085,7 +2087,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2085
2087
|
:param last_update_time_to: Filter by background task last update time in
|
|
2086
2088
|
``(last_update_time_from, last_update_time_to)``.
|
|
2087
2089
|
"""
|
|
2088
|
-
project = project or config.
|
|
2090
|
+
project = project or config.active_project
|
|
2089
2091
|
if (
|
|
2090
2092
|
not state
|
|
2091
2093
|
and not created_from
|
|
@@ -2221,18 +2223,20 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2221
2223
|
elif pipe_file.endswith(".zip"):
|
|
2222
2224
|
headers = {"content-type": "application/zip"}
|
|
2223
2225
|
else:
|
|
2224
|
-
raise ValueError("pipeline file must be .yaml or .zip")
|
|
2226
|
+
raise ValueError("'pipeline' file must be .yaml or .zip")
|
|
2225
2227
|
if arguments:
|
|
2226
2228
|
if not isinstance(arguments, dict):
|
|
2227
|
-
raise ValueError("arguments must be dict type")
|
|
2229
|
+
raise ValueError("'arguments' must be dict type")
|
|
2228
2230
|
headers[mlrun.common.schemas.HeaderNames.pipeline_arguments] = str(
|
|
2229
2231
|
arguments
|
|
2230
2232
|
)
|
|
2231
2233
|
|
|
2232
2234
|
if not path.isfile(pipe_file):
|
|
2233
|
-
raise OSError(f"
|
|
2235
|
+
raise OSError(f"File {pipe_file} doesnt exist")
|
|
2234
2236
|
with open(pipe_file, "rb") as fp:
|
|
2235
2237
|
data = fp.read()
|
|
2238
|
+
if not data:
|
|
2239
|
+
raise ValueError("The compiled pipe file is empty")
|
|
2236
2240
|
if not isinstance(pipeline, str):
|
|
2237
2241
|
remove(pipe_file)
|
|
2238
2242
|
|
|
@@ -2435,7 +2439,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2435
2439
|
project = (
|
|
2436
2440
|
project
|
|
2437
2441
|
or feature_set["metadata"].get("project", None)
|
|
2438
|
-
or config.
|
|
2442
|
+
or config.active_project
|
|
2439
2443
|
)
|
|
2440
2444
|
path = f"projects/{project}/feature-sets"
|
|
2441
2445
|
params = {"versioned": versioned}
|
|
@@ -2467,7 +2471,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2467
2471
|
:param uid: uid of the object to retrieve (can only be used for versioned objects).
|
|
2468
2472
|
"""
|
|
2469
2473
|
|
|
2470
|
-
project = project or config.
|
|
2474
|
+
project = project or config.active_project
|
|
2471
2475
|
reference = self._resolve_reference(tag, uid)
|
|
2472
2476
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
2473
2477
|
error_message = f"Failed retrieving feature-set {project}/{name}"
|
|
@@ -2503,7 +2507,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2503
2507
|
of the feature-set.
|
|
2504
2508
|
"""
|
|
2505
2509
|
|
|
2506
|
-
project = project or config.
|
|
2510
|
+
project = project or config.active_project
|
|
2507
2511
|
labels = self._parse_labels(labels)
|
|
2508
2512
|
params = {
|
|
2509
2513
|
"name": name,
|
|
@@ -2545,7 +2549,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2545
2549
|
:returns: A list of features, and a list of their corresponding feature sets.
|
|
2546
2550
|
"""
|
|
2547
2551
|
|
|
2548
|
-
project = project or config.
|
|
2552
|
+
project = project or config.active_project
|
|
2549
2553
|
labels = self._parse_labels(labels)
|
|
2550
2554
|
params = {
|
|
2551
2555
|
"name": name,
|
|
@@ -2584,7 +2588,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2584
2588
|
:returns: A list of entities.
|
|
2585
2589
|
"""
|
|
2586
2590
|
|
|
2587
|
-
project = project or config.
|
|
2591
|
+
project = project or config.active_project
|
|
2588
2592
|
labels = self._parse_labels(labels)
|
|
2589
2593
|
params = {
|
|
2590
2594
|
"name": name,
|
|
@@ -2622,7 +2626,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2622
2626
|
:returns: A list of entities.
|
|
2623
2627
|
"""
|
|
2624
2628
|
|
|
2625
|
-
project = project or config.
|
|
2629
|
+
project = project or config.active_project
|
|
2626
2630
|
labels = self._parse_labels(labels)
|
|
2627
2631
|
params = {
|
|
2628
2632
|
"name": name,
|
|
@@ -2703,7 +2707,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2703
2707
|
:returns: List of matching :py:class:`~mlrun.feature_store.FeatureSet` objects.
|
|
2704
2708
|
"""
|
|
2705
2709
|
|
|
2706
|
-
project = project or config.
|
|
2710
|
+
project = project or config.active_project
|
|
2707
2711
|
labels = self._parse_labels(labels)
|
|
2708
2712
|
params = {
|
|
2709
2713
|
"name": name,
|
|
@@ -2768,7 +2772,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2768
2772
|
|
|
2769
2773
|
name = name or feature_set["metadata"]["name"]
|
|
2770
2774
|
project = (
|
|
2771
|
-
project or feature_set["metadata"].get("project") or config.
|
|
2775
|
+
project or feature_set["metadata"].get("project") or config.active_project
|
|
2772
2776
|
)
|
|
2773
2777
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
2774
2778
|
error_message = f"Failed storing feature-set {project}/{name}"
|
|
@@ -2807,7 +2811,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2807
2811
|
:param patch_mode: The strategy for merging the changes with the existing object. Can be either ``replace``
|
|
2808
2812
|
or ``additive``.
|
|
2809
2813
|
"""
|
|
2810
|
-
project = project or config.
|
|
2814
|
+
project = project or config.active_project
|
|
2811
2815
|
reference = self._resolve_reference(tag, uid)
|
|
2812
2816
|
headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
|
|
2813
2817
|
path = f"projects/{project}/feature-sets/{name}/references/{reference}"
|
|
@@ -2826,7 +2830,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2826
2830
|
is not allowed.
|
|
2827
2831
|
If none are specified, then all instances of the object whose name is ``name`` will be deleted.
|
|
2828
2832
|
"""
|
|
2829
|
-
project = project or config.
|
|
2833
|
+
project = project or config.active_project
|
|
2830
2834
|
path = f"projects/{project}/feature-sets/{name}"
|
|
2831
2835
|
|
|
2832
2836
|
if tag or uid:
|
|
@@ -2858,7 +2862,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2858
2862
|
project = (
|
|
2859
2863
|
project
|
|
2860
2864
|
or feature_vector["metadata"].get("project", None)
|
|
2861
|
-
or config.
|
|
2865
|
+
or config.active_project
|
|
2862
2866
|
)
|
|
2863
2867
|
path = f"projects/{project}/feature-vectors"
|
|
2864
2868
|
params = {"versioned": versioned}
|
|
@@ -2884,7 +2888,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2884
2888
|
"""Return a specific feature-vector referenced by its tag or uid. If none are provided, ``latest`` tag will
|
|
2885
2889
|
be used."""
|
|
2886
2890
|
|
|
2887
|
-
project = project or config.
|
|
2891
|
+
project = project or config.active_project
|
|
2888
2892
|
reference = self._resolve_reference(tag, uid)
|
|
2889
2893
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
2890
2894
|
error_message = f"Failed retrieving feature-vector {project}/{name}"
|
|
@@ -2930,7 +2934,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2930
2934
|
:returns: List of matching :py:class:`~mlrun.feature_store.FeatureVector` objects.
|
|
2931
2935
|
"""
|
|
2932
2936
|
|
|
2933
|
-
project = project or config.
|
|
2937
|
+
project = project or config.active_project
|
|
2934
2938
|
labels = self._parse_labels(labels)
|
|
2935
2939
|
params = {
|
|
2936
2940
|
"name": name,
|
|
@@ -2994,7 +2998,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
2994
2998
|
project = (
|
|
2995
2999
|
project
|
|
2996
3000
|
or feature_vector["metadata"].get("project")
|
|
2997
|
-
or config.
|
|
3001
|
+
or config.active_project
|
|
2998
3002
|
)
|
|
2999
3003
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
3000
3004
|
error_message = f"Failed storing feature-vector {project}/{name}"
|
|
@@ -3029,7 +3033,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3029
3033
|
or ``additive``.
|
|
3030
3034
|
"""
|
|
3031
3035
|
reference = self._resolve_reference(tag, uid)
|
|
3032
|
-
project = project or config.
|
|
3036
|
+
project = project or config.active_project
|
|
3033
3037
|
headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
|
|
3034
3038
|
path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
|
|
3035
3039
|
error_message = f"Failed updating feature-vector {project}/{name}"
|
|
@@ -3047,7 +3051,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3047
3051
|
is not allowed.
|
|
3048
3052
|
If none are specified, then all instances of the object whose name is ``name`` will be deleted.
|
|
3049
3053
|
"""
|
|
3050
|
-
project = project or config.
|
|
3054
|
+
project = project or config.active_project
|
|
3051
3055
|
path = f"projects/{project}/feature-vectors/{name}"
|
|
3052
3056
|
if tag or uid:
|
|
3053
3057
|
reference = self._resolve_reference(tag, uid)
|
|
@@ -3767,7 +3771,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3767
3771
|
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
3768
3772
|
start: Optional[datetime] = None,
|
|
3769
3773
|
end: Optional[datetime] = None,
|
|
3770
|
-
tsdb_metrics: bool =
|
|
3774
|
+
tsdb_metrics: bool = False,
|
|
3771
3775
|
metric_list: Optional[list[str]] = None,
|
|
3772
3776
|
top_level: bool = False,
|
|
3773
3777
|
uids: Optional[list[str]] = None,
|
|
@@ -3889,8 +3893,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3889
3893
|
attributes_keys = list(attributes.keys())
|
|
3890
3894
|
attributes["name"] = name
|
|
3891
3895
|
attributes["project"] = project
|
|
3892
|
-
attributes["
|
|
3893
|
-
attributes["
|
|
3896
|
+
attributes["function_name"] = function_name or None
|
|
3897
|
+
attributes["function_tag"] = function_tag or None
|
|
3894
3898
|
attributes["uid"] = endpoint_id or None
|
|
3895
3899
|
model_endpoint = mlrun.common.schemas.ModelEndpoint.from_flat_dict(attributes)
|
|
3896
3900
|
path = f"projects/{project}/model-endpoints"
|
|
@@ -3981,6 +3985,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3981
3985
|
"deploy_histogram_data_drift_app": deploy_histogram_data_drift_app,
|
|
3982
3986
|
"fetch_credentials_from_sys_config": fetch_credentials_from_sys_config,
|
|
3983
3987
|
},
|
|
3988
|
+
timeout=300, # 5 minutes
|
|
3984
3989
|
)
|
|
3985
3990
|
|
|
3986
3991
|
def disable_model_monitoring(
|
|
@@ -4353,11 +4358,11 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4353
4358
|
"""
|
|
4354
4359
|
Returns a list of Nuclio api gateways
|
|
4355
4360
|
|
|
4356
|
-
:param project: optional str parameter to filter by project, if not passed,
|
|
4361
|
+
:param project: optional str parameter to filter by project, if not passed, active project value is taken
|
|
4357
4362
|
|
|
4358
4363
|
:returns: :py:class:`~mlrun.common.schemas.APIGateways`.
|
|
4359
4364
|
"""
|
|
4360
|
-
project = project or config.
|
|
4365
|
+
project = project or config.active_project
|
|
4361
4366
|
error = "list api gateways"
|
|
4362
4367
|
endpoint_path = f"projects/{project}/api-gateways"
|
|
4363
4368
|
response = self.api_call("GET", endpoint_path, error)
|
|
@@ -4368,11 +4373,11 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4368
4373
|
Returns an API gateway
|
|
4369
4374
|
|
|
4370
4375
|
:param name: API gateway name
|
|
4371
|
-
:param project: optional str parameter to filter by project, if not passed,
|
|
4376
|
+
:param project: optional str parameter to filter by project, if not passed, active project value is taken
|
|
4372
4377
|
|
|
4373
4378
|
:returns: :py:class:`~mlrun.common.schemas.APIGateway`.
|
|
4374
4379
|
"""
|
|
4375
|
-
project = project or config.
|
|
4380
|
+
project = project or config.active_project
|
|
4376
4381
|
error = "get api gateway"
|
|
4377
4382
|
endpoint_path = f"projects/{project}/api-gateways/{name}"
|
|
4378
4383
|
response = self.api_call("GET", endpoint_path, error)
|
|
@@ -4385,7 +4390,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4385
4390
|
:param name: API gateway name
|
|
4386
4391
|
:param project: Project name
|
|
4387
4392
|
"""
|
|
4388
|
-
project = project or config.
|
|
4393
|
+
project = project or config.active_project
|
|
4389
4394
|
error = "delete api gateway"
|
|
4390
4395
|
endpoint_path = f"projects/{project}/api-gateways/{name}"
|
|
4391
4396
|
self.api_call("DELETE", endpoint_path, error)
|
|
@@ -4669,7 +4674,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4669
4674
|
def get_datastore_profile(
|
|
4670
4675
|
self, name: str, project: str
|
|
4671
4676
|
) -> Optional[mlrun.common.schemas.DatastoreProfile]:
|
|
4672
|
-
project = project or config.
|
|
4677
|
+
project = project or config.active_project
|
|
4673
4678
|
_path = self._path_of("datastore-profiles", project, name)
|
|
4674
4679
|
|
|
4675
4680
|
res = self.api_call(method="GET", path=_path)
|
|
@@ -4682,7 +4687,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4682
4687
|
return None
|
|
4683
4688
|
|
|
4684
4689
|
def delete_datastore_profile(self, name: str, project: str):
|
|
4685
|
-
project = project or config.
|
|
4690
|
+
project = project or config.active_project
|
|
4686
4691
|
_path = self._path_of("datastore-profiles", project, name)
|
|
4687
4692
|
self.api_call(method="DELETE", path=_path)
|
|
4688
4693
|
return None
|
|
@@ -4690,7 +4695,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4690
4695
|
def list_datastore_profiles(
|
|
4691
4696
|
self, project: str
|
|
4692
4697
|
) -> list[mlrun.common.schemas.DatastoreProfile]:
|
|
4693
|
-
project = project or config.
|
|
4698
|
+
project = project or config.active_project
|
|
4694
4699
|
_path = self._path_of("datastore-profiles", project)
|
|
4695
4700
|
|
|
4696
4701
|
res = self.api_call(method="GET", path=_path)
|
|
@@ -4710,7 +4715,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4710
4715
|
Create or replace a datastore profile.
|
|
4711
4716
|
:returns: None
|
|
4712
4717
|
"""
|
|
4713
|
-
project = project or config.
|
|
4718
|
+
project = project or config.active_project
|
|
4714
4719
|
_path = self._path_of("datastore-profiles", project)
|
|
4715
4720
|
|
|
4716
4721
|
self.api_call(method="PUT", path=_path, json=profile.dict())
|
|
@@ -4745,7 +4750,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4745
4750
|
if mlrun.mlconf.alerts.mode == mlrun.common.schemas.alert.AlertsModes.disabled:
|
|
4746
4751
|
logger.warning("Alerts are disabled, event will not be generated")
|
|
4747
4752
|
|
|
4748
|
-
project = project or config.
|
|
4753
|
+
project = project or config.active_project
|
|
4749
4754
|
endpoint_path = f"projects/{project}/events/{name}"
|
|
4750
4755
|
error_message = f"post event {project}/events/{name}"
|
|
4751
4756
|
if isinstance(event_data, mlrun.common.schemas.Event):
|
|
@@ -4778,7 +4783,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4778
4783
|
"Alerts are disabled, alert will still be stored but will not be triggered"
|
|
4779
4784
|
)
|
|
4780
4785
|
|
|
4781
|
-
project = project or config.
|
|
4786
|
+
project = project or config.active_project
|
|
4782
4787
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4783
4788
|
error_message = f"put alert {project}/alerts/{alert_name}"
|
|
4784
4789
|
alert_instance = (
|
|
@@ -4807,7 +4812,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4807
4812
|
|
|
4808
4813
|
:returns: The alert object.
|
|
4809
4814
|
"""
|
|
4810
|
-
project = project or config.
|
|
4815
|
+
project = project or config.active_project
|
|
4811
4816
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4812
4817
|
error_message = f"get alert {project}/alerts/{alert_name}"
|
|
4813
4818
|
response = self.api_call("GET", endpoint_path, error_message)
|
|
@@ -4826,7 +4831,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4826
4831
|
|
|
4827
4832
|
:returns: All the alerts objects of the project.
|
|
4828
4833
|
"""
|
|
4829
|
-
project = project or config.
|
|
4834
|
+
project = project or config.active_project
|
|
4830
4835
|
endpoint_path = f"projects/{project}/alerts"
|
|
4831
4836
|
error_message = f"get alerts {project}/alerts"
|
|
4832
4837
|
params = {}
|
|
@@ -4849,7 +4854,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4849
4854
|
:param alert_name: The name of the alert to delete.
|
|
4850
4855
|
:param project: The project that the alert belongs to.
|
|
4851
4856
|
"""
|
|
4852
|
-
project = project or config.
|
|
4857
|
+
project = project or config.active_project
|
|
4853
4858
|
endpoint_path = f"projects/{project}/alerts/{alert_name}"
|
|
4854
4859
|
error_message = f"delete alert {project}/alerts/{alert_name}"
|
|
4855
4860
|
self.api_call("DELETE", endpoint_path, error_message)
|
|
@@ -4861,7 +4866,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
4861
4866
|
:param alert_name: The name of the alert to reset.
|
|
4862
4867
|
:param project: The project that the alert belongs to.
|
|
4863
4868
|
"""
|
|
4864
|
-
project = project or config.
|
|
4869
|
+
project = project or config.active_project
|
|
4865
4870
|
endpoint_path = f"projects/{project}/alerts/{alert_name}/reset"
|
|
4866
4871
|
error_message = f"post alert {project}/alerts/{alert_name}/reset"
|
|
4867
4872
|
self.api_call("POST", endpoint_path, error_message)
|
|
@@ -5014,7 +5019,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5014
5019
|
:param activation_id: alert activation id.
|
|
5015
5020
|
:returns: alert activation object.
|
|
5016
5021
|
"""
|
|
5017
|
-
project = project or config.
|
|
5022
|
+
project = project or config.active_project
|
|
5018
5023
|
|
|
5019
5024
|
error = "get alert activation"
|
|
5020
5025
|
path = f"projects/{project}/alert-activations/{activation_id}"
|
|
@@ -5032,7 +5037,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5032
5037
|
:param project: Project name for which the summary belongs.
|
|
5033
5038
|
:returns: A summary of the project.
|
|
5034
5039
|
"""
|
|
5035
|
-
project = project or config.
|
|
5040
|
+
project = project or config.active_project
|
|
5036
5041
|
|
|
5037
5042
|
endpoint_path = f"project-summaries/{project}"
|
|
5038
5043
|
error_message = f"Failed retrieving project summary for {project}"
|
|
@@ -5096,9 +5101,16 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5096
5101
|
) -> tuple[ArtifactList, Optional[str]]:
|
|
5097
5102
|
"""Handles list artifacts, both paginated and not."""
|
|
5098
5103
|
|
|
5099
|
-
project = project or config.
|
|
5104
|
+
project = project or config.active_project
|
|
5100
5105
|
labels = self._parse_labels(labels)
|
|
5101
5106
|
|
|
5107
|
+
if limit:
|
|
5108
|
+
# TODO: Remove this in 1.11.0
|
|
5109
|
+
warnings.warn(
|
|
5110
|
+
"'limit' is deprecated and will be removed in 1.11.0. Use 'page' and 'page_size' instead.",
|
|
5111
|
+
FutureWarning,
|
|
5112
|
+
)
|
|
5113
|
+
|
|
5102
5114
|
params = {
|
|
5103
5115
|
"name": name,
|
|
5104
5116
|
"tag": tag,
|
|
@@ -5165,7 +5177,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5165
5177
|
) -> tuple[list, Optional[str]]:
|
|
5166
5178
|
"""Handles list functions, both paginated and not."""
|
|
5167
5179
|
|
|
5168
|
-
project = project or config.
|
|
5180
|
+
project = project or config.active_project
|
|
5169
5181
|
labels = self._parse_labels(labels)
|
|
5170
5182
|
params = {
|
|
5171
5183
|
"name": name,
|
|
@@ -5227,7 +5239,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5227
5239
|
) -> tuple[RunList, Optional[str]]:
|
|
5228
5240
|
"""Handles list runs, both paginated and not."""
|
|
5229
5241
|
|
|
5230
|
-
project = project or config.
|
|
5242
|
+
project = project or config.active_project
|
|
5231
5243
|
if with_notifications:
|
|
5232
5244
|
logger.warning(
|
|
5233
5245
|
"Local run notifications are not persisted in the DB, therefore local runs will not be returned when "
|
|
@@ -5235,9 +5247,9 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5235
5247
|
)
|
|
5236
5248
|
|
|
5237
5249
|
if state:
|
|
5238
|
-
# TODO: Remove this in 1.
|
|
5250
|
+
# TODO: Remove this in 1.10.0
|
|
5239
5251
|
warnings.warn(
|
|
5240
|
-
"'state' is deprecated and will be removed in 1.
|
|
5252
|
+
"'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
|
|
5241
5253
|
FutureWarning,
|
|
5242
5254
|
)
|
|
5243
5255
|
|
|
@@ -5330,7 +5342,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
5330
5342
|
page_token: Optional[str] = None,
|
|
5331
5343
|
return_all: bool = False,
|
|
5332
5344
|
) -> tuple[mlrun.common.schemas.AlertActivations, Optional[str]]:
|
|
5333
|
-
project = project or config.
|
|
5345
|
+
project = project or config.active_project
|
|
5334
5346
|
params = {
|
|
5335
5347
|
"name": name,
|
|
5336
5348
|
"since": datetime_to_iso(since),
|
mlrun/db/nopdb.py
CHANGED
|
@@ -630,7 +630,7 @@ class NopDB(RunDBInterface):
|
|
|
630
630
|
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
631
631
|
start: Optional[datetime.datetime] = None,
|
|
632
632
|
end: Optional[datetime.datetime] = None,
|
|
633
|
-
tsdb_metrics: bool =
|
|
633
|
+
tsdb_metrics: bool = False,
|
|
634
634
|
metric_list: Optional[list[str]] = None,
|
|
635
635
|
top_level: bool = False,
|
|
636
636
|
uids: Optional[list[str]] = None,
|