mlrun 1.10.0rc2__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.

Files changed (50) hide show
  1. mlrun/__init__.py +2 -2
  2. mlrun/__main__.py +2 -2
  3. mlrun/artifacts/base.py +6 -6
  4. mlrun/artifacts/dataset.py +1 -1
  5. mlrun/artifacts/document.py +1 -1
  6. mlrun/artifacts/model.py +1 -1
  7. mlrun/artifacts/plots.py +2 -2
  8. mlrun/common/runtimes/constants.py +1 -8
  9. mlrun/common/schemas/artifact.py +1 -1
  10. mlrun/common/schemas/pipeline.py +1 -1
  11. mlrun/common/schemas/project.py +1 -1
  12. mlrun/common/schemas/runs.py +1 -1
  13. mlrun/config.py +4 -4
  14. mlrun/datastore/datastore_profile.py +2 -2
  15. mlrun/datastore/sources.py +3 -3
  16. mlrun/datastore/store_resources.py +3 -3
  17. mlrun/datastore/targets.py +5 -5
  18. mlrun/datastore/utils.py +2 -2
  19. mlrun/db/base.py +6 -6
  20. mlrun/db/httpdb.py +66 -66
  21. mlrun/errors.py +22 -1
  22. mlrun/feature_store/common.py +5 -5
  23. mlrun/feature_store/feature_set.py +10 -6
  24. mlrun/feature_store/feature_vector.py +8 -6
  25. mlrun/launcher/base.py +1 -1
  26. mlrun/lists.py +1 -1
  27. mlrun/model_monitoring/__init__.py +0 -1
  28. mlrun/model_monitoring/api.py +0 -44
  29. mlrun/model_monitoring/applications/evidently/base.py +3 -41
  30. mlrun/model_monitoring/controller.py +1 -1
  31. mlrun/model_monitoring/writer.py +1 -4
  32. mlrun/projects/operations.py +3 -3
  33. mlrun/projects/project.py +19 -19
  34. mlrun/run.py +10 -10
  35. mlrun/runtimes/base.py +6 -6
  36. mlrun/runtimes/kubejob.py +2 -2
  37. mlrun/runtimes/nuclio/function.py +3 -3
  38. mlrun/runtimes/nuclio/serving.py +13 -23
  39. mlrun/serving/__init__.py +5 -1
  40. mlrun/serving/server.py +39 -3
  41. mlrun/serving/states.py +34 -1
  42. mlrun/utils/helpers.py +10 -4
  43. mlrun/utils/version/version.json +2 -2
  44. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.dist-info}/METADATA +21 -9
  45. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.dist-info}/RECORD +49 -50
  46. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.dist-info}/WHEEL +1 -1
  47. mlrun/model_monitoring/tracking_policy.py +0 -124
  48. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.dist-info}/entry_points.txt +0 -0
  49. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.dist-info}/licenses/LICENSE +0 -0
  50. {mlrun-1.10.0rc2.dist-info → mlrun-1.10.0rc3.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 default project (usually ``default``). Therefore, if performing an API to
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 ``default`` project.
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.default_project
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.default_project
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.default_project
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.default_project
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 default project will be used.
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.9.0)
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.default_project
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.default_project
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.default_project
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.default_project
1194
+ project = project or mlrun.mlconf.active_project
1195
1195
  endpoint_path = f"projects/{project}/artifacts/{key}"
