mlrun 1.9.0rc4__py3-none-any.whl → 1.9.0rc5__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 (47) hide show
  1. mlrun/__main__.py +13 -3
  2. mlrun/artifacts/base.py +5 -5
  3. mlrun/artifacts/dataset.py +1 -1
  4. mlrun/artifacts/model.py +1 -1
  5. mlrun/artifacts/plots.py +2 -2
  6. mlrun/common/constants.py +7 -0
  7. mlrun/common/runtimes/constants.py +1 -1
  8. mlrun/common/schemas/artifact.py +1 -1
  9. mlrun/common/schemas/pipeline.py +1 -1
  10. mlrun/common/schemas/project.py +1 -1
  11. mlrun/common/schemas/runs.py +1 -1
  12. mlrun/config.py +5 -5
  13. mlrun/datastore/datastore.py +1 -1
  14. mlrun/datastore/datastore_profile.py +2 -2
  15. mlrun/datastore/sources.py +3 -3
  16. mlrun/datastore/targets.py +4 -4
  17. mlrun/datastore/utils.py +2 -2
  18. mlrun/db/base.py +7 -7
  19. mlrun/db/httpdb.py +18 -14
  20. mlrun/db/nopdb.py +1 -1
  21. mlrun/execution.py +1 -1
  22. mlrun/frameworks/_common/model_handler.py +2 -2
  23. mlrun/launcher/client.py +1 -1
  24. mlrun/model_monitoring/api.py +4 -4
  25. mlrun/model_monitoring/applications/_application_steps.py +3 -1
  26. mlrun/model_monitoring/applications/evidently/base.py +59 -71
  27. mlrun/model_monitoring/controller.py +26 -13
  28. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +13 -5
  29. mlrun/model_monitoring/tracking_policy.py +1 -1
  30. mlrun/model_monitoring/writer.py +1 -1
  31. mlrun/projects/operations.py +3 -3
  32. mlrun/projects/project.py +20 -20
  33. mlrun/render.py +5 -9
  34. mlrun/run.py +1 -1
  35. mlrun/runtimes/base.py +5 -5
  36. mlrun/runtimes/kubejob.py +2 -2
  37. mlrun/runtimes/nuclio/function.py +2 -2
  38. mlrun/runtimes/nuclio/serving.py +4 -4
  39. mlrun/runtimes/utils.py +25 -8
  40. mlrun/utils/helpers.py +3 -2
  41. mlrun/utils/version/version.json +2 -2
  42. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/METADATA +9 -9
  43. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/RECORD +47 -47
  44. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/WHEEL +1 -1
  45. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/entry_points.txt +0 -0
  46. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/licenses/LICENSE +0 -0
  47. {mlrun-1.9.0rc4.dist-info → mlrun-1.9.0rc5.dist-info}/top_level.txt +0 -0
@@ -14,19 +14,18 @@
14
14
 
15
15
  import json
16
16
  import posixpath
17
- import uuid
18
17
  import warnings
19
18
  from abc import ABC
19
+ from tempfile import NamedTemporaryFile
20
+ from typing import Optional
20
21
 
21
- import pandas as pd
22
22
  import semver
23
- from evidently.ui.storage.local.base import METADATA_PATH, FSLocation
24
23
 
25
24
  import mlrun.model_monitoring.applications.base as mm_base
26
25
  import mlrun.model_monitoring.applications.context as mm_context
27
- from mlrun.errors import MLRunIncompatibleVersionError
26
+ from mlrun.errors import MLRunIncompatibleVersionError, MLRunValueError
28
27
 
29
- SUPPORTED_EVIDENTLY_VERSION = semver.Version.parse("0.6.0")
28
+ SUPPORTED_EVIDENTLY_VERSION = semver.Version.parse("0.7.5")
30
29
 
31
30
 
32
31
  def _check_evidently_version(*, cur: semver.Version, ref: semver.Version) -> None:
@@ -60,36 +59,66 @@ except ModuleNotFoundError:
60
59
 
61
60
 
62
61
  if _HAS_EVIDENTLY:
63
- from evidently.suite.base_suite import Display
64
- from evidently.ui.type_aliases import STR_UUID
65
- from evidently.ui.workspace import Workspace
66
- from evidently.utils.dashboard import TemplateParams, file_html_template
62
+ from evidently.core.report import Snapshot
63
+ from evidently.legacy.ui.storage.local.base import METADATA_PATH, FSLocation
64
+ from evidently.ui.workspace import (
65
+ STR_UUID,
66
+ CloudWorkspace,
67
+ Project,
68
+ Workspace,
69
+ WorkspaceBase,
70
+ )
67
71
 
