mlrun 1.10.0rc18__py3-none-any.whl → 1.11.0rc16__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 (167) hide show
  1. mlrun/__init__.py +24 -3
  2. mlrun/__main__.py +0 -4
  3. mlrun/artifacts/dataset.py +2 -2
  4. mlrun/artifacts/document.py +6 -1
  5. mlrun/artifacts/llm_prompt.py +21 -15
  6. mlrun/artifacts/model.py +3 -3
  7. mlrun/artifacts/plots.py +1 -1
  8. mlrun/{model_monitoring/db/tsdb/tdengine → auth}/__init__.py +2 -3
  9. mlrun/auth/nuclio.py +89 -0
  10. mlrun/auth/providers.py +429 -0
  11. mlrun/auth/utils.py +415 -0
  12. mlrun/common/constants.py +14 -0
  13. mlrun/common/model_monitoring/helpers.py +123 -0
  14. mlrun/common/runtimes/constants.py +28 -0
  15. mlrun/common/schemas/__init__.py +14 -3
  16. mlrun/common/schemas/alert.py +2 -2
  17. mlrun/common/schemas/api_gateway.py +3 -0
  18. mlrun/common/schemas/auth.py +12 -10
  19. mlrun/common/schemas/client_spec.py +4 -0
  20. mlrun/common/schemas/constants.py +25 -0
  21. mlrun/common/schemas/frontend_spec.py +1 -8
  22. mlrun/common/schemas/function.py +34 -0
  23. mlrun/common/schemas/hub.py +33 -20
  24. mlrun/common/schemas/model_monitoring/__init__.py +2 -1
  25. mlrun/common/schemas/model_monitoring/constants.py +12 -15
  26. mlrun/common/schemas/model_monitoring/functions.py +13 -4
  27. mlrun/common/schemas/model_monitoring/model_endpoints.py +11 -0
  28. mlrun/common/schemas/pipeline.py +1 -1
  29. mlrun/common/schemas/secret.py +17 -2
  30. mlrun/common/secrets.py +95 -1
  31. mlrun/common/types.py +10 -10
  32. mlrun/config.py +69 -19
  33. mlrun/data_types/infer.py +2 -2
  34. mlrun/datastore/__init__.py +12 -5
  35. mlrun/datastore/azure_blob.py +162 -47
  36. mlrun/datastore/base.py +274 -10
  37. mlrun/datastore/datastore.py +7 -2
  38. mlrun/datastore/datastore_profile.py +84 -22
  39. mlrun/datastore/model_provider/huggingface_provider.py +225 -41
  40. mlrun/datastore/model_provider/mock_model_provider.py +87 -0
  41. mlrun/datastore/model_provider/model_provider.py +206 -74
  42. mlrun/datastore/model_provider/openai_provider.py +226 -66
  43. mlrun/datastore/s3.py +39 -18
  44. mlrun/datastore/sources.py +1 -1
  45. mlrun/datastore/store_resources.py +4 -4
  46. mlrun/datastore/storeytargets.py +17 -12
  47. mlrun/datastore/targets.py +1 -1
  48. mlrun/datastore/utils.py +25 -6
  49. mlrun/datastore/v3io.py +1 -1
  50. mlrun/db/base.py +63 -32
  51. mlrun/db/httpdb.py +373 -153
  52. mlrun/db/nopdb.py +54 -21
  53. mlrun/errors.py +4 -2
  54. mlrun/execution.py +66 -25
  55. mlrun/feature_store/api.py +1 -1
  56. mlrun/feature_store/common.py +1 -1
  57. mlrun/feature_store/feature_vector_utils.py +1 -1
  58. mlrun/feature_store/steps.py +8 -6
  59. mlrun/frameworks/_common/utils.py +3 -3
  60. mlrun/frameworks/_dl_common/loggers/logger.py +1 -1
  61. mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +2 -1
  62. mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +1 -1
  63. mlrun/frameworks/_ml_common/utils.py +2 -1
  64. mlrun/frameworks/auto_mlrun/auto_mlrun.py +4 -3
  65. mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +2 -1
  66. mlrun/frameworks/onnx/dataset.py +2 -1
  67. mlrun/frameworks/onnx/mlrun_interface.py +2 -1
  68. mlrun/frameworks/pytorch/callbacks/logging_callback.py +5 -4
  69. mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +2 -1
  70. mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +2 -1
  71. mlrun/frameworks/pytorch/utils.py +2 -1
  72. mlrun/frameworks/sklearn/metric.py +2 -1
  73. mlrun/frameworks/tf_keras/callbacks/logging_callback.py +5 -4
  74. mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +2 -1
  75. mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +2 -1
  76. mlrun/hub/__init__.py +52 -0
  77. mlrun/hub/base.py +142 -0
  78. mlrun/hub/module.py +172 -0
  79. mlrun/hub/step.py +113 -0
  80. mlrun/k8s_utils.py +105 -16
  81. mlrun/launcher/base.py +15 -7
  82. mlrun/launcher/local.py +4 -1
  83. mlrun/model.py +14 -4
  84. mlrun/model_monitoring/__init__.py +0 -1
  85. mlrun/model_monitoring/api.py +65 -28
  86. mlrun/model_monitoring/applications/__init__.py +1 -1
  87. mlrun/model_monitoring/applications/base.py +299 -128
  88. mlrun/model_monitoring/applications/context.py +2 -4
  89. mlrun/model_monitoring/controller.py +132 -58
  90. mlrun/model_monitoring/db/_schedules.py +38 -29
  91. mlrun/model_monitoring/db/_stats.py +6 -16
  92. mlrun/model_monitoring/db/tsdb/__init__.py +9 -7
  93. mlrun/model_monitoring/db/tsdb/base.py +29 -9
  94. mlrun/model_monitoring/db/tsdb/preaggregate.py +234 -0
  95. mlrun/model_monitoring/db/tsdb/stream_graph_steps.py +63 -0
  96. mlrun/model_monitoring/db/tsdb/timescaledb/queries/timescaledb_metrics_queries.py +414 -0
  97. mlrun/model_monitoring/db/tsdb/timescaledb/queries/timescaledb_predictions_queries.py +376 -0
  98. mlrun/model_monitoring/db/tsdb/timescaledb/queries/timescaledb_results_queries.py +590 -0
  99. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_connection.py +434 -0
  100. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_connector.py +541 -0
  101. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_operations.py +808 -0
  102. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_schema.py +502 -0
  103. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_stream.py +163 -0
  104. mlrun/model_monitoring/db/tsdb/timescaledb/timescaledb_stream_graph_steps.py +60 -0
  105. mlrun/model_monitoring/db/tsdb/timescaledb/utils/timescaledb_dataframe_processor.py +141 -0
  106. mlrun/model_monitoring/db/tsdb/timescaledb/utils/timescaledb_query_builder.py +585 -0
  107. mlrun/model_monitoring/db/tsdb/timescaledb/writer_graph_steps.py +73 -0
  108. mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +20 -9
  109. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +235 -51
  110. mlrun/model_monitoring/features_drift_table.py +2 -1
  111. mlrun/model_monitoring/helpers.py +30 -6
  112. mlrun/model_monitoring/stream_processing.py +34 -28
  113. mlrun/model_monitoring/writer.py +224 -4
  114. mlrun/package/__init__.py +2 -1
  115. mlrun/platforms/__init__.py +0 -43
  116. mlrun/platforms/iguazio.py +8 -4
  117. mlrun/projects/operations.py +17 -11
  118. mlrun/projects/pipelines.py +2 -2
  119. mlrun/projects/project.py +187 -123
  120. mlrun/run.py +95 -21
  121. mlrun/runtimes/__init__.py +2 -186
  122. mlrun/runtimes/base.py +103 -25
  123. mlrun/runtimes/constants.py +225 -0
  124. mlrun/runtimes/daskjob.py +5 -2
  125. mlrun/runtimes/databricks_job/databricks_runtime.py +2 -1
  126. mlrun/runtimes/local.py +5 -2
  127. mlrun/runtimes/mounts.py +20 -2
  128. mlrun/runtimes/nuclio/__init__.py +12 -7
  129. mlrun/runtimes/nuclio/api_gateway.py +36 -6
  130. mlrun/runtimes/nuclio/application/application.py +339 -40
  131. mlrun/runtimes/nuclio/function.py +222 -72
  132. mlrun/runtimes/nuclio/serving.py +132 -42
  133. mlrun/runtimes/pod.py +213 -21
  134. mlrun/runtimes/utils.py +49 -9
  135. mlrun/secrets.py +99 -14
  136. mlrun/serving/__init__.py +2 -0
  137. mlrun/serving/remote.py +84 -11
  138. mlrun/serving/routers.py +26 -44
  139. mlrun/serving/server.py +138 -51
  140. mlrun/serving/serving_wrapper.py +6 -2
  141. mlrun/serving/states.py +997 -283
  142. mlrun/serving/steps.py +62 -0
  143. mlrun/serving/system_steps.py +149 -95
  144. mlrun/serving/v2_serving.py +9 -10
  145. mlrun/track/trackers/mlflow_tracker.py +29 -31
  146. mlrun/utils/helpers.py +292 -94
  147. mlrun/utils/http.py +9 -2
  148. mlrun/utils/notifications/notification/base.py +18 -0
  149. mlrun/utils/notifications/notification/git.py +3 -5
  150. mlrun/utils/notifications/notification/mail.py +39 -16
  151. mlrun/utils/notifications/notification/slack.py +2 -4
  152. mlrun/utils/notifications/notification/webhook.py +2 -5
  153. mlrun/utils/notifications/notification_pusher.py +3 -3
  154. mlrun/utils/version/version.json +2 -2
  155. mlrun/utils/version/version.py +3 -4
  156. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/METADATA +63 -74
  157. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/RECORD +161 -143
  158. mlrun/api/schemas/__init__.py +0 -259
  159. mlrun/db/auth_utils.py +0 -152
  160. mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +0 -344
  161. mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +0 -75
  162. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +0 -281
  163. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +0 -1266
  164. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/WHEEL +0 -0
  165. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/entry_points.txt +0 -0
  166. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/licenses/LICENSE +0 -0
  167. {mlrun-1.10.0rc18.dist-info → mlrun-1.11.0rc16.dist-info}/top_level.txt +0 -0
