mlrun 1.10.0rc5__py3-none-any.whl → 1.10.0rc7__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 +47 -4
  2. mlrun/artifacts/base.py +0 -27
  3. mlrun/artifacts/dataset.py +0 -8
  4. mlrun/artifacts/model.py +3 -10
  5. mlrun/artifacts/plots.py +0 -13
  6. mlrun/common/schemas/model_monitoring/__init__.py +1 -0
  7. mlrun/common/schemas/model_monitoring/constants.py +14 -2
  8. mlrun/common/schemas/model_monitoring/functions.py +66 -0
  9. mlrun/common/schemas/project.py +3 -0
  10. mlrun/config.py +3 -3
  11. mlrun/db/base.py +13 -20
  12. mlrun/db/httpdb.py +48 -65
  13. mlrun/db/nopdb.py +12 -13
  14. mlrun/launcher/base.py +1 -0
  15. mlrun/launcher/client.py +24 -0
  16. mlrun/launcher/local.py +4 -0
  17. mlrun/model_monitoring/applications/_application_steps.py +23 -39
  18. mlrun/model_monitoring/applications/base.py +167 -32
  19. mlrun/model_monitoring/db/tsdb/base.py +30 -0
  20. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connection.py +118 -50
  21. mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +117 -24
  22. mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +106 -15
  23. mlrun/model_monitoring/helpers.py +0 -3
  24. mlrun/projects/operations.py +11 -24
  25. mlrun/projects/project.py +81 -83
  26. mlrun/runtimes/base.py +0 -27
  27. mlrun/runtimes/daskjob.py +6 -4
  28. mlrun/runtimes/databricks_job/databricks_runtime.py +0 -2
  29. mlrun/runtimes/kubejob.py +5 -8
  30. mlrun/runtimes/mpijob/abstract.py +2 -2
  31. mlrun/runtimes/mpijob/v1.py +2 -2
  32. mlrun/runtimes/nuclio/application/application.py +0 -5
  33. mlrun/runtimes/nuclio/function.py +2 -11
  34. mlrun/runtimes/nuclio/serving.py +46 -6
  35. mlrun/runtimes/pod.py +4 -3
  36. mlrun/runtimes/remotesparkjob.py +2 -2
  37. mlrun/runtimes/sparkjob/spark3job.py +2 -2
  38. mlrun/serving/server.py +97 -3
  39. mlrun/serving/states.py +16 -18
  40. mlrun/utils/helpers.py +15 -4
  41. mlrun/utils/version/version.json +2 -2
  42. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/METADATA +3 -2
  43. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/RECORD +47 -46
  44. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/WHEEL +0 -0
  45. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/entry_points.txt +0 -0
  46. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/licenses/LICENSE +0 -0
  47. {mlrun-1.10.0rc5.dist-info → mlrun-1.10.0rc7.dist-info}/top_level.txt +0 -0
mlrun/projects/project.py CHANGED
@@ -757,14 +757,7 @@ def _project_instance_from_struct(struct, name, allow_cross_project):
757
757
  "3. Use different project context dir."
758
758
  )
759
759
 
