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/launcher/local.py CHANGED
@@ -13,8 +13,9 @@
13
13
  # limitations under the License.
14
14
  import os
15
15
  import pathlib
16
+ from collections.abc import Callable
16
17
  from os import environ
17
- from typing import Callable, Optional, Union
18
+ from typing import Optional, Union
18
19
 
19
20
  import mlrun.common.constants as mlrun_constants
20
21
  import mlrun.common.schemas.schedule
@@ -243,6 +244,8 @@ class ClientLocalLauncher(launcher.ClientBaseLauncher):
243
244
 
244
245
  # if the handler has module prefix force "local" (vs "handler") runtime
245
246
  kind = "local" if isinstance(handler, str) and "." in handler else ""
247
+
248
+ # Create temporary local function for execution
246
249
  fn = mlrun.new_function(meta.name, command=command, args=args, kind=kind)
247
250
  fn.metadata = meta
248
251
  setattr(fn, "_is_run_local", True)
mlrun/model.py CHANGED
@@ -29,6 +29,7 @@ import pydantic.v1.error_wrappers
29
29
  import mlrun
30
30
  import mlrun.common.constants as mlrun_constants
31
31
  import mlrun.common.schemas.notification
32
+ import mlrun.common.secrets
32
33
  import mlrun.utils.regex
33
34
 