68
72
 
69
73
  class EvidentlyModelMonitoringApplicationBase(
70
74
  mm_base.ModelMonitoringApplicationBase, ABC
71
75
  ):
72
76
  def __init__(
73
- self, evidently_workspace_path: str, evidently_project_id: "STR_UUID"
77
+ self,
78
+ evidently_project_id: "STR_UUID",
79
+ evidently_workspace_path: Optional[str] = None,
80
+ cloud_workspace: bool = False,
74
81
  ) -> None:
75
82
  """
76
- A class for integrating Evidently for mlrun model monitoring within a monitoring application.
77
- Note: evidently is not installed by default in the mlrun/mlrun image.
78
- It must be installed separately to use this class.
83
+ A class for integrating Evidently for MLRun model monitoring within a monitoring application.
84
+
85
+ .. note::
86
+
87
+ The ``evidently`` package is not installed by default in the mlrun/mlrun image.
88
+ It must be installed separately to use this class.
79
89
 
80
- :param evidently_workspace_path: (str) The path to the Evidently workspace.
81
90
  :param evidently_project_id: (str) The ID of the Evidently project.
91
+ :param evidently_workspace_path: (str) The path to the Evidently workspace.
92
+ :param cloud_workspace: (bool) Whether the workspace is an Evidently Cloud workspace.
82
93
  """
83
-
84
- # TODO : more then one project (mep -> project)
85
94
  if not _HAS_EVIDENTLY:
86
95
  raise ModuleNotFoundError("Evidently is not installed - the app cannot run")
87
- self._log_location(evidently_workspace_path)
88
- self.evidently_workspace = Workspace.create(evidently_workspace_path)
96
+ self.evidently_workspace_path = evidently_workspace_path
97
+ if cloud_workspace:
98
+ self.get_workspace = self.get_cloud_workspace
99
+ self.evidently_workspace = self.get_workspace()
89
100
  self.evidently_project_id = evidently_project_id
90
- self.evidently_project = self.evidently_workspace.get_project(
91
- evidently_project_id
92
- )
101
+ self.evidently_project = self.load_project()
102
+
103
+ def load_project(self) -> Project:
104
+ """Load the Evidently project."""
105
+ return self.evidently_workspace.get_project(self.evidently_project_id)
106
+
107
+ def get_workspace(self) -> WorkspaceBase:
108
+ """Get the Evidently workspace. Override this method for customize access to the workspace."""
109
+ if self.evidently_workspace_path:
110
+ self._log_location(self.evidently_workspace_path)
111
+ return Workspace.create(self.evidently_workspace_path)
112
+ else:
113
+ raise MLRunValueError(
114
+ "A local workspace could not be created as `evidently_workspace_path` is not set.\n"
115
+ "If you intend to use a cloud workspace, please use `cloud_workspace=True` and set the "
116
+ "`EVIDENTLY_API_KEY` environment variable. In other cases, override this method."
117
+ )
118
+
119
+ def get_cloud_workspace(self) -> CloudWorkspace:
120
+ """Load the Evidently cloud workspace according to the `EVIDENTLY_API_KEY` environment variable."""
121
+ return CloudWorkspace()
93
122
 
94
123
  @staticmethod
95
124
  def _log_location(evidently_workspace_path):