760
- if allow_cross_project is None:
761
- # TODO: Remove this warning in version 1.10.0 and also fix cli to support allow_cross_project
762
- warnings.warn(
763
- f"Project {name=} is different than specified on the context's project yaml. "
764
- "This behavior is deprecated and will not be supported from version 1.10.0."
765
- )
766
- logger.warn(error_message)
767
- elif allow_cross_project:
760
+ if allow_cross_project:
768
761
  logger.debug(
769
762
  "Project name is different than specified on the context's project yaml. Overriding.",
770
763
  existing_name=name_from_struct,
@@ -1409,7 +1402,10 @@ class MlrunProject(ModelObj):
1409
1402
  https://apscheduler.readthedocs.io/en/3.x/modules/triggers/cron.html#module-apscheduler.triggers.cron
1410
1403
  Note that "local" engine does not support this argument
1411
1404
  :param ttl: Pipeline ttl in secs (after that the pods will be removed)
1412
- :param image: Image for workflow runner job, only for scheduled and remote workflows
1405
+ :param image: Image for workflow runner job, only for scheduled and remote workflows.
1406
+ The image must have mlrun[kfp] installed which requires python 3.9.
1407
+ Therefore, the project default image will not be used for the workflow,
1408
+ and the image must be specified explicitly.
1413
1409
  :param args: Argument values (key=value, ..)
1414
1410
  """
1415
1411
 
@@ -4108,7 +4104,7 @@ class MlrunProject(ModelObj):
4108
4104
  requirements: Optional[typing.Union[str, list[str]]] = None,
4109
4105
  mlrun_version_specifier: Optional[str] = None,
4110
4106
  builder_env: Optional[dict] = None,
4111
- overwrite_build_params: bool = False,
4107
+ overwrite_build_params: bool = True,
4112
4108
  requirements_file: Optional[str] = None,
4113
4109
  extra_args: Optional[str] = None,
4114
4110
  force_build: bool = False,
@@ -4164,7 +4160,7 @@ class MlrunProject(ModelObj):
4164
4160
  commands: Optional[list] = None,
4165
4161
  secret_name: Optional[str] = None,
4166
4162
  requirements: Optional[typing.Union[str, list[str]]] = None,
4167
- overwrite_build_params: bool = False,
4163
+ overwrite_build_params: bool = True,
4168
4164
  requirements_file: Optional[str] = None,
4169
4165
  builder_env: Optional[dict] = None,
4170
4166
  extra_args: Optional[str] = None,
@@ -4194,12 +4190,6 @@ class MlrunProject(ModelObj):
4194
4190
  :param source_code_target_dir: Path on the image where source code would be extracted
4195
4191
  (by default `/home/mlrun_code`)
4196
4192
  """
4197
- if not overwrite_build_params:
4198
- # TODO: change overwrite_build_params default to True in 1.10.0
4199
- warnings.warn(
4200
- "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
4201
- mlrun.utils.OverwriteBuildParamsWarning,
4202
- )
4203
4193
  default_image_name = mlrun.mlconf.default_project_image_name.format(
4204
4194
  name=self.name
4205
4195
  )
@@ -4233,7 +4223,7 @@ class MlrunProject(ModelObj):
4233
4223
  requirements: Optional[typing.Union[str, list[str]]] = None,
4234
4224
  mlrun_version_specifier: Optional[str] = None,
4235
4225
  builder_env: Optional[dict] = None,
4236
- overwrite_build_params: bool = False,
4226
+ overwrite_build_params: bool = True,
4237
4227
  requirements_file: Optional[str] = None,
4238
4228
  extra_args: Optional[str] = None,
4239
4229
  target_dir: Optional[str] = None,
@@ -4273,60 +4263,47 @@ class MlrunProject(ModelObj):
4273
4263
  base_image=base_image,
4274
4264
  )
4275
4265
 
4276
- if not overwrite_build_params:
4277
- # TODO: change overwrite_build_params default to True in 1.10.0
4278
- warnings.warn(
4279
- "The `overwrite_build_params` parameter default will change from 'False' to 'True' in 1.10.0.",
4280
- mlrun.utils.OverwriteBuildParamsWarning,
4281
- )
4266
+ self.build_config(
4267
+ image=image,
4268
+ set_as_default=set_as_default,
4269
+ base_image=base_image,
4270
+ commands=commands,
4271
+ secret_name=secret_name,
4272
+ with_mlrun=with_mlrun,
4273
+ requirements=requirements,
4274
+ requirements_file=requirements_file,
4275
+ overwrite_build_params=overwrite_build_params,
4276
+ )
4282
4277
 
4283
- # TODO: remove filter once overwrite_build_params default is changed to True in 1.8.0
4284
- with warnings.catch_warnings():
4285
- warnings.simplefilter(
4286
- "ignore", category=mlrun.utils.OverwriteBuildParamsWarning
4287
- )
4278
+ function = mlrun.new_function("mlrun--project--image--builder", kind="job")
4288
4279
 