mlrun/datastore/utils.py CHANGED
@@ -190,12 +190,12 @@ def validate_additional_filters(additional_filters):
190
190
  for filter_tuple in additional_filters:
191
191
  if filter_tuple == () or filter_tuple == []:
192
192
  continue
193
- if not isinstance(filter_tuple, (list, tuple)):
193
+ if not isinstance(filter_tuple, list | tuple):
194
194
  raise mlrun.errors.MLRunInvalidArgumentError(
195
195
  f"mlrun supports additional_filters only as a list of tuples."
196
196
  f" Current additional_filters: {additional_filters}"
197
197
  )
198
- if isinstance(filter_tuple[0], (list, tuple)):
198
+ if isinstance(filter_tuple[0], list | tuple):
199
199
  raise mlrun.errors.MLRunInvalidArgumentError(
200
200
  f"additional_filters does not support nested list inside filter tuples except in -in- logic."
201
201
  f" Current filter_tuple: {filter_tuple}."
@@ -208,7 +208,7 @@ def validate_additional_filters(additional_filters):
208
208
  col_name, op, value = filter_tuple
209
209
  if isinstance(value, float) and math.isnan(value):
210
210
  raise mlrun.errors.MLRunInvalidArgumentError(nan_error_message)
211
- elif isinstance(value, (list, tuple)):
211
+ elif isinstance(value, list | tuple):
212
212
  for sub_value in value:
213
213
  if isinstance(sub_value, float) and math.isnan(sub_value):
214
214
  raise mlrun.errors.MLRunInvalidArgumentError(nan_error_message)
@@ -320,7 +320,13 @@ def parse_url(url):
320
320
  parsed_url = urlparse(url)
321
321
  schema = parsed_url.scheme.lower()
322
322
  endpoint = parsed_url.hostname
323
- if endpoint:
323
+
324
+ # Special handling for WASBS URLs to preserve container information
325
+ if schema in ["wasbs", "wasb"] and parsed_url.netloc and "@" in parsed_url.netloc:
326
+ # For wasbs://container@host format, preserve the full netloc as endpoint
327
+ # This allows the datastore to extract container later
328
+ endpoint = parsed_url.netloc
329
+ elif endpoint:
324
330
  # HACK - urlparse returns the hostname after in lower case - we want the original case:
325
331
  # the hostname is a substring of the netloc, in which it's the original case, so we find the indexes of the
326
332
  # hostname in the netloc and take it from there
@@ -331,11 +337,24 @@ def parse_url(url):
331
337
  endpoint = netloc[
332
338
  hostname_index_in_netloc : hostname_index_in_netloc + len(lower_hostname)
333
339
  ]
334
- if parsed_url.port:
335
- endpoint += f":{parsed_url.port}"
340
+ if parsed_url.port:
341
+ endpoint += f":{parsed_url.port}"
336
342
  return schema, endpoint, parsed_url
337
343
 
338
344
 
339
345
  def accepts_param(func: callable, param_name):
340
346
  sig = inspect.signature(func)
341
347
  return param_name in sig.parameters
348
+
349
+
350
+ def parse_s3_bucket_and_key(s3_path: str) -> tuple[str, str]:
351
+ try:
352
+ path_parts = s3_path.replace("s3://", "").split("/")
353
+ bucket = path_parts.pop(0)
354
+ key = "/".join(path_parts)
355
+ except Exception as exc:
356
+ raise mlrun.errors.MLRunInvalidArgumentError(
357
+ "failed to parse s3 bucket and key"
358
+ ) from exc
359
+
360
+ return bucket, key
mlrun/datastore/v3io.py CHANGED
@@ -57,7 +57,7 @@ class V3ioStore(DataStore):
57
57
  self.auth = None
58
58
  self.token = token
59
59
  if token:
60
- self.headers = {"X-v3io-session-key": token}
60
+ self.headers = {mlrun.common.schemas.HeaderNames.v3io_session_key: token}
61
61
  elif username and password:
62
62
  self.headers = basic_auth_header(username, password)
63
63
 
mlrun/db/base.py CHANGED
@@ -16,8 +16,6 @@ import datetime
16
16
  from abc import ABC, abstractmethod
17
17
  from typing import Literal, Optional, Union
18
18
 
19
- from deprecated import deprecated
20
-
21
19
  import mlrun.alerts
22
20
  import mlrun.common
23
21
  import mlrun.common.formatters
@@ -190,7 +188,6 @@ class RunDBInterface(ABC):
190
188
  tree: Optional[str] = None,
191
189
  parent: Optional[str] = None,
192
190
  format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
193
- limit: Optional[int] = None,
194
191
  partition_by: Optional[
195
192
  Union[mlrun.common.schemas.ArtifactPartitionByField, str]
196
193
  ] = None,
@@ -445,23 +442,6 @@ class RunDBInterface(ABC):
445
442
  ) -> dict:
446
443
  pass
447
444
 
448
- # TODO: remove in 1.10.0
449
- @deprecated(
450
- version="1.7.0",
451
- reason="'list_features' will be removed in 1.10.0, use 'list_features_v2' instead",
452
- category=FutureWarning,
453
- )
454
- @abstractmethod
455
- def list_features(
456
- self,
457
- project: str,
458
- name: Optional[str] = None,
459
- tag: Optional[str] = None,
460
- entities: Optional[list[str]] = None,
461
- labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
462
- ) -> mlrun.common.schemas.FeaturesOutput:
463
- pass
464
-
465
445
  @abstractmethod
466
446
  def list_features_v2(
467
447
  self,
@@ -694,17 +674,6 @@ class RunDBInterface(ABC):
694
674
  ):
695
675
  pass
696
676
 
697
- @abstractmethod
698
- def create_user_secrets(
699
- self,
700
- user: str,
701
- provider: Union[
702
- str, mlrun.common.schemas.SecretProviderName
703
- ] = mlrun.common.schemas.SecretProviderName.vault,
704
- secrets: Optional[dict] = None,
705
- ):
706
- pass
707
-
708
677
  @abstractmethod
709
678
  def create_model_endpoint(
710
679
  self,
@@ -741,7 +710,9 @@ class RunDBInterface(ABC):
741
710
  tsdb_metrics: bool = False,
742
711
  metric_list: Optional[list[str]] = None,
743
712
  top_level: bool = False,
744
- mode: Optional[mlrun.common.schemas.EndpointMode] = None,
713
+ modes: Optional[
714
+ Union[mm_constants.EndpointMode, list[mm_constants.EndpointMode]]
715
+ ] = None,
745
716
  uids: Optional[list[str]] = None,
746
717
  latest_only: bool = False,
747
718
  ) -> mlrun.common.schemas.ModelEndpointList:
@@ -793,6 +764,7 @@ class RunDBInterface(ABC):
793
764
  item_name: Optional[str] = None,
794
765
  tag: Optional[str] = None,
795
766
  version: Optional[str] = None,
767
+ item_type: mlrun.common.schemas.hub.HubSourceType = mlrun.common.schemas.hub.HubSourceType.functions,
796
768
  ):
797
769
  pass
798
770
 
@@ -811,6 +783,7 @@ class RunDBInterface(ABC):
811
783
  version: Optional[str] = None,
812
784
  tag: Optional[str] = None,
813
785
  force_refresh: bool = False,
786
+ object_type: mlrun.common.schemas.hub.HubSourceType = mlrun.common.schemas.hub.HubSourceType.functions,
814
787
  ):
815
788
  pass
816
789
 
@@ -822,6 +795,19 @@ class RunDBInterface(ABC):
822
795
  version: Optional[str] = None,
823
796
  tag: str = "latest",
824
797
  force_refresh: bool = False,
798
+ item_type: mlrun.common.schemas.hub.HubSourceType = mlrun.common.schemas.hub.HubSourceType.functions,
799
+ ):
800
+ pass
801
+
802
+ @abstractmethod
803
+ def get_hub_asset(
804
+ self,
805
+ source_name: str,
806
+ item_name: str,
807
+ asset_name: str,
808
+ version: Optional[str] = None,
809
+ tag: str = "latest",
810
+ item_type: mlrun.common.schemas.hub.HubSourceType = mlrun.common.schemas.hub.HubSourceType.functions,
825
811
  ):