34
35
  from .utils import (
@@ -235,7 +236,9 @@ class ModelObj:
235
236
  fields = list(inspect.signature(cls.__init__).parameters.keys())
236
237
 
237
238
  if init_with_params:
238
- kwargs = {field: struct.pop(field, None) for field in fields}
239
+ kwargs = {
240
+ field: struct.pop(field, None) for field in fields if field in struct
241
+ }
239
242
  kwargs.pop("self", None)
240
243
  new_obj = cls(**kwargs)
241
244
  else:
@@ -667,7 +670,7 @@ class ImageBuilder(ModelObj):
667
670
  """
668
671
  requirements = requirements or []
669
672
  self._verify_list(requirements, "requirements")
670
- resolved_requirements = self._resolve_requirements(
673
+ resolved_requirements = self.resolve_requirements(
671
674
  requirements, requirements_file
672
675
  )
673
676
  requirements = self.requirements or [] if not overwrite else []
@@ -680,7 +683,7 @@ class ImageBuilder(ModelObj):
680
683
  self.requirements = requirements
681
684
 
682
685
  @staticmethod
683
- def _resolve_requirements(requirements: list, requirements_file: str = "") -> list:
686
+ def resolve_requirements(requirements: list, requirements_file: str = "") -> list:
684
687
  requirements = requirements or []
685
688
  requirements_to_resolve = []
686
689
 
@@ -1007,6 +1010,7 @@ class RunSpec(ModelObj):
1007
1010
  tolerations=None,
1008
1011
  affinity=None,
1009
1012
  retry=None,
1013
+ auth=None,
1010
1014
  ):
1011
1015
  # A dictionary of parsing configurations that will be read from the inputs the user set. The keys are the inputs
1012
1016
  # keys (parameter names) and the values are the type hint given in the input keys after the colon.
@@ -1048,6 +1052,7 @@ class RunSpec(ModelObj):
1048
1052
  self.tolerations = tolerations or {}
1049
1053
  self.affinity = affinity or {}
1050
1054
  self.retry = retry or {}
1055
+ self.auth = auth or {}
1051
1056
 
1052
1057
  def _serialize_field(
1053
1058
  self, struct: dict, field_name: Optional[str] = None, strip: bool = False
@@ -1616,7 +1621,12 @@ class RunTemplate(ModelObj):
1616
1621
 
1617
1622
  :returns: The RunTemplate object
1618
1623
  """
1619
-
1624
+ if kind == "azure_vault" and isinstance(source, dict):
1625
+ candidate_secret_name = (source.get("k8s_secret") or "").strip()
1626
+ if candidate_secret_name:
1627
+ mlrun.common.secrets.validate_not_forbidden_secret(
1628
+ candidate_secret_name
1629
+ )
1620
1630
  if kind == "vault" and isinstance(source, list):
1621
1631
  source = {"project": self.metadata.project, "secrets": source}
1622
1632
 
@@ -15,5 +15,4 @@
15
15
  from mlrun.common.schemas import ModelEndpoint, ModelEndpointList
16
16
 
17
17
  from .db import get_tsdb_connector
18
- from .db._schedules import delete_model_monitoring_schedules_user_folder
19
18
  from .helpers import get_stream_path
@@ -18,6 +18,7 @@ from datetime import datetime
18
18
 
19
19
  import numpy as np
20
20
  import pandas as pd
21
+ from deprecated import deprecated
21
22
 
22
23
  import mlrun.common.schemas.model_monitoring.constants as mm_constants
23
24
  import mlrun.datastore.base
@@ -29,8 +30,9 @@ from mlrun.common.schemas.model_monitoring import (
29
30
  FunctionURI,
30
31
  )
31
32
  from mlrun.data_types.infer import InferOptions, get_df_stats
32
- from mlrun.utils import datetime_now, logger
33
+ from mlrun.utils import check_if_hub_uri, datetime_now, logger, merge_requirements
33
34
 
35
+ from ..common.schemas.hub import HubModuleType
34
36
  from .helpers import update_model_endpoint_last_request
35
37
 
36
38
  # A union of all supported dataset types:
@@ -45,6 +47,14 @@ DatasetType = typing.Union[
45
47
  ]
46
48
 
47
49
 
50
+ # TODO: Remove this in 1.12.0
51
+ @deprecated(
52
+ version="1.10.0",
53
+ reason="This function is deprecated and will be removed in 1.12. You can generate a model endpoint by either "
54
+ "deploying a monitored serving function as a real-time service or running it as an offline job. "
55
+ "To retrieve model endpoints, use `project.list_model_endpoints()`",
56
+ category=FutureWarning,
57
+ )
48
58
  def get_or_create_model_endpoint(
49
59
  project: str,
50
60
  model_endpoint_name: str,
@@ -67,8 +77,8 @@ def get_or_create_model_endpoint(
67
77
  :param model_endpoint_name: If a new model endpoint is created, the model endpoint name will be presented
68
78
  under this endpoint (applicable only to new endpoint_id).
69
79
  :param model_path: The model store path (applicable only to new endpoint_id).
70
- :param endpoint_id: Model endpoint unique ID. If not exist in DB, will generate a new record based
71
- on the provided `endpoint_id`.
80
+ :param endpoint_id: Model endpoint unique ID. If not exist in DB, will generate a new record with a
81
+ newly generated ID.
72
82
  :param function_name: If a new model endpoint is created, use this function name.
73
83
  :param function_tag: If a new model endpoint is created, use this function tag.
74
84
  :param context: MLRun context. If `function_name` not provided, use the context to generate the
@@ -91,25 +101,26 @@ def get_or_create_model_endpoint(
91
101
  function_name = FunctionURI.from_string(
92
102
  context.to_dict()["spec"]["function"]
93
103
  ).function
94
- try:
95
- model_endpoint = db_session.get_model_endpoint(
96
- project=project,
97
- name=model_endpoint_name,
98
- endpoint_id=endpoint_id,
99
- function_name=function_name,
100
- function_tag=function_tag or "latest",
101
- feature_analysis=feature_analysis,
102
- )
103
- # If other fields provided, validate that they are correspond to the existing model endpoint data
104
- _model_endpoint_validations(
105
- model_endpoint=model_endpoint,
106
- model_path=model_path,
107
- sample_set_statistics=sample_set_statistics,
108
- )
104
+ if endpoint_id or function_name:
105
+ try:
106
+ model_endpoint = db_session.get_model_endpoint(
107
+ project=project,
108
+ name=model_endpoint_name,
109
+ endpoint_id=endpoint_id,
110
+ function_name=function_name,
111
+ function_tag=function_tag or "latest",
112
+ feature_analysis=feature_analysis,
113
+ )
114
+ # If other fields provided, validate that they are correspond to the existing model endpoint data
115
+ _model_endpoint_validations(
116
+ model_endpoint=model_endpoint,
117
+ model_path=model_path,
118
+ sample_set_statistics=sample_set_statistics,
119
+ )
109
120
 
110
- except (mlrun.errors.MLRunNotFoundError, mlrun.errors.MLRunInvalidArgumentError):
111
- # Create a new model endpoint with the provided details
112
- pass
121
+ except mlrun.errors.MLRunNotFoundError:
122
+ # Create a new model endpoint with the provided details
123
+ pass
113
124
  if not model_endpoint:
114
125
  model_endpoint = _generate_model_endpoint(
115
126
  project=project,
@@ -123,6 +134,13 @@ def get_or_create_model_endpoint(
123
134
  return model_endpoint
124
135
 
125
136
 
137
+ # TODO: Remove this in 1.12.0
138
+ @deprecated(
139
+ version="1.10.0",
140
+ reason="This function is deprecated and will be removed in 1.12. "
141
+ "Instead, run a monitored serving function as a job",
142
+ category=FutureWarning,
143
+ )
126
144
  def record_results(
127
145
  project: str,
128
146
  model_path: str,
@@ -144,8 +162,8 @@ def record_results(
144
162
  :param model_path: The model Store path.
145
163
  :param model_endpoint_name: If a new model endpoint is generated, the model endpoint name will be presented
146
164
  under this endpoint.
147
- :param endpoint_id: Model endpoint unique ID. If not exist in DB, will generate a new record based
148
- on the provided `endpoint_id`.
165
+ :param endpoint_id: Model endpoint unique ID. If not exist in DB, will generate a new record with a
166
+ newly generated ID.
149
167
  :param function_name: If a new model endpoint is created, use this function name for generating the
150
168
  function URI.
151
169
  :param context: MLRun context. Note that the context is required generating the model endpoint.
@@ -236,6 +254,7 @@ def _model_endpoint_validations(
236
254
  key=model_obj.key,
237
255
  iter=model_obj.iter,
238
256
  tree=model_obj.tree,
257
+ uid=model_obj.uid,
239
258
  )
240
259
 
241
260
  # Enrich the uri schema with the store prefix
@@ -325,12 +344,15 @@ def _generate_model_endpoint(
325
344
 
326
345
  :return `mlrun.common.schemas.ModelEndpoint` object.
327
346
  """
347
+
328
348
  current_time = datetime_now()
329
349
  model_endpoint = mlrun.common.schemas.ModelEndpoint(
330
350
  metadata=mlrun.common.schemas.ModelEndpointMetadata(
331
351
  project=project,
332
352
  name=model_endpoint_name,
333
353
  endpoint_type=mlrun.common.schemas.model_monitoring.EndpointType.BATCH_EP,
354
+ # Due to backwards compatibility, this endpoint will be created as a legacy batch endpoint.
355
+ mode=mlrun.common.schemas.model_monitoring.EndpointMode.BATCH_LEGACY,
334
356
  ),
335
357
  spec=mlrun.common.schemas.ModelEndpointSpec(
336
358
  function_name=function_name or "function",
@@ -445,7 +467,7 @@ def read_dataset_as_dataframe(
445
467
  # Get the features and parse to DataFrame:
446
468
  dataset = dataset.get_offline_features(drop_columns=drop_columns).to_dataframe()
447
469
 
448
- elif isinstance(dataset, (list, np.ndarray)):
470
+ elif isinstance(dataset, list | np.ndarray):
449
471
  if not feature_columns:
450
472
  raise mlrun.errors.MLRunInvalidArgumentError(
451
473
  "Feature columns list must be provided when dataset input as from type list or numpy array"
@@ -487,7 +509,7 @@ def read_dataset_as_dataframe(
487
509
  # Turn the `label_columns` into a list by default:
488
510
  if label_columns is None:
489
511
  label_columns = []
490
- elif isinstance(label_columns, (str, int)):
512
+ elif isinstance(label_columns, str | int):
491
513
  label_columns = [label_columns]
492
514
 
493
515
  return dataset, label_columns
@@ -527,8 +549,9 @@ def _create_model_monitoring_function_base(
527
549
  name: typing.Optional[str] = None,
528
550
  image: typing.Optional[str] = None,
529
551
  tag: typing.Optional[str] = None,
530
- requirements: typing.Union[str, list[str], None] = None,
552
+ requirements: typing.Union[list[str], None] = None,
531
553
  requirements_file: str = "",
554
+ local_path: typing.Optional[str] = None,
532
555
  **application_kwargs,
533
556
  ) -> mlrun.runtimes.ServingRuntime:
534
557
  """
@@ -540,12 +563,26 @@ def _create_model_monitoring_function_base(
540
563
  "An application cannot have the following names: "
541
564
  f"{mm_constants._RESERVED_FUNCTION_NAMES}"
542
565
  )
543
- if name and name.endswith(mm_constants._RESERVED_EVALUATE_FUNCTION_SUFFIX):
566
+ _, has_valid_suffix, suffix = mlrun.utils.helpers.ensure_batch_job_suffix(name)
567
+ if name and not has_valid_suffix:
544
568
  raise mlrun.errors.MLRunValueError(
545
- "Model monitoring application names cannot end with `-batch`"
569
+ f"Model monitoring application names cannot end with `{suffix}`"
546
570
  )
547
571
  if func is None:
548
572
  func = ""
573
+ if check_if_hub_uri(func):
574
+ hub_module = mlrun.get_hub_module(url=func, local_path=local_path)
575
+ if hub_module.kind != HubModuleType.monitoring_app:
576
+ raise mlrun.errors.MLRunInvalidArgumentError(
577
+ "The provided module is not a monitoring application"
578
+ )
579
+ requirements = mlrun.model.ImageBuilder.resolve_requirements(
580
+ requirements, requirements_file
581
+ )
582
+ requirements = merge_requirements(
583
+ reqs_priority=requirements, reqs_secondary=hub_module.requirements
584
+ )
585
+ func = hub_module.get_module_file_path()
549
586
  func_obj = typing.cast(
550
587
  mlrun.runtimes.ServingRuntime,
551
588
  mlrun.code_to_function(
@@ -12,6 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from .base import ModelMonitoringApplicationBase
15
+ from .base import ExistingDataHandling, ModelMonitoringApplicationBase
16
16
  from .context import MonitoringApplicationContext
17
17
  from .results import ModelMonitoringApplicationMetric, ModelMonitoringApplicationResult