4289
- self.build_config(
4290
- image=image,
4291
- set_as_default=set_as_default,
4292
- base_image=base_image,
4293
- commands=commands,
4294
- secret_name=secret_name,
4295
- with_mlrun=with_mlrun,
4296
- requirements=requirements,
4297
- requirements_file=requirements_file,
4298
- overwrite_build_params=overwrite_build_params,
4280
+ if self.spec.source and not self.spec.load_source_on_run:
4281
+ function.with_source_archive(
4282
+ source=self.spec.source,
4283
+ target_dir=target_dir,
4284
+ pull_at_runtime=False,
4299
4285
  )
4300
4286
 
4301
- function = mlrun.new_function("mlrun--project--image--builder", kind="job")
4302
-
4303
- if self.spec.source and not self.spec.load_source_on_run:
4304
- function.with_source_archive(
4305
- source=self.spec.source,
4306
- target_dir=target_dir,
4307
- pull_at_runtime=False,
4308
- )
4309
-
4310
- build = self.spec.build
4311
- result = self.build_function(
4312
- function=function,
4313
- with_mlrun=build.with_mlrun,
4314
- image=build.image,
4315
- base_image=build.base_image,
4316
- commands=build.commands,
4317
- secret_name=build.secret,
4318
- requirements=build.requirements,
4319
- overwrite_build_params=overwrite_build_params,
4320
- mlrun_version_specifier=mlrun_version_specifier,
4321
- builder_env=builder_env,
4322
- extra_args=extra_args,
4323
- force_build=True,
4324
- )
4287
+ build = self.spec.build
4288
+ result = self.build_function(
4289
+ function=function,
4290
+ with_mlrun=build.with_mlrun,
4291
+ image=build.image,
4292
+ base_image=build.base_image,
4293
+ commands=build.commands,
4294
+ secret_name=build.secret,
4295
+ requirements=build.requirements,
4296
+ overwrite_build_params=overwrite_build_params,
4297
+ mlrun_version_specifier=mlrun_version_specifier,
4298
+ builder_env=builder_env,
4299
+ extra_args=extra_args,
4300
+ force_build=True,
4301
+ )
4325
4302
 
4326
- # Get the enriched target dir from the function
4327
- self.spec.build.source_code_target_dir = (
4328
- function.spec.build.source_code_target_dir
4329
- )
4303
+ # Get the enriched target dir from the function
4304
+ self.spec.build.source_code_target_dir = (
4305
+ function.spec.build.source_code_target_dir
4306
+ )
4330
4307
 
4331
4308
  try:
4332
4309
  mlrun.db.get_run_db(secrets=self._secrets).delete_function(
@@ -4971,14 +4948,47 @@ class MlrunProject(ModelObj):
4971
4948
  labels=model_monitoring_labels_list,
4972
4949
  )
4973
4950
 
4951
+ def get_monitoring_function_summaries(
4952
+ self,
4953
+ start: Optional[datetime.datetime] = None,
4954
+ end: Optional[datetime.datetime] = None,
4955
+ names: Optional[Union[list[str], str]] = None,
4956
+ labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
4957
+ include_stats: bool = False,
4958
+ include_infra: bool = True,
4959
+ ) -> list[mlrun.common.schemas.model_monitoring.FunctionSummary]:
4960
+ """Get monitoring function summaries for the specified project.
4961
+ :param start: Start time for filtering the results (optional).
4962
+ :param end: End time for filtering the results (optional).
4963
+ :param names: List of function names to filter by (optional).
4964
+ :param labels: Labels to filter by (optional).
4965
+ :param include_stats: Whether to include statistics in the response (default is False).
4966
+ :param include_infra: whether to include model monitoring infrastructure functions (default is True).
4967
+ :return: A list of FunctionSummary objects containing information about the monitoring functions.
4968
+ """
4969
+
4970
+ if start is not None and end is not None:
4971
+ if start.tzinfo is None or end.tzinfo is None:
4972
+ raise mlrun.errors.MLRunInvalidArgumentTypeError(
4973
+ "Custom start and end times must contain the timezone."
4974
+ )
4975
+
4976
+ db = mlrun.db.get_run_db(secrets=self._secrets)
4977
+ return db.get_monitoring_function_summaries(
4978
+ project=self.metadata.name,
4979
+ start=start,
4980
+ end=end,
4981
+ names=names,
4982
+ labels=labels,
4983
+ include_stats=include_stats,
4984
+ include_infra=include_infra,
4985
+ )
4986
+
4974
4987
  def list_runs(
4975
4988
  self,
4976
4989
  name: Optional[str] = None,
4977
4990
  uid: Optional[Union[str, list[str]]] = None,
4978
4991
  labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
4979
- state: Optional[
4980
- mlrun.common.runtimes.constants.RunStates
4981
- ] = None, # Backward compatibility
4982
4992
  states: typing.Optional[list[mlrun.common.runtimes.constants.RunStates]] = None,
4983
4993
  sort: bool = True,
4984
4994
  iter: bool = False,
@@ -5022,7 +5032,6 @@ class MlrunProject(ModelObj):
5022
5032
  - A comma-separated string formatted as `"label1=value1,label2"` to match entities with
5023
5033
  the specified key-value pairs or key existence.
5024
5034
 
5025
- :param state: Deprecated - List only runs whose state is specified.
5026
5035
  :param states: List only runs whose state is one of the provided states.
5027
5036
  :param sort: Whether to sort the result according to their start time. Otherwise, results will be
5028
5037
  returned by their internal order in the DB (order will not be guaranteed).
@@ -5036,24 +5045,13 @@ class MlrunProject(ModelObj):
5036
5045
  :param end_time_from: Filter by run end time in ``[end_time_from, end_time_to]``.
5037
5046
  :param end_time_to: Filter by run end time in ``[end_time_from, end_time_to]``.
5038
5047
  """
5039
- if state:
5040
- # TODO: Remove this in 1.10.0
5041
- warnings.warn(
5042
- "'state' is deprecated in 1.7.0 and will be removed in 1.10.0. Use 'states' instead.",
5043
- FutureWarning,
5044
- )
5045
-
5046
5048
  db = mlrun.db.get_run_db(secrets=self._secrets)
5047
5049
  return db.list_runs(
5048
5050
  name,
5049
5051
  uid,
5050
5052
  self.metadata.name,
5051
5053
  labels=labels,
5052
- states=(
5053
- mlrun.utils.helpers.as_list(state)
5054
- if state is not None
5055
- else states or None
5056
- ),
5054
+ states=states or None,
5057
5055
  sort=sort,
5058
5056
  iter=iter,
5059
5057
  start_time_from=start_time_from,
mlrun/runtimes/base.py CHANGED
@@ -74,7 +74,6 @@ spec_fields = [
74
74
  "pythonpath",
75
75
  "disable_auto_mount",
76
76
  "allow_empty_resources",
77
- "clone_target_dir",
78
77
  "reset_on_run",
79
78
  ]
80
79
 
@@ -117,7 +116,6 @@ class FunctionSpec(ModelObj):
117
116
  default_handler=None,
118
117
  pythonpath=None,
119
118
  disable_auto_mount=False,
120
- clone_target_dir=None,
121
119
  ):
122
120
  self.command = command or ""
123
121
  self.image = image or ""
@@ -134,9 +132,6 @@ class FunctionSpec(ModelObj):
134
132
  self.entry_points = entry_points or {}
135
133
  self.disable_auto_mount = disable_auto_mount
136
134
  self.allow_empty_resources = None
137
- # The build.source is cloned/extracted to the specified clone_target_dir
138
- # if a relative path is specified, it will be enriched with a temp dir path
139
- self._clone_target_dir = clone_target_dir or None
140
135
 
141
136
  @property
142
137
  def build(self) -> ImageBuilder:
@@ -146,28 +141,6 @@ class FunctionSpec(ModelObj):
146
141
  def build(self, build):
147
142
  self._build = self._verify_dict(build, "build", ImageBuilder)
148
143
 
149
- @property
150
- def clone_target_dir(self):
151
- # TODO: remove this property in 1.10.0
152
- if self.build.source_code_target_dir:
153
- warnings.warn(
154
- "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.10.0. "
155
- "Use spec.build.source_code_target_dir instead.",
156
- FutureWarning,
157
- )
158
- return self.build.source_code_target_dir
159
-
160
- @clone_target_dir.setter
161
- def clone_target_dir(self, clone_target_dir):
162
- # TODO: remove this property in 1.10.0
163
- if clone_target_dir:
164
- warnings.warn(
165
- "The clone_target_dir attribute is deprecated in 1.6.2 and will be removed in 1.10.0. "
166
- "Use spec.build.source_code_target_dir instead.",
167
- FutureWarning,
168
- )
169
- self.build.source_code_target_dir = clone_target_dir
170
-
171
144
  def enrich_function_preemption_spec(self):
172
145
  pass
173
146
 
mlrun/runtimes/daskjob.py CHANGED
@@ -91,8 +91,8 @@ class DaskSpec(KubeResourceSpec):
91
91
  tolerations=None,
92
92
  preemption_mode=None,
93
93
  security_context=None,
94
- clone_target_dir=None,
95
94
  state_thresholds=None,
95
+ serving_spec=None,
96
96
  ):
97
97
  super().__init__(
98
98
  command=command,
@@ -121,8 +121,8 @@ class DaskSpec(KubeResourceSpec):
121
121
  tolerations=tolerations,
122
122
  preemption_mode=preemption_mode,
123
123
  security_context=security_context,
124
- clone_target_dir=clone_target_dir,
125
124
  state_thresholds=state_thresholds,
125
+ serving_spec=serving_spec,
126
126
  )
127
127
  self.args = args
128
128
 
@@ -192,7 +192,9 @@ class DaskCluster(KubejobRuntime):
192
192
  super().__init__(spec, metadata)
193
193
  self._cluster = None
194
194
  self.use_remote = not mlrun.k8s_utils.is_running_inside_kubernetes_cluster()
195
- self.spec.build.base_image = self.spec.build.base_image or "daskdev/dask:latest"
195
+ self.spec.build.base_image = (
196
+ self.spec.build.base_image or mlrun.mlconf.default_base_image
197
+ )
196
198
 
197
199
  @property
198
200
  def spec(self) -> DaskSpec:
@@ -248,7 +250,7 @@ class DaskCluster(KubejobRuntime):
248
250
  if not self.is_deployed():
249
251
  raise RunError(
250
252
  "Function image is not built/ready, use .deploy()"
251
- " method first, or set base dask image (daskdev/dask:latest)"
253
+ " method first, or set base dask image to mlrun/mlrun"
252
254
  )
253
255
 
254
256
  self.save(versioned=False)
@@ -82,7 +82,6 @@ class DatabricksSpec(pod.KubeResourceSpec):
82
82
  tolerations=None,
83
83
  preemption_mode=None,
84
84
  security_context=None,
85
- clone_target_dir=None,
86
85
  state_thresholds=None,
87
86
  ):
88
87
  super().__init__(
@@ -112,7 +111,6 @@ class DatabricksSpec(pod.KubeResourceSpec):
112
111
  tolerations=tolerations,
113
112
  preemption_mode=preemption_mode,
114
113
  security_context=security_context,
115
- clone_target_dir=clone_target_dir,
116
114
  state_thresholds=state_thresholds,
117
115
  )
118
116
  self._termination_grace_period_seconds = 60
mlrun/runtimes/kubejob.py CHANGED
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import typing
15
- import warnings
16
15
 
17
16
  import mlrun.common.schemas
18
17
  import mlrun.db
@@ -83,7 +82,7 @@ class KubejobRuntime(KubeResource):
83
82
  with_mlrun=None,
84
83
  auto_build=None,
85
84
  requirements=None,
86
- overwrite=False,
85
+ overwrite=True,
87
86
  prepare_image_for_deploy=True,
88
87
  requirements_file=None,
89
88
  builder_env=None,
@@ -113,12 +112,6 @@ class KubejobRuntime(KubeResource):
113
112
  :param builder_env: Kaniko builder pod env vars dict (for config/credentials)
114
113
  e.g. builder_env={"GIT_TOKEN": token}
115
114
  """
116
- if not overwrite:
117
- # TODO: change overwrite default to True in 1.10.0
118
- warnings.warn(
119
- "The `overwrite` parameter default will change from 'False' to 'True' in 1.10.0.",
120
- mlrun.utils.OverwriteBuildParamsWarning,
121
- )
122
115
  image = mlrun.utils.helpers.remove_image_protocol_prefix(image)
123
116
  self.spec.build.build_config(
124
117
  image=image,
@@ -214,3 +207,7 @@ class KubejobRuntime(KubeResource):
214
207
  raise NotImplementedError(
215
208
  f"Running a {self.kind} function from the client is not supported. Use .run() to submit the job to the API."
216
209
  )
210
+
211
+ @property
212
+ def serving_spec(self):
213
+ return self.spec.serving_spec
@@ -53,8 +53,8 @@ class MPIResourceSpec(KubeResourceSpec):
53
53
  tolerations=None,
54
54
  preemption_mode=None,
55
55
  security_context=None,
56
- clone_target_dir=None,
57
56
  state_thresholds=None,
57
+ serving_spec=None,
58
58
  ):
59
59
  super().__init__(
60
60
  command=command,
@@ -83,8 +83,8 @@ class MPIResourceSpec(KubeResourceSpec):
83
83
  tolerations=tolerations,
84
84
  preemption_mode=preemption_mode,
85
85
  security_context=security_context,
86
- clone_target_dir=clone_target_dir,
87
86
  state_thresholds=state_thresholds,
87
+ serving_spec=serving_spec,
88
88
  )
89
89
  self.mpi_args = mpi_args or [
90
90
  "-x",
@@ -48,8 +48,8 @@ class MPIV1ResourceSpec(MPIResourceSpec):
48
48
  tolerations=None,
49
49
  preemption_mode=None,
50
50
  security_context=None,
51
- clone_target_dir=None,
52
51
  state_thresholds=None,
52
+ serving_spec=None,
53
53
  ):
54
54
  super().__init__(
55
55
  command=command,
@@ -79,8 +79,8 @@ class MPIV1ResourceSpec(MPIResourceSpec):
79
79
  tolerations=tolerations,
80
80
  preemption_mode=preemption_mode,
81
81
  security_context=security_context,
82
- clone_target_dir=clone_target_dir,
83
82
  state_thresholds=state_thresholds,
83
+ serving_spec=serving_spec,
84
84
  )
85
85
  self.clean_pod_policy = clean_pod_policy or MPIJobV1CleanPodPolicies.default()
86
86
 
@@ -76,7 +76,6 @@ class ApplicationSpec(NuclioSpec):
76
76
  security_context=None,
77
77
  service_type=None,
78
78
  add_templated_ingress_host_mode=None,
79
- clone_target_dir=None,
80
79
  state_thresholds=None,
81
80
  disable_default_http_trigger=None,
82
81
  internal_application_port=None,
@@ -119,7 +118,6 @@ class ApplicationSpec(NuclioSpec):
119
118
  security_context=security_context,
120
119
  service_type=service_type,
121
120
  add_templated_ingress_host_mode=add_templated_ingress_host_mode,
122
- clone_target_dir=clone_target_dir,
123
121
  state_thresholds=state_thresholds,
124
122
  disable_default_http_trigger=disable_default_http_trigger,
125
123
  )
@@ -274,7 +272,6 @@ class ApplicationRuntime(RemoteRuntime):
274
272
  project="",
275
273
  tag="",
276
274
  verbose=False,
277
- auth_info: schemas.AuthInfo = None,
278
275
  builder_env: typing.Optional[dict] = None,
279
276
  force_build: bool = False,
280
277
  with_mlrun=None,
@@ -291,7 +288,6 @@ class ApplicationRuntime(RemoteRuntime):
291
288
  :param project: Project name
292
289
  :param tag: Function tag
293
290
  :param verbose: Set True for verbose logging
294
- :param auth_info: Service AuthInfo (deprecated and ignored)
295
291
  :param builder_env: Env vars dict for source archive config/credentials
296
292
  e.g. builder_env={"GIT_TOKEN": token}
297
293
  :param force_build: Set True for force building the application image
@@ -332,7 +328,6 @@ class ApplicationRuntime(RemoteRuntime):
332
328
  project=project,
333
329
  tag=tag,
334
330
  verbose=verbose,
335
- auth_info=auth_info,
336
331
  builder_env=builder_env,
337
332
  )