826
812
  pass
827
813
 
@@ -1130,6 +1116,15 @@ class RunDBInterface(ABC):
1130
1116
  ) -> None:
1131
1117
  pass
1132
1118
 
1119
+ @abstractmethod
1120
+ def delete_model_monitoring_metrics(
1121
+ self,
1122
+ project: str,
1123
+ application_name: str,
1124
+ endpoint_ids: Optional[list[str]] = None,
1125
+ ) -> None:
1126
+ pass
1127
+
1133
1128
  @abstractmethod
1134
1129
  def get_monitoring_function_summaries(
1135
1130
  self,
@@ -1166,3 +1161,39 @@ class RunDBInterface(ABC):
1166
1161
  end: Optional[datetime.datetime] = None,
1167
1162
  ) -> mlrun.common.schemas.model_monitoring.ModelEndpointDriftValues:
1168
1163
  pass
1164
+
1165
+ @abstractmethod
1166
+ def store_secret_token(
1167
+ self,
1168
+ secret_token: mlrun.common.schemas.SecretToken,
1169
+ log_warning: bool = True,
1170
+ force: bool = False,
1171
+ ) -> mlrun.common.schemas.StoreSecretTokensResponse:
1172
+ pass
1173
+
1174
+ @abstractmethod
1175
+ def store_secret_tokens(
1176
+ self,
1177
+ secret_tokens: list[mlrun.common.schemas.SecretToken],
1178
+ log_warning: bool = True,
1179
+ force: bool = False,
1180
+ ) -> mlrun.common.schemas.StoreSecretTokensResponse:
1181
+ pass
1182
+
1183
+ @abstractmethod
1184
+ def list_secret_tokens(
1185
+ self,
1186
+ ) -> mlrun.common.schemas.ListSecretTokensResponse:
1187
+ pass
1188
+
1189
+ @abstractmethod
1190
+ def revoke_secret_token(self, token_name: str) -> None:
1191
+ pass
1192
+
1193
+ @abstractmethod
1194
+ def get_secret_token(
1195
+ self,
1196
+ token_name: str,
1197
+ username: Optional[str] = None,
1198
+ ) -> mlrun.common.schemas.SecretToken:
1199
+ pass