1196
1196
  params = {
1197
1197
  "key": key,
@@ -1402,7 +1402,7 @@ class HTTPRunDB(RunDBInterface):
1402
1402
  :param days_ago: This parameter is deprecated and not used.
1403
1403
  :param tree: Delete artifacts filtered by tree.
1404
1404
  """
1405
- project = project or config.default_project
1405
+ project = project or config.active_project
1406
1406
  labels = self._parse_labels(labels)
1407
1407
 
1408
1408
  params = {
@@ -1423,7 +1423,7 @@ class HTTPRunDB(RunDBInterface):
1423
1423
  ) -> list[str]:
1424
1424
  """Return a list of all the tags assigned to artifacts in the scope of the given project."""
1425
1425
 
1426
- project = project or config.default_project
1426
+ project = project or config.active_project
1427
1427
  error_message = f"Failed listing artifact tags. project={project}"
1428
1428
  params = {"category": category} if category else {}
1429
1429
 
@@ -1446,7 +1446,7 @@ class HTTPRunDB(RunDBInterface):
1446
1446
  function = function.to_dict()
1447
1447
 
1448
1448
  params = {"tag": tag, "versioned": versioned}
1449
- project = project or config.default_project
1449
+ project = project or config.active_project
1450
1450
  path = f"projects/{project}/functions/{name}"
1451
1451
 
1452
1452
  error = f"store function {project}/{name}"
@@ -1461,7 +1461,7 @@ class HTTPRunDB(RunDBInterface):
1461
1461
  """Retrieve details of a specific function, identified by its name and potentially a tag or function hash."""
1462
1462
 
1463
1463
  params = {"tag": tag, "hash_key": hash_key}
1464
- project = project or config.default_project
1464
+ project = project or config.active_project
1465
1465
  path = f"projects/{project}/functions/{name}"
1466
1466
  error = f"get function {project}/{name}"
1467
1467
  resp = self.api_call("GET", path, error, params=params)
@@ -1470,7 +1470,7 @@ class HTTPRunDB(RunDBInterface):
1470
1470
  def delete_function(self, name: str, project: str = ""):
1471
1471
  """Delete a function belonging to a specific project."""
1472
1472
 
1473
- project = project or config.default_project
1473
+ project = project or config.active_project
1474
1474
  path = f"projects/{project}/functions/{name}"
1475
1475
  error_message = f"Failed deleting function {project}/{name}"
1476
1476
  response = self.api_call("DELETE", path, error_message, version="v2")
@@ -1515,7 +1515,7 @@ class HTTPRunDB(RunDBInterface):
1515
1515
  """Retrieve a list of functions, filtered by specific criteria.
1516
1516
 
1517
1517
  :param name: Return only functions with a specific name.
1518
- :param project: Return functions belonging to this project. If not specified, the default project is used.
1518
+ :param project: Return functions belonging to this project. If not specified, the active project is used.
1519
1519
  :param tag: Return function versions with specific tags. To return only tagged functions, set tag to ``"*"``.
1520
1520
  :param labels: Filter functions by label key-value pairs or key existence. This can be provided as:
1521
1521
  - A dictionary in the format `{"label": "value"}` to match specific label key-value pairs,
@@ -1740,7 +1740,7 @@ class HTTPRunDB(RunDBInterface):
1740
1740
  ):
1741
1741
  """Update an existing schedule, replace it with the details contained in the schedule object."""
1742
1742
 
1743
- project = project or config.default_project
1743
+ project = project or config.active_project
1744
1744
  path = f"projects/{project}/schedules/{name}"
1745
1745
 
1746
1746
  error_message = f"Failed updating schedule {project}/{name}"
@@ -1758,7 +1758,7 @@ class HTTPRunDB(RunDBInterface):
1758
1758
  :param include_last_run: Whether to include the results of the schedule's last run in the response.
1759
1759
  """
1760
1760
 
1761
- project = project or config.default_project
1761
+ project = project or config.active_project
1762
1762
  path = f"projects/{project}/schedules/{name}"
1763
1763
  error_message = f"Failed getting schedule for {project}/{name}"
1764
1764
  resp = self.api_call(
@@ -1786,7 +1786,7 @@ class HTTPRunDB(RunDBInterface):
1786
1786
  :param next_run_time_until: Return only schedules with next run time before this date.
1787
1787
  """
1788
1788
 