338
333
  logger.info(
@@ -16,7 +16,6 @@ import asyncio
16
16
  import copy
17
17
  import json
18
18
  import typing
19
- import warnings
20
19
  from datetime import datetime
21
20
  from time import sleep
22
21
 
@@ -153,9 +152,9 @@ class NuclioSpec(KubeResourceSpec):
153
152
  security_context=None,
154
153
  service_type=None,
155
154
  add_templated_ingress_host_mode=None,
156
- clone_target_dir=None,
157
155
  state_thresholds=None,
158
156
  disable_default_http_trigger=None,
157
+ serving_spec=None,
159
158
  ):
160
159
  super().__init__(
161
160
  command=command,
@@ -184,8 +183,8 @@ class NuclioSpec(KubeResourceSpec):
184
183
  tolerations=tolerations,
185
184
  preemption_mode=preemption_mode,
186
185
  security_context=security_context,
187
- clone_target_dir=clone_target_dir,
188
186
  state_thresholds=state_thresholds,
187
+ serving_spec=serving_spec,
189
188
  )
190
189
 
191
190
  self.base_spec = base_spec or {}
@@ -609,7 +608,6 @@ class RemoteRuntime(KubeResource):
609
608
  project="",
610
609
  tag="",
611
610
  verbose=False,