@@ -128,7 +157,7 @@ class EvidentlyModelMonitoringApplicationBase(
128
157
  @staticmethod
129
158
  def log_evidently_object(
130
159
  monitoring_context: mm_context.MonitoringApplicationContext,
131
- evidently_object: "Display",
160
+ evidently_object: "Snapshot",
132
161
  artifact_name: str,
133
162
  unique_per_endpoint: bool = True,
134
163
  ) -> None:
@@ -141,56 +170,15 @@ class EvidentlyModelMonitoringApplicationBase(
141
170
  This method should be called on special occasions only.
142
171
 
143
172
  :param monitoring_context: (MonitoringApplicationContext) The monitoring context to process.
144
- :param evidently_object: (Display) The Evidently display to log, e.g. a report or a test suite object.
145
- :param artifact_name: (str) The name for the logged artifact.
146
- :param unique_per_endpoint: by default ``True``, we will log different artifact for each model endpoint,
147
- set to ``False`` without changing item key will cause artifact override.
148
- """
149
- evidently_object_html = evidently_object.get_html()
150
- monitoring_context.log_artifact(
151
- artifact_name,
152
- body=evidently_object_html.encode("utf-8"),
153
- format="html",
154
- unique_per_endpoint=unique_per_endpoint,
155
- )
156
-
157
- def log_project_dashboard(
158
- self,
159
- monitoring_context: mm_context.MonitoringApplicationContext,
160
- timestamp_start: pd.Timestamp,
161
- timestamp_end: pd.Timestamp,
162
- artifact_name: str = "dashboard",
163
- unique_per_endpoint: bool = True,
164
- ) -> None:
165
- """
166
- Logs an Evidently project dashboard.
167
-
168
- .. caution::
169
-
170
- Logging Evidently dashboards in every model monitoring window may cause scale issues.
171
- This method should be called on special occasions only.
172
-
173
- :param monitoring_context: (MonitoringApplicationContext) The monitoring context to process.
174
- :param timestamp_start: (pd.Timestamp) The start timestamp for the dashboard data.
175
- :param timestamp_end: (pd.Timestamp) The end timestamp for the dashboard data.
173
+ :param evidently_object: (Snapshot) The Evidently run to log, e.g. a report run.
176
174
  :param artifact_name: (str) The name for the logged artifact.
177
175
  :param unique_per_endpoint: by default ``True``, we will log different artifact for each model endpoint,
178
176
  set to ``False`` without changing item key will cause artifact override.
179
177
  """
180
-
181
- dashboard_info = self.evidently_project.build_dashboard_info(
182
- timestamp_start, timestamp_end
183
- )
184
- template_params = TemplateParams(
185
- dashboard_id="pd_" + str(uuid.uuid4()).replace("-", ""),
186
- dashboard_info=dashboard_info,
187
- additional_graphs={},
188
- )
189
-
190
- dashboard_html = file_html_template(params=template_params)
191
- monitoring_context.log_artifact(
192
- artifact_name,
193
- body=dashboard_html.encode("utf-8"),
194
- format="html",
195
- unique_per_endpoint=unique_per_endpoint,
196
- )
178
+ with NamedTemporaryFile(suffix=".html") as file:
179
+ evidently_object.save_html(filename=file.name)
180
+ monitoring_context.log_artifact(
181
+ artifact_name,
182
+ local_path=file.name,
183
+ unique_per_endpoint=unique_per_endpoint,
184
+ )
@@ -25,6 +25,7 @@ from types import TracebackType
25
25
  from typing import Any, NamedTuple, Optional, Union, cast
26
26
 
27
27
  import nuclio_sdk
28
+ import pandas as pd
28
29
 
29
30
  import mlrun
30
31
  import mlrun.common.schemas.model_monitoring.constants as mm_constants
@@ -673,9 +674,15 @@ class MonitoringApplicationController:
673
674
  """
674
675
  logger.info("Starting monitoring controller chief")
675
676
  applications_names = []
676
- endpoints = self.project_obj.list_model_endpoints(
677
- metric_list=["last_request"]
678
- ).endpoints
677
+ endpoints = self.project_obj.list_model_endpoints(tsdb_metrics=False).endpoints
678
+ last_request_dict = self.tsdb_connector.get_last_request(
679
+ endpoint_ids=[mep.metadata.uid for mep in endpoints]
680
+ )
681
+ if isinstance(last_request_dict, pd.DataFrame):
682
+ last_request_dict = last_request_dict.set_index(
683
+ mm_constants.EventFieldType.ENDPOINT_ID
684
+ )[mm_constants.ModelEndpointSchema.LAST_REQUEST].to_dict()
685
+
679
686
  if not endpoints:
680
687
  logger.info("No model endpoints found", project=self.project)
681
688
  return
@@ -721,16 +728,22 @@ class MonitoringApplicationController:
721
728
  with schedules.ModelMonitoringSchedulesFileChief(
722
729
  self.project
723
730
  ) as schedule_file:
724
- futures = {
725
- pool.submit(
726
- self.endpoint_to_regular_event,
727
- endpoint,
728
- policy,
729
- set(applications_names),
730
- schedule_file,
731
- ): endpoint
732
- for endpoint in endpoints
733
- }
731
+ for endpoint in endpoints:
732
+ last_request = last_request_dict.get(endpoint.metadata.uid, None)
733
+ if isinstance(last_request, float):
734
+ last_request = pd.to_datetime(last_request, unit="s", utc=True)
735
+ endpoint.status.last_request = (
736
+ last_request or endpoint.status.last_request
737
+ )
738
+ futures = {
739
+ pool.submit(
740
+ self.endpoint_to_regular_event,
741
+ endpoint,
742
+ policy,
743
+ set(applications_names),
744
+ schedule_file,
745
+ ): endpoint
746
+ }
734
747
  for future in concurrent.futures.as_completed(futures):
735
748
  if future.exception():
736
749
  exception = future.exception()
@@ -455,12 +455,20 @@ class V3IOTSDBConnector(TSDBConnector):
455
455
  # Delete all tables
456
456
  tables = mm_schemas.V3IOTSDBTables.list()
457
457
  for table_to_delete in tables:
458
- try:
459
- self.frames_client.delete(backend=_TSDB_BE, table=table_to_delete)
460
- except v3io_frames.DeleteError as e:
458
+ if table_to_delete in self.tables:
459
+ try:
460
+ self.frames_client.delete(
461
+ backend=_TSDB_BE, table=self.tables[table_to_delete]
462
+ )
463
+ except v3io_frames.DeleteError as e:
464
+ logger.warning(
465
+ f"Failed to delete TSDB table '{table_to_delete}'",
466
+ err=mlrun.errors.err_to_str(e),
467
+ )
468
+ else:
461
469
  logger.warning(
462
- f"Failed to delete TSDB table '{table}'",
463
- err=mlrun.errors.err_to_str(e),
470
+ f"Skipping deletion: table '{table_to_delete}' is not among the initialized tables.",
471
+ initialized_tables=list(self.tables.keys()),
464
472
  )
465
473
 
466
474
  # Final cleanup of tsdb path
@@ -57,7 +57,7 @@ class TrackingPolicy(mlrun.model.ModelObj):
57
57
  """
58
58
  warnings.warn(
59
59
  "The `TrackingPolicy` class is deprecated from version 1.7.0 and is not "
60
- "used anymore. It will be removed in 1.9.0.",
60
+ "used anymore. It will be removed in 1.10.0.",
61
61
  FutureWarning,
62
62
  )
63
63
 
@@ -129,7 +129,7 @@ class ModelMonitoringWriter(StepToDict):
129
129
  )
130
130
  kind = event.pop(WriterEvent.EVENT_KIND, WriterEventKind.RESULT)
131
131
  result_event = _AppResultEvent(json.loads(event.pop(WriterEvent.DATA, "{}")))
132
- if not result_event: # BC for < 1.7.0, can be removed in 1.9.0
132
+ if not result_event: # BC for < 1.7.0, can be removed in 1.10.0
133
133
  result_event = _AppResultEvent(event)
134
134
  else:
135
135
  result_event.update(_AppResultEvent(event))
@@ -294,9 +294,9 @@ def build_function(
294
294
  :param force_build: Force building the image, even when no changes were made
295
295
  """
296
296
  if not overwrite_build_params:
297
- # TODO: change overwrite_build_params default to True in 1.9.0
297
+ # TODO: change overwrite_build_params default to True in 1.10.0
298
298
  warnings.warn(
299
- "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.9.0.",
299
+ "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
300
300
  mlrun.utils.OverwriteBuildParamsWarning,
301
301
  )
302
302
 
@@ -325,7 +325,7 @@ def build_function(
325
325
  skip_deployed=skip_deployed,
326
326
  )
327
327
  else:
328
- # TODO: remove filter once overwrite_build_params default is changed to True in 1.9.0
328
+ # TODO: remove filter once overwrite_build_params default is changed to True in 1.10.0
329
329
  with warnings.catch_warnings():
330
330
  warnings.simplefilter(
331
331
  "ignore", category=mlrun.utils.OverwriteBuildParamsWarning
mlrun/projects/project.py CHANGED
@@ -756,10 +756,10 @@ def _project_instance_from_struct(struct, name, allow_cross_project):
756
756
  )
757
757
 
758
758
  if allow_cross_project is None:
759
- # TODO: Remove this warning in version 1.9.0 and also fix cli to support allow_cross_project
759
+ # TODO: Remove this warning in version 1.10.0 and also fix cli to support allow_cross_project
760
760
  warnings.warn(
761
761
  f"Project {name=} is different than specified on the context's project yaml. "
762
- "This behavior is deprecated and will not be supported from version 1.9.0."
762
+ "This behavior is deprecated and will not be supported from version 1.10.0."
763
763
  )
764
764
  logger.warn(error_message)
765
765
  elif allow_cross_project:
@@ -2478,9 +2478,9 @@ class MlrunProject(ModelObj):
2478
2478
  :param fetch_credentials_from_sys_config: If true, fetch the credentials from the system configuration.
2479
2479
  """
2480
2480
  if default_controller_image != "mlrun/mlrun":
2481
- # TODO: Remove this in 1.9.0
2481
+ # TODO: Remove this in 1.10.0
2482
2482
  warnings.warn(
2483
- "'default_controller_image' is deprecated and will be removed in 1.9.0, "
2483
+ "'default_controller_image' is deprecated in 1.7.0 and will be removed in 1.10.0, "
2484
2484
  "use 'image' instead",
2485
2485
  FutureWarning,
2486
2486
  )
@@ -2860,10 +2860,10 @@ class MlrunProject(ModelObj):
2860
2860
 
2861
2861
  self.spec.set_function(name, function_object, func)
2862
2862
 
2863
- # TODO: Remove this in 1.10.0
2863
+ # TODO: Remove this in 1.11.0
2864
2864
  @deprecated.deprecated(
2865
2865
  version="1.8.0",
2866
- reason="'remove_function' is deprecated and will be removed in 1.10.0. "
2866
+ reason="'remove_function' is deprecated and will be removed in 1.11.0. "
2867
2867
  "Please use `delete_function` instead.",
2868
2868
  category=FutureWarning,
2869
2869
  )
@@ -2891,9 +2891,9 @@ class MlrunProject(ModelObj):
2891
2891
 
2892
2892
  :param name: name of the model-monitoring-function/s (under the project)
2893
2893
  """
2894
- # TODO: Remove this in 1.9.0
2894
+ # TODO: Remove this in 1.10.0
2895
2895
  warnings.warn(
2896
- "'remove_model_monitoring_function' is deprecated and will be removed in 1.9.0. "
2896
+ "'remove_model_monitoring_function' is deprecated in 1.7.0 and will be removed in 1.10.0. "
2897
2897
  "Please use `delete_model_monitoring_function` instead.",
2898
2898
  FutureWarning,
2899
2899
  )
@@ -3795,7 +3795,7 @@ class MlrunProject(ModelObj):
3795
3795
  top_level: bool = False,
3796
3796
  uids: Optional[list[str]] = None,
3797
3797
  latest_only: bool = False,
3798
- tsdb_metrics: bool = True,
3798
+ tsdb_metrics: bool = False,
3799
3799
  metric_list: Optional[list[str]] = None,
3800
3800
  ) -> mlrun.common.schemas.ModelEndpointList:
3801
3801
  """
@@ -4064,9 +4064,9 @@ class MlrunProject(ModelObj):
4064
4064
  (by default `/home/mlrun_code`)
4065
4065
  """
4066
4066
  if not overwrite_build_params:
4067
- # TODO: change overwrite_build_params default to True in 1.9.0
4067
+ # TODO: change overwrite_build_params default to True in 1.10.0
4068
4068
  warnings.warn(
4069
- "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.9.0.",
4069
+ "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
4070
4070
  mlrun.utils.OverwriteBuildParamsWarning,
4071
4071
  )
4072
4072
  default_image_name = mlrun.mlconf.default_project_image_name.format(
@@ -4141,9 +4141,9 @@ class MlrunProject(ModelObj):
4141
4141
  )
4142
4142
 
4143
4143
  if not overwrite_build_params:
4144
- # TODO: change overwrite_build_params default to True in 1.9.0
4144
+ # TODO: change overwrite_build_params default to True in 1.10.0
4145
4145
  warnings.warn(
4146
- "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.9.0.",
4146
+ "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
4147
4147
  mlrun.utils.OverwriteBuildParamsWarning,
4148
4148
  )
4149
4149
 
@@ -4322,7 +4322,7 @@ class MlrunProject(ModelObj):
4322
4322
  :param kind: Return artifacts of the requested kind.
4323
4323
  :param category: Return artifacts of the requested category.
4324
4324
  :param tree: Return artifacts of the requested tree.
4325
- :param limit: Deprecated - Maximum number of artifacts to return (will be removed in 1.10.0).
4325
+ :param limit: Deprecated - Maximum number of artifacts to return (will be removed in 1.11.0).
4326
4326
  :param format_: The format in which to return the artifacts. Default is 'full'.
4327
4327
  :param partition_by: Field to group results by. When `partition_by` is specified, the `partition_sort_by`
4328
4328
  parameter must be provided as well.
@@ -4335,9 +4335,9 @@ class MlrunProject(ModelObj):
4335
4335
  db = mlrun.db.get_run_db(secrets=self._secrets)
4336
4336
 
4337
4337
  if limit:
4338
- # TODO: Remove this in 1.10.0
4338
+ # TODO: Remove this in 1.11.0
4339
4339
  warnings.warn(
4340
- "'limit' is deprecated and will be removed in 1.10.0. Use 'page' and 'page_size' instead.",
4340
+ "'limit' is deprecated and will be removed in 1.11.0. Use 'page' and 'page_size' instead.",
4341
4341
  FutureWarning,
4342
4342
  )
4343
4343
 
@@ -4467,7 +4467,7 @@ class MlrunProject(ModelObj):
4467
4467
  artifacts generated from a hyper-param run. If only a single iteration exists, will return the artifact
4468
4468
  from that iteration. If using ``best_iter``, the ``iter`` parameter must not be used.
4469
4469
  :param tree: Return artifacts of the requested tree.
4470
- :param limit: Maximum number of artifacts to return.
4470
+ :param limit: Deprecated - Maximum number of artifacts to return (will be removed in 1.11.0).
4471
4471
  :param format_: The format in which to return the artifacts. Default is 'full'.
4472
4472
  """
4473
4473
  db = mlrun.db.get_run_db(secrets=self._secrets)
@@ -4734,7 +4734,7 @@ class MlrunProject(ModelObj):
4734
4734
  :param states: List only runs whose state is one of the provided states.
4735
4735
  :param sort: Whether to sort the result according to their start time. Otherwise, results will be
4736
4736
  returned by their internal order in the DB (order will not be guaranteed).
4737
- :param last: Deprecated - currently not used (will be removed in 1.9.0).
4737
+ :param last: Deprecated - currently not used (will be removed in 1.10.0).
4738
4738
  :param iter: If ``True`` return runs from all iterations. Otherwise, return only runs whose ``iter`` is 0.
4739
4739
  :param start_time_from: Filter by run start time in ``[start_time_from, start_time_to]``.
4740
4740
  :param start_time_to: Filter by run start time in ``[start_time_from, start_time_to]``.
@@ -4745,9 +4745,9 @@ class MlrunProject(ModelObj):
4745
4745
  :param end_time_to: Filter by run end time in ``[end_time_from, end_time_to]``.
4746
4746
  """
4747
4747
  if state:
4748
- # TODO: Remove this in 1.9.0
4748
+ # TODO: Remove this in 1.10.0
4749
4749
  warnings.warn(
4750
- "'state' is deprecated and will be removed in 1.9.0. Use 'states' instead.",
4750
+ "'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
4751
4751
  FutureWarning,
4752
4752
  )
4753
4753
 
mlrun/render.py CHANGED
@@ -361,9 +361,6 @@ def get_tblframe(df, display, classes=None):
361
361
  return ipython_display(html, display)
362
362
 
363
363
 
364
- uid_template = '<div title="{}"><a href="{}/{}/{}/jobs/monitor/{}/overview" target="_blank" >...{}</a></div>'
365
-
366
-
367
364
  def runs_to_html(
368
365
  df: pd.DataFrame,
369
366
  display: bool = True,
@@ -379,15 +376,14 @@ def runs_to_html(
379
376
  df["results"] = df["results"].apply(dict_html)
380
377
  df["start"] = df["start"].apply(time_str)
381
378
  df["parameters"] = df["parameters"].apply(dict_html)
379
+ uid_template = '<div title="{}"><a href="{}" target="_blank" >...{}</a></div>'
380
+
382
381
  if config.resolve_ui_url():
383
382
  df["uid"] = df.apply(
384
383
  lambda x: uid_template.format(
385
- x.uid,
386
- config.resolve_ui_url(),
387
- config.ui.projects_prefix,
388
- x.project,
389
- x.uid,
390
- x.uid[-8:],
384
+ x["uid"],
385
+ mlrun.utils.get_run_url(x["project"], x["uid"], x["name"]),
386
+ x["uid"][-8:],
391
387
  ),
392
388
  axis=1,
393
389
  )
mlrun/run.py CHANGED
@@ -261,7 +261,7 @@ def get_or_create_ctx(
261
261
  """
262
262
  if labels:
263
263
  warnings.warn(
264
- "The `labels` argument is deprecated and will be removed in 1.9.0. "
264
+ "The `labels` argument is deprecated in 1.7.0 and will be removed in 1.10.0. "
265
265
  "Please use `spec` instead, e.g.:\n"
266
266
  "spec={'metadata': {'labels': {'key': 'value'}}}",
267
267
  FutureWarning,
mlrun/runtimes/base.py CHANGED
@@ -148,10 +148,10 @@ class FunctionSpec(ModelObj):
148
148
 
149
149
  @property
150
150
  def clone_target_dir(self):
151
- # TODO: remove this property in 1.9.0
151
+ # TODO: remove this property in 1.10.0
152
152
  if self.build.source_code_target_dir:
153
153
  warnings.warn(
154
- "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.9.0. "
154
+ "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.10.0. "
155
155
  "Use spec.build.source_code_target_dir instead.",
156
156
  FutureWarning,
157
157
  )
@@ -159,10 +159,10 @@ class FunctionSpec(ModelObj):
159
159
 
160
160
  @clone_target_dir.setter
161
161
  def clone_target_dir(self, clone_target_dir):
162
- # TODO: remove this property in 1.9.0
162
+ # TODO: remove this property in 1.10.0
163
163
  if clone_target_dir:
164
164
  warnings.warn(
165
- "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.9.0. "
165
+ "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.10.0. "
166
166
  "Use spec.build.source_code_target_dir instead.",
167
167
  FutureWarning,
168
168
  )
@@ -489,7 +489,7 @@ class BaseRuntime(ModelObj):
489
489
  def _store_function(self, runspec, meta, db):
490
490
  meta.labels["kind"] = self.kind
491
491
  mlrun.runtimes.utils.enrich_run_labels(
492
- meta.labels, [mlrun.common.runtimes.constants.RunLabels.owner]
492
+ meta.labels, [mlrun_constants.MLRunInternalLabels.owner]
493
493
  )
494
494
  if runspec.spec.output_path:
495
495
  runspec.spec.output_path = runspec.spec.output_path.replace(
mlrun/runtimes/kubejob.py CHANGED
@@ -114,9 +114,9 @@ class KubejobRuntime(KubeResource):
114
114
  e.g. builder_env={"GIT_TOKEN": token}
115
115
  """
116
116
  if not overwrite:
117
- # TODO: change overwrite default to True in 1.9.0
117
+ # TODO: change overwrite default to True in 1.10.0
118
118
  warnings.warn(
119
- "The `overwrite` parameter default will change from 'False' to 'True' in 1.9.0.",
119
+ "The `overwrite` parameter default will change from 'False' to 'True' in 1.10.0.",
120
120
  mlrun.utils.OverwriteBuildParamsWarning,
121
121
  )
122
122
  image = mlrun.utils.helpers.remove_image_protocol_prefix(image)
@@ -623,9 +623,9 @@ class RemoteRuntime(KubeResource):
623
623
  :param force_build: set True for force building the image
624
624
  """
625
625
  if auth_info:
626
- # TODO: remove in 1.9.0
626
+ # TODO: remove in 1.10.0
627
627
  warnings.warn(
628
- "'auth_info' is deprecated for nuclio runtimes in 1.7.0 and will be removed in 1.9.0",
628
+ "'auth_info' is deprecated for nuclio runtimes in 1.7.0 and will be removed in 1.10.0",
629
629
  FutureWarning,
630
630
  )
631
631
 
@@ -44,7 +44,7 @@ from .function import NuclioSpec, RemoteRuntime, min_nuclio_versions
44
44
  serving_subkind = "serving_v2"
45
45
 
46
46
  if TYPE_CHECKING:
47
- # remove this block in 1.9.0
47
+ # remove this block in 1.10.0
48
48
  from mlrun.model_monitoring import TrackingPolicy
49
49
 
50
50
 
@@ -361,8 +361,8 @@ class ServingRuntime(RemoteRuntime):
361
361
  if batch:
362
362
  warnings.warn(
363
363
  "The `batch` size parameter was deprecated in version 1.8.0 and is no longer used. "
364
- "It will be removed in 1.10.",
365
- # TODO: Remove this in 1.10
364
+ "It will be removed in 1.11.",
365
+ # TODO: Remove this in 1.11
366
366
  FutureWarning,
367
367
  )
368
368
  if stream_args:
@@ -370,7 +370,7 @@ class ServingRuntime(RemoteRuntime):
370
370
  if tracking_policy is not None:
371
371
  warnings.warn(
372
372
  "The `tracking_policy` argument is deprecated from version 1.7.0 "
373
- "and has no effect. It will be removed in 1.9.0.\n"
373
+ "and has no effect. It will be removed in 1.10.0.\n"
374
374
  "To set the desired model monitoring time window and schedule, use "
375
375
  "the `base_period` argument in `project.enable_model_monitoring()`.",
376
376
  FutureWarning,
mlrun/runtimes/utils.py CHANGED
@@ -11,6 +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
+ import enum
14
15
  import getpass
15
16
  import hashlib
16
17
  import json
@@ -28,7 +29,6 @@ import mlrun.common.constants as mlrun_constants
28
29
  import mlrun.common.schemas
29
30
  import mlrun.utils.regex
30
31
  from mlrun.artifacts import TableArtifact
31
- from mlrun.common.runtimes.constants import RunLabels
32
32
  from mlrun.config import config
33
33
  from mlrun.errors import err_to_str
34
34
  from mlrun.frameworks.parallel_coordinates import gen_pcp_plot
@@ -433,18 +433,35 @@ def enrich_function_from_dict(function, function_dict):
433
433
 
434
434
  def enrich_run_labels(
435
435
  labels: dict,
436
- labels_to_enrich: Optional[list[RunLabels]] = None,
436
+ labels_to_enrich: Optional[list[mlrun_constants.MLRunInternalLabels]] = None,
437
437
  ):
438
+ """
439
+ Enrich the run labels with the internal labels and the labels enrichment extension
440
+ :param labels: The run labels dict
441
+ :param labels_to_enrich: The label keys to enrich from MLRunInternalLabels.default_run_labels_to_enrich
442
+ :return: The enriched labels dict
443
+ """
444
+ # Merge the labels with the labels enrichment extension
438
445
  labels_enrichment = {
439
- RunLabels.owner: os.environ.get("V3IO_USERNAME") or getpass.getuser(),
440
- # TODO: remove this in 1.9.0
441
- RunLabels.v3io_user: os.environ.get("V3IO_USERNAME"),
446
+ mlrun_constants.MLRunInternalLabels.owner: os.environ.get("V3IO_USERNAME")
447
+ or getpass.getuser(),
448
+ # TODO: remove this in 1.10.0
449
+ mlrun_constants.MLRunInternalLabels.v3io_user: os.environ.get("V3IO_USERNAME"),
442
450
  }
443
- labels_to_enrich = labels_to_enrich or RunLabels.all()
451
+
452
+ # Resolve which label keys to enrich
453
+ if labels_to_enrich is None:
454
+ labels_to_enrich = (
455
+ mlrun_constants.MLRunInternalLabels.default_run_labels_to_enrich()
456
+ )
457
+
458
+ # Enrich labels
444
459
  for label in labels_to_enrich:
460
+ if isinstance(label, enum.Enum):
461
+ label = label.value
445
462
  enrichment = labels_enrichment.get(label)
446
- if label.value not in labels and enrichment:
447
- labels[label.value] = enrichment
463
+ if label not in labels and enrichment:
464
+ labels[label] = enrichment
448
465
  return labels
449
466
 
450
467
 
mlrun/utils/helpers.py CHANGED
@@ -2224,8 +2224,9 @@ class Workflow:
2224
2224
  namespace=mlrun.mlconf.namespace,
2225
2225
  )
2226
2226
 
2227
- # arbitrary timeout of 5 seconds, the workflow should be done by now
2228
- kfp_run = kfp_client.wait_for_run_completion(workflow_id, 5)
2227
+ # arbitrary timeout of 60 seconds, the workflow should be done by now, however sometimes kfp takes a few
2228
+ # seconds to update the workflow status
2229
+ kfp_run = kfp_client.wait_for_run_completion(workflow_id, 60)
2229
2230
  if not kfp_run:
2230
2231
  return None
2231
2232
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "git_commit": "f19c66499d330c4ab0f375d6fb392bf9c6ffb6db",
3
- "version": "1.9.0-rc4"
2
+ "git_commit": "6a74fb2c76fb2f1f30c94f16336a8df6e14d5ed4",
3
+ "version": "1.9.0-rc5"
4
4
  }