1789
- project = project or config.default_project
1789
+ project = project or config.active_project
1790
1790
  params = {
1791
1791
  "kind": kind,
1792
1792
  "name": name,
@@ -1802,7 +1802,7 @@ class HTTPRunDB(RunDBInterface):
1802
1802
  def delete_schedule(self, project: str, name: str):
1803
1803
  """Delete a specific schedule by name."""
1804
1804
 
1805
- project = project or config.default_project
1805
+ project = project or config.active_project
1806
1806
  path = f"projects/{project}/schedules/{name}"
1807
1807
  error_message = f"Failed deleting schedule {project}/{name}"
1808
1808
  self.api_call("DELETE", path, error_message)
@@ -1810,7 +1810,7 @@ class HTTPRunDB(RunDBInterface):
1810
1810
  def invoke_schedule(self, project: str, name: str):
1811
1811
  """Execute the object referenced by the schedule immediately."""
1812
1812
 
1813
- project = project or config.default_project
1813
+ project = project or config.active_project
1814
1814
  path = f"projects/{project}/schedules/{name}/invoke"
1815
1815
  error_message = f"Failed invoking schedule {project}/{name}"
1816
1816
  self.api_call("POST", path, error_message)
@@ -1871,7 +1871,7 @@ class HTTPRunDB(RunDBInterface):
1871
1871
  :param func: Function to build.
1872
1872
  :param builder_env: Kaniko builder pod env vars dict (for config/credentials)
1873
1873
  """
1874
- func.metadata.project = func.metadata.project or config.default_project
1874
+ func.metadata.project = func.metadata.project or config.active_project
1875
1875
  self.warn_on_s3_and_ecr_permissions_conflict(func)
1876
1876
  try:
1877
1877
  req = {
@@ -2057,7 +2057,7 @@ class HTTPRunDB(RunDBInterface):
2057
2057
  ) -> mlrun.common.schemas.BackgroundTask:
2058
2058
  """Retrieve updated information on a project background task being executed."""
2059
2059
 
2060
- project = project or config.default_project
2060
+ project = project or config.active_project
2061
2061
  path = f"projects/{project}/background-tasks/{name}"
2062
2062
  error_message = (
2063
2063
  f"Failed getting project background task. project={project}, name={name}"
@@ -2078,7 +2078,7 @@ class HTTPRunDB(RunDBInterface):
2078
2078
  Retrieve updated information on project background tasks being executed.
2079
2079
  If no filter is provided, will return background tasks from the last week.
2080
2080
 
2081
- :param project: Project name (defaults to mlrun.mlconf.default_project).
2081
+ :param project: Project name (defaults to mlrun.mlconf.active_project).
2082
2082
  :param state: List only background tasks whose state is specified.
2083
2083
  :param created_from: Filter by background task created time in ``[created_from, created_to]``.
2084
2084
  :param created_to: Filter by background task created time in ``[created_from, created_to]``.
@@ -2087,7 +2087,7 @@ class HTTPRunDB(RunDBInterface):
2087
2087
  :param last_update_time_to: Filter by background task last update time in
2088
2088
  ``(last_update_time_from, last_update_time_to)``.
2089
2089
  """
2090
- project = project or config.default_project
2090
+ project = project or config.active_project
2091
2091
  if (
2092
2092
  not state
2093
2093
  and not created_from
@@ -2439,7 +2439,7 @@ class HTTPRunDB(RunDBInterface):
2439
2439
  project = (
2440
2440
  project
2441
2441
  or feature_set["metadata"].get("project", None)
2442
- or config.default_project
2442
+ or config.active_project
2443
2443
  )
2444
2444
  path = f"projects/{project}/feature-sets"
2445
2445
  params = {"versioned": versioned}
@@ -2471,7 +2471,7 @@ class HTTPRunDB(RunDBInterface):
2471
2471
  :param uid: uid of the object to retrieve (can only be used for versioned objects).
2472
2472
  """
2473
2473
 
2474
- project = project or config.default_project
2474
+ project = project or config.active_project
2475
2475
  reference = self._resolve_reference(tag, uid)
2476
2476
  path = f"projects/{project}/feature-sets/{name}/references/{reference}"
2477
2477
  error_message = f"Failed retrieving feature-set {project}/{name}"
@@ -2507,7 +2507,7 @@ class HTTPRunDB(RunDBInterface):
2507
2507
  of the feature-set.
2508
2508
  """
2509
2509
 
2510
- project = project or config.default_project
2510
+ project = project or config.active_project
2511
2511
  labels = self._parse_labels(labels)
2512
2512
  params = {
2513
2513
  "name": name,
@@ -2549,7 +2549,7 @@ class HTTPRunDB(RunDBInterface):
2549
2549
  :returns: A list of features, and a list of their corresponding feature sets.
2550
2550
  """
2551
2551
 
2552
- project = project or config.default_project
2552
+ project = project or config.active_project
2553
2553
  labels = self._parse_labels(labels)
2554
2554
  params = {
2555
2555
  "name": name,
@@ -2588,7 +2588,7 @@ class HTTPRunDB(RunDBInterface):
2588
2588
  :returns: A list of entities.
2589
2589
  """
2590
2590
 
2591
- project = project or config.default_project
2591
+ project = project or config.active_project
2592
2592
  labels = self._parse_labels(labels)
2593
2593
  params = {
2594
2594
  "name": name,
@@ -2626,7 +2626,7 @@ class HTTPRunDB(RunDBInterface):
2626
2626
  :returns: A list of entities.
2627
2627
  """
2628
2628
 
2629
- project = project or config.default_project
2629
+ project = project or config.active_project
2630
2630
  labels = self._parse_labels(labels)
2631
2631
  params = {
2632
2632
  "name": name,
@@ -2707,7 +2707,7 @@ class HTTPRunDB(RunDBInterface):
2707
2707
  :returns: List of matching :py:class:`~mlrun.feature_store.FeatureSet` objects.
2708
2708
  """
2709
2709
 
2710
- project = project or config.default_project
2710
+ project = project or config.active_project
2711
2711
  labels = self._parse_labels(labels)
2712
2712
  params = {
2713
2713
  "name": name,
@@ -2772,7 +2772,7 @@ class HTTPRunDB(RunDBInterface):
2772
2772
 
2773
2773
  name = name or feature_set["metadata"]["name"]
2774
2774
  project = (
2775
- project or feature_set["metadata"].get("project") or config.default_project
2775
+ project or feature_set["metadata"].get("project") or config.active_project
2776
2776
  )
2777
2777
  path = f"projects/{project}/feature-sets/{name}/references/{reference}"
2778
2778
  error_message = f"Failed storing feature-set {project}/{name}"
@@ -2811,7 +2811,7 @@ class HTTPRunDB(RunDBInterface):
2811
2811
  :param patch_mode: The strategy for merging the changes with the existing object. Can be either ``replace``
2812
2812
  or ``additive``.
2813
2813
  """
2814
- project = project or config.default_project
2814
+ project = project or config.active_project
2815
2815
  reference = self._resolve_reference(tag, uid)
2816
2816
  headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
2817
2817
  path = f"projects/{project}/feature-sets/{name}/references/{reference}"
@@ -2830,7 +2830,7 @@ class HTTPRunDB(RunDBInterface):
2830
2830
  is not allowed.
2831
2831
  If none are specified, then all instances of the object whose name is ``name`` will be deleted.
2832
2832
  """
2833
- project = project or config.default_project
2833
+ project = project or config.active_project
2834
2834
  path = f"projects/{project}/feature-sets/{name}"
2835
2835
 
2836
2836
  if tag or uid:
@@ -2862,7 +2862,7 @@ class HTTPRunDB(RunDBInterface):
2862
2862
  project = (
2863
2863
  project
2864
2864
  or feature_vector["metadata"].get("project", None)
2865
- or config.default_project
2865
+ or config.active_project
2866
2866
  )
2867
2867
  path = f"projects/{project}/feature-vectors"
2868
2868
  params = {"versioned": versioned}
@@ -2888,7 +2888,7 @@ class HTTPRunDB(RunDBInterface):
2888
2888
  """Return a specific feature-vector referenced by its tag or uid. If none are provided, ``latest`` tag will
2889
2889
  be used."""
2890
2890
 
2891
- project = project or config.default_project
2891
+ project = project or config.active_project
2892
2892
  reference = self._resolve_reference(tag, uid)
2893
2893
  path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
2894
2894
  error_message = f"Failed retrieving feature-vector {project}/{name}"
@@ -2934,7 +2934,7 @@ class HTTPRunDB(RunDBInterface):
2934
2934
  :returns: List of matching :py:class:`~mlrun.feature_store.FeatureVector` objects.
2935
2935
  """
2936
2936
 
2937
- project = project or config.default_project
2937
+ project = project or config.active_project
2938
2938
  labels = self._parse_labels(labels)
2939
2939
  params = {
2940
2940
  "name": name,
@@ -2998,7 +2998,7 @@ class HTTPRunDB(RunDBInterface):
2998
2998
  project = (
2999
2999
  project
3000
3000
  or feature_vector["metadata"].get("project")
3001
- or config.default_project
3001
+ or config.active_project
3002
3002
  )
3003
3003
  path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
3004
3004
  error_message = f"Failed storing feature-vector {project}/{name}"
@@ -3033,7 +3033,7 @@ class HTTPRunDB(RunDBInterface):
3033
3033
  or ``additive``.
3034
3034
  """
3035
3035
  reference = self._resolve_reference(tag, uid)
3036
- project = project or config.default_project
3036
+ project = project or config.active_project
3037
3037
  headers = {mlrun.common.schemas.HeaderNames.patch_mode: patch_mode}
3038
3038
  path = f"projects/{project}/feature-vectors/{name}/references/{reference}"
3039
3039
  error_message = f"Failed updating feature-vector {project}/{name}"
@@ -3051,7 +3051,7 @@ class HTTPRunDB(RunDBInterface):
3051
3051
  is not allowed.
3052
3052
  If none are specified, then all instances of the object whose name is ``name`` will be deleted.
3053
3053
  """
3054
- project = project or config.default_project
3054
+ project = project or config.active_project
3055
3055
  path = f"projects/{project}/feature-vectors/{name}"
3056
3056
  if tag or uid:
3057
3057
  reference = self._resolve_reference(tag, uid)
@@ -4358,11 +4358,11 @@ class HTTPRunDB(RunDBInterface):
4358
4358
  """
4359
4359
  Returns a list of Nuclio api gateways
4360
4360
 
4361
- :param project: optional str parameter to filter by project, if not passed, default project value is taken
4361
+ :param project: optional str parameter to filter by project, if not passed, active project value is taken
4362
4362
 
4363
4363
  :returns: :py:class:`~mlrun.common.schemas.APIGateways`.
4364
4364
  """
4365
- project = project or config.default_project
4365
+ project = project or config.active_project
4366
4366
  error = "list api gateways"
4367
4367
  endpoint_path = f"projects/{project}/api-gateways"
4368
4368
  response = self.api_call("GET", endpoint_path, error)
@@ -4373,11 +4373,11 @@ class HTTPRunDB(RunDBInterface):
4373
4373
  Returns an API gateway
4374
4374
 
4375
4375
  :param name: API gateway name
4376
- :param project: optional str parameter to filter by project, if not passed, default project value is taken
4376
+ :param project: optional str parameter to filter by project, if not passed, active project value is taken
4377
4377
 
4378
4378
  :returns: :py:class:`~mlrun.common.schemas.APIGateway`.
4379
4379
  """
4380
- project = project or config.default_project
4380
+ project = project or config.active_project
4381
4381
  error = "get api gateway"
4382
4382
  endpoint_path = f"projects/{project}/api-gateways/{name}"
4383
4383
  response = self.api_call("GET", endpoint_path, error)
@@ -4390,7 +4390,7 @@ class HTTPRunDB(RunDBInterface):
4390
4390
  :param name: API gateway name
4391
4391
  :param project: Project name
4392
4392
  """
4393
- project = project or config.default_project
4393
+ project = project or config.active_project
4394
4394
  error = "delete api gateway"
4395
4395
  endpoint_path = f"projects/{project}/api-gateways/{name}"
4396
4396
  self.api_call("DELETE", endpoint_path, error)
@@ -4674,7 +4674,7 @@ class HTTPRunDB(RunDBInterface):
4674
4674
  def get_datastore_profile(
4675
4675
  self, name: str, project: str
4676
4676
  ) -> Optional[mlrun.common.schemas.DatastoreProfile]:
4677
- project = project or config.default_project
4677
+ project = project or config.active_project
4678
4678
  _path = self._path_of("datastore-profiles", project, name)
4679
4679
 
4680
4680
  res = self.api_call(method="GET", path=_path)
@@ -4687,7 +4687,7 @@ class HTTPRunDB(RunDBInterface):
4687
4687
  return None
4688
4688
 
4689
4689
  def delete_datastore_profile(self, name: str, project: str):
4690
- project = project or config.default_project
4690
+ project = project or config.active_project
4691
4691
  _path = self._path_of("datastore-profiles", project, name)
4692
4692
  self.api_call(method="DELETE", path=_path)
4693
4693
  return None
@@ -4695,7 +4695,7 @@ class HTTPRunDB(RunDBInterface):
4695
4695
  def list_datastore_profiles(
4696
4696
  self, project: str
4697
4697
  ) -> list[mlrun.common.schemas.DatastoreProfile]:
4698
- project = project or config.default_project
4698
+ project = project or config.active_project
4699
4699
  _path = self._path_of("datastore-profiles", project)
4700
4700
 
4701
4701
  res = self.api_call(method="GET", path=_path)
@@ -4715,7 +4715,7 @@ class HTTPRunDB(RunDBInterface):
4715
4715
  Create or replace a datastore profile.
4716
4716
  :returns: None
4717
4717
  """
4718
- project = project or config.default_project
4718
+ project = project or config.active_project
4719
4719
  _path = self._path_of("datastore-profiles", project)
4720
4720
 
4721
4721
  self.api_call(method="PUT", path=_path, json=profile.dict())
@@ -4750,7 +4750,7 @@ class HTTPRunDB(RunDBInterface):
4750
4750
  if mlrun.mlconf.alerts.mode == mlrun.common.schemas.alert.AlertsModes.disabled:
4751
4751
  logger.warning("Alerts are disabled, event will not be generated")
4752
4752
 
4753
- project = project or config.default_project
4753
+ project = project or config.active_project
4754
4754
  endpoint_path = f"projects/{project}/events/{name}"
4755
4755
  error_message = f"post event {project}/events/{name}"
4756
4756
  if isinstance(event_data, mlrun.common.schemas.Event):
@@ -4783,7 +4783,7 @@ class HTTPRunDB(RunDBInterface):
4783
4783
  "Alerts are disabled, alert will still be stored but will not be triggered"
4784
4784
  )
4785
4785
 
4786
- project = project or config.default_project
4786
+ project = project or config.active_project
4787
4787
  endpoint_path = f"projects/{project}/alerts/{alert_name}"
4788
4788
  error_message = f"put alert {project}/alerts/{alert_name}"
4789
4789
  alert_instance = (
@@ -4812,7 +4812,7 @@ class HTTPRunDB(RunDBInterface):
4812
4812
 
4813
4813
  :returns: The alert object.
4814
4814
  """
4815
- project = project or config.default_project
4815
+ project = project or config.active_project
4816
4816
  endpoint_path = f"projects/{project}/alerts/{alert_name}"
4817
4817
  error_message = f"get alert {project}/alerts/{alert_name}"
4818
4818
  response = self.api_call("GET", endpoint_path, error_message)
@@ -4831,7 +4831,7 @@ class HTTPRunDB(RunDBInterface):
4831
4831
 
4832
4832
  :returns: All the alerts objects of the project.
4833
4833
  """
4834
- project = project or config.default_project
4834
+ project = project or config.active_project
4835
4835
  endpoint_path = f"projects/{project}/alerts"
4836
4836
  error_message = f"get alerts {project}/alerts"
4837
4837
  params = {}
@@ -4854,7 +4854,7 @@ class HTTPRunDB(RunDBInterface):
4854
4854
  :param alert_name: The name of the alert to delete.
4855
4855
  :param project: The project that the alert belongs to.
4856
4856
  """
4857
- project = project or config.default_project
4857
+ project = project or config.active_project
4858
4858
  endpoint_path = f"projects/{project}/alerts/{alert_name}"
4859
4859
  error_message = f"delete alert {project}/alerts/{alert_name}"
4860
4860
  self.api_call("DELETE", endpoint_path, error_message)
@@ -4866,7 +4866,7 @@ class HTTPRunDB(RunDBInterface):
4866
4866
  :param alert_name: The name of the alert to reset.
4867
4867
  :param project: The project that the alert belongs to.
4868
4868
  """
4869
- project = project or config.default_project
4869
+ project = project or config.active_project
4870
4870
  endpoint_path = f"projects/{project}/alerts/{alert_name}/reset"
4871
4871
  error_message = f"post alert {project}/alerts/{alert_name}/reset"
4872
4872
  self.api_call("POST", endpoint_path, error_message)
@@ -5019,7 +5019,7 @@ class HTTPRunDB(RunDBInterface):
5019
5019
  :param activation_id: alert activation id.
5020
5020
  :returns: alert activation object.
5021
5021
  """
5022
- project = project or config.default_project
5022
+ project = project or config.active_project
5023
5023
 
5024
5024
  error = "get alert activation"
5025
5025
  path = f"projects/{project}/alert-activations/{activation_id}"
@@ -5037,7 +5037,7 @@ class HTTPRunDB(RunDBInterface):
5037
5037
  :param project: Project name for which the summary belongs.
5038
5038
  :returns: A summary of the project.
5039
5039
  """
5040
- project = project or config.default_project
5040
+ project = project or config.active_project
5041
5041
 
5042
5042
  endpoint_path = f"project-summaries/{project}"
5043
5043
  error_message = f"Failed retrieving project summary for {project}"
@@ -5101,7 +5101,7 @@ class HTTPRunDB(RunDBInterface):
5101
5101
  ) -> tuple[ArtifactList, Optional[str]]:
5102
5102
  """Handles list artifacts, both paginated and not."""
5103
5103
 
5104
- project = project or config.default_project
5104
+ project = project or config.active_project
5105
5105
  labels = self._parse_labels(labels)
5106
5106
 
5107
5107
  if limit:
@@ -5177,7 +5177,7 @@ class HTTPRunDB(RunDBInterface):
5177
5177
  ) -> tuple[list, Optional[str]]:
5178
5178
  """Handles list functions, both paginated and not."""
5179
5179
 
5180
- project = project or config.default_project
5180
+ project = project or config.active_project
5181
5181
  labels = self._parse_labels(labels)
5182
5182
  params = {
5183
5183
  "name": name,
@@ -5239,7 +5239,7 @@ class HTTPRunDB(RunDBInterface):
5239
5239
  ) -> tuple[RunList, Optional[str]]:
5240
5240
  """Handles list runs, both paginated and not."""
5241
5241
 
5242
- project = project or config.default_project
5242
+ project = project or config.active_project
5243
5243
  if with_notifications:
5244
5244
  logger.warning(
5245
5245
  "Local run notifications are not persisted in the DB, therefore local runs will not be returned when "
@@ -5247,9 +5247,9 @@ class HTTPRunDB(RunDBInterface):
5247
5247
  )
5248
5248
 
5249
5249
  if state:
5250
- # TODO: Remove this in 1.9.0
5250
+ # TODO: Remove this in 1.10.0
5251
5251
  warnings.warn(
5252
- "'state' is deprecated and will be removed in 1.9.0. Use 'states' instead.",
5252
+ "'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
5253
5253
  FutureWarning,
5254
5254
  )
5255
5255
 
@@ -5342,7 +5342,7 @@ class HTTPRunDB(RunDBInterface):
5342
5342
  page_token: Optional[str] = None,
5343
5343
  return_all: bool = False,
5344
5344
  ) -> tuple[mlrun.common.schemas.AlertActivations, Optional[str]]:
5345
- project = project or config.default_project
5345
+ project = project or config.active_project
5346
5346
  params = {
5347
5347
  "name": name,
5348
5348
  "since": datetime_to_iso(since),
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,
@@ -63,7 +63,7 @@ def parse_project_name_from_feature_string(feature):
63
63
 
64
64
  def parse_feature_set_uri(uri, project=None):
65
65
  """get feature set object from db by uri"""
66
- default_project = project or config.default_project
66
+ active_project = project or config.active_project
67
67
 
68
68
  # parse store://.. uri
69
69
  if mlrun.datastore.is_store_uri(uri):
@@ -74,7 +74,7 @@ def parse_feature_set_uri(uri, project=None):
74
74
  )
75
75
  uri = new_uri
76
76
 
77
- return parse_versioned_object_uri(uri, default_project)
77
+ return parse_versioned_object_uri(uri, active_project)
78
78
 
79
79
 
80
80
  def get_feature_set_by_uri(uri, project=None):
@@ -98,7 +98,7 @@ def get_feature_set_by_uri(uri, project=None):
98
98
  def get_feature_vector_by_uri(uri, project=None, update=True):
99
99
  """get feature vector object from db by uri"""
100
100
  db = mlrun.get_run_db()
101
- default_project = project or config.default_project
101
+ active_project = project or config.active_project
102
102
 
103
103
  # parse store://.. uri
104
104
  if mlrun.datastore.is_store_uri(uri):
@@ -109,7 +109,7 @@ def get_feature_vector_by_uri(uri, project=None, update=True):
109
109
  )
110
110
  uri = new_uri
111
111
 
112
- project, name, tag, uid = parse_versioned_object_uri(uri, default_project)
112
+ project, name, tag, uid = parse_versioned_object_uri(uri, active_project)
113
113
 
114
114
  resource = mlrun.common.schemas.AuthorizationResourceTypes.feature_vector.to_resource_string(
115
115
  project, "feature-vector"
@@ -161,7 +161,7 @@ def verify_feature_set_exists(feature_set):
161
161
  def verify_feature_vector_permissions(
162
162
  feature_vector, action: mlrun.common.schemas.AuthorizationAction
163
163
  ):
164
- project = feature_vector._metadata.project or config.default_project
164
+ project = feature_vector._metadata.project or config.active_project
165
165
 
166
166
  resource = mlrun.common.schemas.AuthorizationResourceTypes.feature_vector.to_resource_string(
167
167
  project, "feature-vector"
@@ -413,11 +413,15 @@ class FeatureSet(ModelObj):
413
413
  @property
414
414
  def fullname(self) -> str:
415
415
  """full name in the form ``{project}/{name}[:{tag}]``"""
416
- fullname = (
417
- f"{self._metadata.project or mlconf.default_project}/{self._metadata.name}"
418
- )
419
- if self._metadata.tag:
420
- fullname += ":" + self._metadata.tag
416
+ project = self._metadata.project or mlconf.active_project
417
+ name = self._metadata.name
418
+ tag = self._metadata.tag
419
+
420
+ fullname = name
421
+ if project:
422
+ fullname = f"{project}/{fullname}"
423
+ if tag:
424
+ fullname += f":{tag}"
421
425
  return fullname
422
426
 
423
427
  def _get_run_db(self):
@@ -971,7 +975,7 @@ class FeatureSet(ModelObj):
971
975
  def save(self, tag="", versioned=False):
972
976
  """save to mlrun db"""
973
977
  db = self._get_run_db()
974
- self.metadata.project = self.metadata.project or mlconf.default_project
978
+ self.metadata.project = self.metadata.project or mlconf.active_project
975
979
  tag = tag or self.metadata.tag or "latest"
976
980
  as_dict = self.to_dict()
977
981
  as_dict["spec"]["features"] = as_dict["spec"].get(