612
- auth_info: AuthInfo = None,
613
611
  builder_env: typing.Optional[dict] = None,
614
612
  force_build: bool = False,
615
613
  ):
@@ -618,16 +616,9 @@ class RemoteRuntime(KubeResource):
618
616
  :param project: project name
619
617
  :param tag: function tag
620
618
  :param verbose: set True for verbose logging
621
- :param auth_info: service AuthInfo (deprecated and ignored)
622
619
  :param builder_env: env vars dict for source archive config/credentials e.g. builder_env={"GIT_TOKEN": token}
623
620
  :param force_build: set True for force building the image
624
621
  """
625
- if auth_info:
626
- # TODO: remove in 1.10.0
627
- warnings.warn(
628
- "'auth_info' is deprecated for nuclio runtimes in 1.7.0 and will be removed in 1.10.0",
629
- FutureWarning,
630
- )
631
622
 
632
623
  old_http_session = getattr(self, "_http_session", None)
633
624
  if old_http_session:
@@ -43,6 +43,8 @@ from mlrun.serving.states import (
43
43
  )
44
44
  from mlrun.utils import get_caller_globals, logger, set_paths
45
45
 
46
+ from .. import KubejobRuntime
47
+ from ..pod import KubeResourceSpec
46
48
  from .function import NuclioSpec, RemoteRuntime, min_nuclio_versions
47
49
 
48
50
  serving_subkind = "serving_v2"
@@ -147,10 +149,10 @@ class ServingSpec(NuclioSpec):
147
149
  security_context=None,
148
150
  service_type=None,
149
151
  add_templated_ingress_host_mode=None,
150
- clone_target_dir=None,
151
152
  state_thresholds=None,
152
153
  disable_default_http_trigger=None,
153
154
  model_endpoint_creation_task_name=None,
155
+ serving_spec=None,
154
156
  ):
155
157
  super().__init__(
156
158
  command=command,
@@ -190,8 +192,8 @@ class ServingSpec(NuclioSpec):
190
192
  security_context=security_context,
191
193
  service_type=service_type,
192
194
  add_templated_ingress_host_mode=add_templated_ingress_host_mode,
193
- clone_target_dir=clone_target_dir,
194
195
  disable_default_http_trigger=disable_default_http_trigger,
196
+ serving_spec=serving_spec,
195
197
  )
196
198
 
197
199
  self.models = models or {}
@@ -631,7 +633,6 @@ class ServingRuntime(RemoteRuntime):
631
633
  project="",
632
634
  tag="",
633
635
  verbose=False,
634
- auth_info: schemas.AuthInfo = None,
635
636
  builder_env: Optional[dict] = None,
636
637
  force_build: bool = False,
637
638
  ):
@@ -640,8 +641,6 @@ class ServingRuntime(RemoteRuntime):
640
641
  :param project: optional, override function specified project name
641
642
  :param tag: specify unique function tag (a different function service is created for every tag)
642
643
  :param verbose: verbose logging
643
- :param auth_info: The auth info to use to communicate with the Nuclio dashboard, required only when providing
644
- dashboard
645
644
  :param builder_env: env vars dict for source archive config/credentials e.g. builder_env={"GIT_TOKEN": token}
646
645
  :param force_build: set True for force building the image
647
646
  """
@@ -686,7 +685,6 @@ class ServingRuntime(RemoteRuntime):
686
685
  project,
687
686
  tag,
688
687
  verbose,
689
- auth_info,
690
688
  builder_env=builder_env,
691
689
  force_build=force_build,
692
690
  )
@@ -709,6 +707,7 @@ class ServingRuntime(RemoteRuntime):
709
707
  "track_models": self.spec.track_models,
710
708
  "default_content_type": self.spec.default_content_type,
711
709
  "model_endpoint_creation_task_name": self.spec.model_endpoint_creation_task_name,
710
+ "filename": getattr(self.spec, "filename", None),
712
711
  }
713
712
 
714
713
  if self.spec.secret_sources:
@@ -717,6 +716,10 @@ class ServingRuntime(RemoteRuntime):
717
716
 
718
717
  return json.dumps(serving_spec)
719
718
 
719
+ @property
720
+ def serving_spec(self):
721
+ return self._get_serving_spec()
722
+
720
723
  def to_mock_server(
721
724
  self,
722
725
  namespace=None,
@@ -812,3 +815,40 @@ class ServingRuntime(RemoteRuntime):
812
815
  "Turn off the mock (mock=False) and make sure Nuclio is installed for real deployment to Nuclio"
813
816
  )
814
817
  self._mock_server = self.to_mock_server()
818
+
819
+ def to_job(self) -> KubejobRuntime:
820
+ """Convert this ServingRuntime to a KubejobRuntime, so that the graph can be run as a standalone job."""
821
+ if self.spec.function_refs:
822
+ raise mlrun.errors.MLRunInvalidArgumentError(
823
+ f"Cannot convert function '{self.metadata.name}' to a job because it has child functions"
824
+ )
825
+
826
+ spec = KubeResourceSpec(
827
+ image=self.spec.image,
828
+ mode=self.spec.mode,
829
+ volumes=self.spec.volumes,
830
+ volume_mounts=self.spec.volume_mounts,
831
+ env=self.spec.env,
832
+ resources=self.spec.resources,
833
+ default_handler="mlrun.serving.server.execute_graph",
834
+ pythonpath=self.spec.pythonpath,
835
+ entry_points=self.spec.entry_points,
836
+ description=self.spec.description,
837
+ workdir=self.spec.workdir,
838
+ image_pull_secret=self.spec.image_pull_secret,
839
+ node_name=self.spec.node_name,
840
+ node_selector=self.spec.node_selector,
841
+ affinity=self.spec.affinity,
842
+ disable_auto_mount=self.spec.disable_auto_mount,
843
+ priority_class_name=self.spec.priority_class_name,
844
+ tolerations=self.spec.tolerations,
845
+ preemption_mode=self.spec.preemption_mode,
846
+ security_context=self.spec.security_context,
847
+ state_thresholds=self.spec.state_thresholds,
848
+ serving_spec=self._get_serving_spec(),
849
+ )
850
+ job = KubejobRuntime(
851
+ spec=spec,
852
+ metadata=self.metadata,
853
+ )
854
+ return job