mlrun 1.7.1rc4__py3-none-any.whl → 1.8.0rc8__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.
- mlrun/__init__.py +23 -21
- mlrun/__main__.py +3 -3
- mlrun/alerts/alert.py +148 -14
- mlrun/artifacts/__init__.py +1 -2
- mlrun/artifacts/base.py +46 -12
- mlrun/artifacts/dataset.py +16 -16
- mlrun/artifacts/document.py +334 -0
- mlrun/artifacts/manager.py +15 -13
- mlrun/artifacts/model.py +66 -53
- mlrun/common/constants.py +7 -0
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/feature_set.py +1 -0
- mlrun/common/formatters/function.py +1 -0
- mlrun/{model_monitoring/db/stores/base/__init__.py → common/formatters/model_endpoint.py} +16 -1
- mlrun/common/formatters/pipeline.py +1 -2
- mlrun/common/formatters/project.py +9 -0
- mlrun/common/model_monitoring/__init__.py +0 -5
- mlrun/common/model_monitoring/helpers.py +1 -29
- mlrun/common/runtimes/constants.py +1 -2
- mlrun/common/schemas/__init__.py +6 -2
- mlrun/common/schemas/alert.py +111 -19
- mlrun/common/schemas/api_gateway.py +3 -3
- mlrun/common/schemas/artifact.py +11 -7
- mlrun/common/schemas/auth.py +6 -4
- mlrun/common/schemas/background_task.py +7 -7
- mlrun/common/schemas/client_spec.py +2 -3
- mlrun/common/schemas/clusterization_spec.py +2 -2
- mlrun/common/schemas/common.py +53 -3
- mlrun/common/schemas/constants.py +15 -0
- mlrun/common/schemas/datastore_profile.py +1 -1
- mlrun/common/schemas/feature_store.py +9 -9
- mlrun/common/schemas/frontend_spec.py +4 -4
- mlrun/common/schemas/function.py +10 -10
- mlrun/common/schemas/hub.py +1 -1
- mlrun/common/schemas/k8s.py +3 -3
- mlrun/common/schemas/memory_reports.py +3 -3
- mlrun/common/schemas/model_monitoring/__init__.py +2 -1
- mlrun/common/schemas/model_monitoring/constants.py +66 -14
- mlrun/common/schemas/model_monitoring/grafana.py +1 -1
- mlrun/common/schemas/model_monitoring/model_endpoints.py +91 -147
- mlrun/common/schemas/notification.py +24 -3
- mlrun/common/schemas/object.py +1 -1
- mlrun/common/schemas/pagination.py +4 -4
- mlrun/common/schemas/partition.py +137 -0
- mlrun/common/schemas/pipeline.py +2 -2
- mlrun/common/schemas/project.py +25 -17
- mlrun/common/schemas/runs.py +2 -2
- mlrun/common/schemas/runtime_resource.py +5 -5
- mlrun/common/schemas/schedule.py +1 -1
- mlrun/common/schemas/secret.py +1 -1
- mlrun/common/schemas/tag.py +3 -3
- mlrun/common/schemas/workflow.py +5 -5
- mlrun/config.py +67 -10
- mlrun/data_types/__init__.py +0 -2
- mlrun/data_types/infer.py +3 -1
- mlrun/data_types/spark.py +2 -1
- mlrun/datastore/__init__.py +0 -2
- mlrun/datastore/alibaba_oss.py +4 -1
- mlrun/datastore/azure_blob.py +4 -1
- mlrun/datastore/base.py +12 -4
- mlrun/datastore/datastore.py +9 -3
- mlrun/datastore/datastore_profile.py +79 -20
- mlrun/datastore/dbfs_store.py +4 -1
- mlrun/datastore/filestore.py +4 -1
- mlrun/datastore/google_cloud_storage.py +4 -1
- mlrun/datastore/hdfs.py +4 -1
- mlrun/datastore/inmem.py +4 -1
- mlrun/datastore/redis.py +4 -1
- mlrun/datastore/s3.py +4 -1
- mlrun/datastore/sources.py +52 -51
- mlrun/datastore/store_resources.py +0 -2
- mlrun/datastore/targets.py +21 -21
- mlrun/datastore/utils.py +2 -2
- mlrun/datastore/v3io.py +4 -1
- mlrun/datastore/vectorstore.py +194 -0
- mlrun/datastore/wasbfs/fs.py +13 -12
- mlrun/db/base.py +208 -82
- mlrun/db/factory.py +0 -3
- mlrun/db/httpdb.py +1237 -386
- mlrun/db/nopdb.py +201 -74
- mlrun/errors.py +2 -2
- mlrun/execution.py +136 -50
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +41 -40
- mlrun/feature_store/common.py +9 -9
- mlrun/feature_store/feature_set.py +20 -18
- mlrun/feature_store/feature_vector.py +27 -24
- mlrun/feature_store/retrieval/base.py +14 -9
- mlrun/feature_store/retrieval/job.py +2 -1
- mlrun/feature_store/steps.py +2 -2
- mlrun/features.py +30 -13
- mlrun/frameworks/__init__.py +1 -2
- mlrun/frameworks/_common/__init__.py +1 -2
- mlrun/frameworks/_common/artifacts_library.py +2 -2
- mlrun/frameworks/_common/mlrun_interface.py +10 -6
- mlrun/frameworks/_common/model_handler.py +29 -27
- mlrun/frameworks/_common/producer.py +3 -1
- mlrun/frameworks/_dl_common/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
- mlrun/frameworks/_ml_common/__init__.py +1 -2
- mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_ml_common/model_handler.py +21 -21
- mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/auto_mlrun/__init__.py +1 -2
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
- mlrun/frameworks/huggingface/__init__.py +1 -2
- mlrun/frameworks/huggingface/model_server.py +9 -9
- mlrun/frameworks/lgbm/__init__.py +47 -44
- mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
- mlrun/frameworks/lgbm/model_handler.py +15 -11
- mlrun/frameworks/lgbm/model_server.py +11 -7
- mlrun/frameworks/lgbm/utils.py +2 -2
- mlrun/frameworks/onnx/__init__.py +1 -2
- mlrun/frameworks/onnx/dataset.py +3 -3
- mlrun/frameworks/onnx/mlrun_interface.py +2 -2
- mlrun/frameworks/onnx/model_handler.py +7 -5
- mlrun/frameworks/onnx/model_server.py +8 -6
- mlrun/frameworks/parallel_coordinates.py +11 -11
- mlrun/frameworks/pytorch/__init__.py +22 -23
- mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
- mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
- mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
- mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
- mlrun/frameworks/pytorch/model_handler.py +21 -17
- mlrun/frameworks/pytorch/model_server.py +13 -9
- mlrun/frameworks/sklearn/__init__.py +19 -18
- mlrun/frameworks/sklearn/estimator.py +2 -2
- mlrun/frameworks/sklearn/metric.py +3 -3
- mlrun/frameworks/sklearn/metrics_library.py +8 -6
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
- mlrun/frameworks/sklearn/model_handler.py +4 -3
- mlrun/frameworks/tf_keras/__init__.py +11 -12
- mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
- mlrun/frameworks/tf_keras/model_handler.py +17 -13
- mlrun/frameworks/tf_keras/model_server.py +12 -8
- mlrun/frameworks/xgboost/__init__.py +19 -18
- mlrun/frameworks/xgboost/model_handler.py +13 -9
- mlrun/launcher/base.py +3 -4
- mlrun/launcher/local.py +1 -1
- mlrun/launcher/remote.py +1 -1
- mlrun/lists.py +4 -3
- mlrun/model.py +117 -46
- mlrun/model_monitoring/__init__.py +4 -4
- mlrun/model_monitoring/api.py +61 -59
- mlrun/model_monitoring/applications/_application_steps.py +17 -17
- mlrun/model_monitoring/applications/base.py +165 -6
- mlrun/model_monitoring/applications/context.py +88 -37
- mlrun/model_monitoring/applications/evidently_base.py +1 -2
- mlrun/model_monitoring/applications/histogram_data_drift.py +43 -21
- mlrun/model_monitoring/applications/results.py +55 -3
- mlrun/model_monitoring/controller.py +207 -239
- mlrun/model_monitoring/db/__init__.py +0 -2
- mlrun/model_monitoring/db/_schedules.py +156 -0
- mlrun/model_monitoring/db/_stats.py +189 -0
- mlrun/model_monitoring/db/tsdb/base.py +78 -25
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +90 -16
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +279 -59
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +78 -17
- mlrun/model_monitoring/helpers.py +152 -49
- mlrun/model_monitoring/stream_processing.py +99 -283
- mlrun/model_monitoring/tracking_policy.py +10 -3
- mlrun/model_monitoring/writer.py +48 -36
- mlrun/package/__init__.py +3 -6
- mlrun/package/context_handler.py +1 -1
- mlrun/package/packager.py +12 -9
- mlrun/package/packagers/__init__.py +0 -2
- mlrun/package/packagers/default_packager.py +14 -11
- mlrun/package/packagers/numpy_packagers.py +16 -7
- mlrun/package/packagers/pandas_packagers.py +18 -18
- mlrun/package/packagers/python_standard_library_packagers.py +25 -11
- mlrun/package/packagers_manager.py +31 -14
- mlrun/package/utils/__init__.py +0 -3
- mlrun/package/utils/_pickler.py +6 -6
- mlrun/platforms/__init__.py +47 -16
- mlrun/platforms/iguazio.py +4 -1
- mlrun/projects/operations.py +27 -27
- mlrun/projects/pipelines.py +75 -38
- mlrun/projects/project.py +865 -206
- mlrun/run.py +53 -10
- mlrun/runtimes/__init__.py +1 -3
- mlrun/runtimes/base.py +15 -11
- mlrun/runtimes/daskjob.py +9 -9
- mlrun/runtimes/generators.py +2 -1
- mlrun/runtimes/kubejob.py +4 -5
- mlrun/runtimes/mounts.py +572 -0
- mlrun/runtimes/mpijob/__init__.py +0 -2
- mlrun/runtimes/mpijob/abstract.py +7 -6
- mlrun/runtimes/nuclio/api_gateway.py +7 -7
- mlrun/runtimes/nuclio/application/application.py +11 -11
- mlrun/runtimes/nuclio/function.py +19 -17
- mlrun/runtimes/nuclio/serving.py +18 -11
- mlrun/runtimes/pod.py +154 -45
- mlrun/runtimes/remotesparkjob.py +3 -2
- mlrun/runtimes/sparkjob/__init__.py +0 -2
- mlrun/runtimes/sparkjob/spark3job.py +21 -11
- mlrun/runtimes/utils.py +6 -5
- mlrun/serving/merger.py +6 -4
- mlrun/serving/remote.py +18 -17
- mlrun/serving/routers.py +185 -172
- mlrun/serving/server.py +7 -1
- mlrun/serving/states.py +97 -78
- mlrun/serving/utils.py +13 -2
- mlrun/serving/v1_serving.py +3 -2
- mlrun/serving/v2_serving.py +74 -65
- mlrun/track/__init__.py +1 -1
- mlrun/track/tracker.py +2 -2
- mlrun/track/trackers/mlflow_tracker.py +6 -5
- mlrun/utils/async_http.py +1 -1
- mlrun/utils/clones.py +1 -1
- mlrun/utils/helpers.py +66 -18
- mlrun/utils/logger.py +106 -4
- mlrun/utils/notifications/notification/__init__.py +22 -19
- mlrun/utils/notifications/notification/base.py +33 -14
- mlrun/utils/notifications/notification/console.py +6 -6
- mlrun/utils/notifications/notification/git.py +11 -11
- mlrun/utils/notifications/notification/ipython.py +10 -9
- mlrun/utils/notifications/notification/mail.py +176 -0
- mlrun/utils/notifications/notification/slack.py +6 -6
- mlrun/utils/notifications/notification/webhook.py +6 -6
- mlrun/utils/notifications/notification_pusher.py +86 -44
- mlrun/utils/regex.py +3 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/METADATA +191 -186
- mlrun-1.8.0rc8.dist-info/RECORD +347 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/WHEEL +1 -1
- mlrun/model_monitoring/db/stores/__init__.py +0 -136
- mlrun/model_monitoring/db/stores/base/store.py +0 -213
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +0 -13
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -71
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -190
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +0 -103
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -40
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +0 -659
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +0 -13
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +0 -726
- mlrun/model_monitoring/model_endpoint.py +0 -118
- mlrun-1.7.1rc4.dist-info/RECORD +0 -351
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/LICENSE +0 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.1rc4.dist-info → mlrun-1.8.0rc8.dist-info}/top_level.txt +0 -0
|
@@ -275,7 +275,7 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
275
275
|
tag="",
|
|
276
276
|
verbose=False,
|
|
277
277
|
auth_info: schemas.AuthInfo = None,
|
|
278
|
-
builder_env: dict = None,
|
|
278
|
+
builder_env: typing.Optional[dict] = None,
|
|
279
279
|
force_build: bool = False,
|
|
280
280
|
with_mlrun=None,
|
|
281
281
|
skip_deployed=False,
|
|
@@ -367,7 +367,7 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
367
367
|
source,
|
|
368
368
|
workdir=None,
|
|
369
369
|
pull_at_runtime: bool = False,
|
|
370
|
-
target_dir: str = None,
|
|
370
|
+
target_dir: typing.Optional[str] = None,
|
|
371
371
|
):
|
|
372
372
|
"""load the code from git/tar/zip archive at build
|
|
373
373
|
|
|
@@ -426,12 +426,12 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
426
426
|
|
|
427
427
|
def create_api_gateway(
|
|
428
428
|
self,
|
|
429
|
-
name: str = None,
|
|
430
|
-
path: str = None,
|
|
429
|
+
name: typing.Optional[str] = None,
|
|
430
|
+
path: typing.Optional[str] = None,
|
|
431
431
|
direct_port_access: bool = False,
|
|
432
432
|
authentication_mode: schemas.APIGatewayAuthenticationMode = None,
|
|
433
|
-
authentication_creds: tuple[str, str] = None,
|
|
434
|
-
ssl_redirect: bool = None,
|
|
433
|
+
authentication_creds: typing.Optional[tuple[str, str]] = None,
|
|
434
|
+
ssl_redirect: typing.Optional[bool] = None,
|
|
435
435
|
set_as_default: bool = False,
|
|
436
436
|
gateway_timeout: typing.Optional[int] = None,
|
|
437
437
|
):
|
|
@@ -540,13 +540,13 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
540
540
|
self,
|
|
541
541
|
path: str = "",
|
|
542
542
|
body: typing.Optional[typing.Union[str, bytes, dict]] = None,
|
|
543
|
-
method: str = None,
|
|
544
|
-
headers: dict = None,
|
|
543
|
+
method: typing.Optional[str] = None,
|
|
544
|
+
headers: typing.Optional[dict] = None,
|
|
545
545
|
dashboard: str = "",
|
|
546
546
|
force_external_address: bool = False,
|
|
547
547
|
auth_info: schemas.AuthInfo = None,
|
|
548
|
-
mock: bool = None,
|
|
549
|
-
credentials: tuple[str, str] = None,
|
|
548
|
+
mock: typing.Optional[bool] = None,
|
|
549
|
+
credentials: typing.Optional[tuple[str, str]] = None,
|
|
550
550
|
**http_client_kwargs,
|
|
551
551
|
):
|
|
552
552
|
self._sync_api_gateway()
|
|
@@ -653,7 +653,7 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
653
653
|
|
|
654
654
|
def _build_application_image(
|
|
655
655
|
self,
|
|
656
|
-
builder_env: dict = None,
|
|
656
|
+
builder_env: typing.Optional[dict] = None,
|
|
657
657
|
force_build: bool = False,
|
|
658
658
|
watch=True,
|
|
659
659
|
with_mlrun=None,
|
|
@@ -26,9 +26,6 @@ import requests
|
|
|
26
26
|
import semver
|
|
27
27
|
from aiohttp.client import ClientSession
|
|
28
28
|
from kubernetes import client
|
|
29
|
-
from mlrun_pipelines.common.mounts import VolumeMount
|
|
30
|
-
from mlrun_pipelines.common.ops import deploy_op
|
|
31
|
-
from mlrun_pipelines.mounts import mount_v3io, v3io_cred
|
|
32
29
|
from nuclio.deploy import find_dashboard_url, get_deploy_status
|
|
33
30
|
from nuclio.triggers import V3IOStreamTrigger
|
|
34
31
|
|
|
@@ -47,9 +44,11 @@ from mlrun.platforms.iguazio import (
|
|
|
47
44
|
split_path,
|
|
48
45
|
)
|
|
49
46
|
from mlrun.runtimes.base import FunctionStatus, RunError
|
|
47
|
+
from mlrun.runtimes.mounts import VolumeMount, mount_v3io, v3io_cred
|
|
50
48
|
from mlrun.runtimes.pod import KubeResource, KubeResourceSpec
|
|
51
49
|
from mlrun.runtimes.utils import get_item_name, log_std
|
|
52
50
|
from mlrun.utils import get_in, logger, update_in
|
|
51
|
+
from mlrun_pipelines.common.ops import deploy_op
|
|
53
52
|
|
|
54
53
|
|
|
55
54
|
def validate_nuclio_version_compatibility(*min_versions):
|
|
@@ -554,7 +553,7 @@ class RemoteRuntime(KubeResource):
|
|
|
554
553
|
tag="",
|
|
555
554
|
verbose=False,
|
|
556
555
|
auth_info: AuthInfo = None,
|
|
557
|
-
builder_env: dict = None,
|
|
556
|
+
builder_env: typing.Optional[dict] = None,
|
|
558
557
|
force_build: bool = False,
|
|
559
558
|
):
|
|
560
559
|
"""Deploy the nuclio function to the cluster
|
|
@@ -693,7 +692,9 @@ class RemoteRuntime(KubeResource):
|
|
|
693
692
|
super().with_priority_class(name)
|
|
694
693
|
|
|
695
694
|
def with_service_type(
|
|
696
|
-
self,
|
|
695
|
+
self,
|
|
696
|
+
service_type: str,
|
|
697
|
+
add_templated_ingress_host_mode: typing.Optional[str] = None,
|
|
697
698
|
):
|
|
698
699
|
"""
|
|
699
700
|
Enables to control the service type of the pod and the addition of templated ingress host
|
|
@@ -887,13 +888,13 @@ class RemoteRuntime(KubeResource):
|
|
|
887
888
|
def invoke(
|
|
888
889
|
self,
|
|
889
890
|
path: str,
|
|
890
|
-
body: typing.Union[str, bytes, dict] = None,
|
|
891
|
-
method: str = None,
|
|
892
|
-
headers: dict = None,
|
|
891
|
+
body: typing.Optional[typing.Union[str, bytes, dict]] = None,
|
|
892
|
+
method: typing.Optional[str] = None,
|
|
893
|
+
headers: typing.Optional[dict] = None,
|
|
893
894
|
dashboard: str = "",
|
|
894
895
|
force_external_address: bool = False,
|
|
895
896
|
auth_info: AuthInfo = None,
|
|
896
|
-
mock: bool = None,
|
|
897
|
+
mock: typing.Optional[bool] = None,
|
|
897
898
|
**http_client_kwargs,
|
|
898
899
|
):
|
|
899
900
|
"""Invoke the remote (live) function and return the results
|
|
@@ -995,8 +996,8 @@ class RemoteRuntime(KubeResource):
|
|
|
995
996
|
|
|
996
997
|
def with_sidecar(
|
|
997
998
|
self,
|
|
998
|
-
name: str = None,
|
|
999
|
-
image: str = None,
|
|
999
|
+
name: typing.Optional[str] = None,
|
|
1000
|
+
image: typing.Optional[str] = None,
|
|
1000
1001
|
ports: typing.Optional[typing.Union[int, list[int]]] = None,
|
|
1001
1002
|
command: typing.Optional[str] = None,
|
|
1002
1003
|
args: typing.Optional[list[str]] = None,
|
|
@@ -1191,9 +1192,6 @@ class RemoteRuntime(KubeResource):
|
|
|
1191
1192
|
return results
|
|
1192
1193
|
|
|
1193
1194
|
def _resolve_invocation_url(self, path, force_external_address):
|
|
1194
|
-
if not path.startswith("/") and path != "":
|
|
1195
|
-
path = f"/{path}"
|
|
1196
|
-
|
|
1197
1195
|
# internal / external invocation urls is a nuclio >= 1.6.x feature
|
|
1198
1196
|
# try to infer the invocation url from the internal and if not exists, use external.
|
|
1199
1197
|
# $$$$ we do not want to use the external invocation url (e.g.: ingress, nodePort, etc.)
|
|
@@ -1202,12 +1200,16 @@ class RemoteRuntime(KubeResource):
|
|
|
1202
1200
|
and self.status.internal_invocation_urls
|
|
1203
1201
|
and mlrun.k8s_utils.is_running_inside_kubernetes_cluster()
|
|
1204
1202
|
):
|
|
1205
|
-
return
|
|
1203
|
+
return mlrun.utils.helpers.join_urls(
|
|
1204
|
+
f"http://{self.status.internal_invocation_urls[0]}", path
|
|
1205
|
+
)
|
|
1206
1206
|
|
|
1207
1207
|
if self.status.external_invocation_urls:
|
|
1208
|
-
return
|
|
1208
|
+
return mlrun.utils.helpers.join_urls(
|
|
1209
|
+
f"http://{self.status.external_invocation_urls[0]}", path
|
|
1210
|
+
)
|
|
1209
1211
|
else:
|
|
1210
|
-
return f"http://{self.status.address}
|
|
1212
|
+
return mlrun.utils.helpers.join_urls(f"http://{self.status.address}", path)
|
|
1211
1213
|
|
|
1212
1214
|
def _update_credentials_from_remote_build(self, remote_data):
|
|
1213
1215
|
self.metadata.credentials = remote_data.get("metadata", {}).get(
|
mlrun/runtimes/nuclio/serving.py
CHANGED
|
@@ -39,7 +39,7 @@ from mlrun.serving.states import (
|
|
|
39
39
|
)
|
|
40
40
|
from mlrun.utils import get_caller_globals, logger, set_paths
|
|
41
41
|
|
|
42
|
-
from .function import NuclioSpec, RemoteRuntime
|
|
42
|
+
from .function import NuclioSpec, RemoteRuntime, min_nuclio_versions
|
|
43
43
|
|
|
44
44
|
serving_subkind = "serving_v2"
|
|
45
45
|
|
|
@@ -51,7 +51,7 @@ if TYPE_CHECKING:
|
|
|
51
51
|
def new_v2_model_server(
|
|
52
52
|
name,
|
|
53
53
|
model_class: str,
|
|
54
|
-
models: dict = None,
|
|
54
|
+
models: Optional[dict] = None,
|
|
55
55
|
filename="",
|
|
56
56
|
protocol="",
|
|
57
57
|
image="",
|
|
@@ -356,12 +356,12 @@ class ServingRuntime(RemoteRuntime):
|
|
|
356
356
|
def add_model(
|
|
357
357
|
self,
|
|
358
358
|
key: str,
|
|
359
|
-
model_path: str = None,
|
|
360
|
-
class_name: str = None,
|
|
361
|
-
model_url: str = None,
|
|
362
|
-
handler: str = None,
|
|
363
|
-
router_step: str = None,
|
|
364
|
-
child_function: str = None,
|
|
359
|
+
model_path: Optional[str] = None,
|
|
360
|
+
class_name: Optional[str] = None,
|
|
361
|
+
model_url: Optional[str] = None,
|
|
362
|
+
handler: Optional[str] = None,
|
|
363
|
+
router_step: Optional[str] = None,
|
|
364
|
+
child_function: Optional[str] = None,
|
|
365
365
|
**class_args,
|
|
366
366
|
):
|
|
367
367
|
"""add ml model and/or route to the function.
|
|
@@ -509,7 +509,7 @@ class ServingRuntime(RemoteRuntime):
|
|
|
509
509
|
stream.path, group=group, shards=stream.shards, **trigger_args
|
|
510
510
|
)
|
|
511
511
|
|
|
512
|
-
def _deploy_function_refs(self, builder_env: dict = None):
|
|
512
|
+
def _deploy_function_refs(self, builder_env: Optional[dict] = None):
|
|
513
513
|
"""set metadata and deploy child functions"""
|
|
514
514
|
for function_ref in self._spec.function_refs.values():
|
|
515
515
|
logger.info(f"deploy child function {function_ref.name} ...")
|
|
@@ -577,13 +577,14 @@ class ServingRuntime(RemoteRuntime):
|
|
|
577
577
|
self.spec.secret_sources.append({"kind": kind, "source": source})
|
|
578
578
|
return self
|
|
579
579
|
|
|
580
|
+
@min_nuclio_versions("1.12.10")
|
|
580
581
|
def deploy(
|
|
581
582
|
self,
|
|
582
583
|
project="",
|
|
583
584
|
tag="",
|
|
584
585
|
verbose=False,
|
|
585
586
|
auth_info: mlrun.common.schemas.AuthInfo = None,
|
|
586
|
-
builder_env: dict = None,
|
|
587
|
+
builder_env: Optional[dict] = None,
|
|
587
588
|
force_build: bool = False,
|
|
588
589
|
):
|
|
589
590
|
"""deploy model serving function to a local/remote cluster
|
|
@@ -644,9 +645,12 @@ class ServingRuntime(RemoteRuntime):
|
|
|
644
645
|
|
|
645
646
|
def _get_serving_spec(self):
|
|
646
647
|
function_name_uri_map = {f.name: f.uri(self) for f in self.spec.function_refs}
|
|
647
|
-
|
|
648
648
|
serving_spec = {
|
|
649
|
+
"function_name": self.metadata.name,
|
|
650
|
+
"function_tag": self.metadata.tag,
|
|
649
651
|
"function_uri": self._function_uri(),
|
|
652
|
+
"function_hash": self.metadata.hash,
|
|
653
|
+
"project": self.metadata.project,
|
|
650
654
|
"version": "v2",
|
|
651
655
|
"parameters": self.spec.parameters,
|
|
652
656
|
"graph": self.spec.graph.to_dict() if self.spec.graph else {},
|
|
@@ -707,6 +711,9 @@ class ServingRuntime(RemoteRuntime):
|
|
|
707
711
|
function_uri=self._function_uri(),
|
|
708
712
|
secret_sources=self.spec.secret_sources,
|
|
709
713
|
default_content_type=self.spec.default_content_type,
|
|
714
|
+
function_name=self.metadata.name,
|
|
715
|
+
function_tag=self.metadata.tag,
|
|
716
|
+
project=self.metadata.project,
|
|
710
717
|
**kwargs,
|
|
711
718
|
)
|
|
712
719
|
server.init_states(
|
mlrun/runtimes/pod.py
CHANGED
|
@@ -17,14 +17,16 @@ import os
|
|
|
17
17
|
import re
|
|
18
18
|
import time
|
|
19
19
|
import typing
|
|
20
|
+
from collections.abc import Iterable
|
|
20
21
|
from enum import Enum
|
|
21
22
|
|
|
22
23
|
import dotenv
|
|
23
24
|
import kubernetes.client as k8s_client
|
|
24
|
-
import
|
|
25
|
-
from mlrun_pipelines.mixins import KfpAdapterMixin
|
|
25
|
+
from kubernetes.client import V1Volume, V1VolumeMount
|
|
26
26
|
|
|
27
|
+
import mlrun.common.constants
|
|
27
28
|
import mlrun.errors
|
|
29
|
+
import mlrun.runtimes.mounts
|
|
28
30
|
import mlrun.utils.regex
|
|
29
31
|
from mlrun.common.schemas import (
|
|
30
32
|
NodeSelectorOperator,
|
|
@@ -309,7 +311,7 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
309
311
|
return self._termination_grace_period_seconds
|
|
310
312
|
|
|
311
313
|
def _serialize_field(
|
|
312
|
-
self, struct: dict, field_name: str = None, strip: bool = False
|
|
314
|
+
self, struct: dict, field_name: typing.Optional[str] = None, strip: bool = False
|
|
313
315
|
) -> typing.Any:
|
|
314
316
|
"""
|
|
315
317
|
Serialize a field to a dict, list, or primitive type.
|
|
@@ -321,7 +323,7 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
321
323
|
return super()._serialize_field(struct, field_name, strip)
|
|
322
324
|
|
|
323
325
|
def _enrich_field(
|
|
324
|
-
self, struct: dict, field_name: str = None, strip: bool = False
|
|
326
|
+
self, struct: dict, field_name: typing.Optional[str] = None, strip: bool = False
|
|
325
327
|
) -> typing.Any:
|
|
326
328
|
k8s_api = k8s_client.ApiClient()
|
|
327
329
|
if strip:
|
|
@@ -366,6 +368,35 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
366
368
|
+ f"service accounts {allowed_service_accounts}"
|
|
367
369
|
)
|
|
368
370
|
|
|
371
|
+
def with_volumes(
|
|
372
|
+
self,
|
|
373
|
+
volumes: typing.Union[list[dict], dict, V1Volume],
|
|
374
|
+
) -> "KubeResourceSpec":
|
|
375
|
+
"""Add volumes to the volumes dictionary, only used as part of the mlrun_pipelines mount functions."""
|
|
376
|
+
if isinstance(volumes, dict):
|
|
377
|
+
set_named_item(self._volumes, volumes)
|
|
378
|
+
elif isinstance(volumes, Iterable):
|
|
379
|
+
for volume in volumes:
|
|
380
|
+
set_named_item(self._volumes, volume)
|
|
381
|
+
else:
|
|
382
|
+
set_named_item(self._volumes, volumes)
|
|
383
|
+
return self
|
|
384
|
+
|
|
385
|
+
def with_volume_mounts(
|
|
386
|
+
self,
|
|
387
|
+
volume_mounts: typing.Union[list[dict], dict, V1VolumeMount],
|
|
388
|
+
) -> "KubeResourceSpec":
|
|
389
|
+
"""Add volume mounts to the volume mounts dictionary,
|
|
390
|
+
only used as part of the mlrun_pipelines mount functions."""
|
|
391
|
+
if isinstance(volume_mounts, dict):
|
|
392
|
+
self._set_volume_mount(volume_mounts)
|
|
393
|
+
elif isinstance(volume_mounts, Iterable):
|
|
394
|
+
for volume_mount in volume_mounts:
|
|
395
|
+
self._set_volume_mount(volume_mount)
|
|
396
|
+
else:
|
|
397
|
+
self._set_volume_mount(volume_mounts)
|
|
398
|
+
return self
|
|
399
|
+
|
|
369
400
|
def _set_volume_mount(
|
|
370
401
|
self, volume_mount, volume_mounts_field_name="_volume_mounts"
|
|
371
402
|
):
|
|
@@ -380,9 +411,9 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
380
411
|
def _verify_and_set_limits(
|
|
381
412
|
self,
|
|
382
413
|
resources_field_name,
|
|
383
|
-
mem: str = None,
|
|
384
|
-
cpu: str = None,
|
|
385
|
-
gpus: int = None,
|
|
414
|
+
mem: typing.Optional[str] = None,
|
|
415
|
+
cpu: typing.Optional[str] = None,
|
|
416
|
+
gpus: typing.Optional[int] = None,
|
|
386
417
|
gpu_type: str = "nvidia.com/gpu",
|
|
387
418
|
patch: bool = False,
|
|
388
419
|
):
|
|
@@ -430,8 +461,8 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
430
461
|
def _verify_and_set_requests(
|
|
431
462
|
self,
|
|
432
463
|
resources_field_name,
|
|
433
|
-
mem: str = None,
|
|
434
|
-
cpu: str = None,
|
|
464
|
+
mem: typing.Optional[str] = None,
|
|
465
|
+
cpu: typing.Optional[str] = None,
|
|
435
466
|
patch: bool = False,
|
|
436
467
|
):
|
|
437
468
|
resources = verify_requests(resources_field_name, mem=mem, cpu=cpu)
|
|
@@ -456,9 +487,9 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
456
487
|
|
|
457
488
|
def with_limits(
|
|
458
489
|
self,
|
|
459
|
-
mem: str = None,
|
|
460
|
-
cpu: str = None,
|
|
461
|
-
gpus: int = None,
|
|
490
|
+
mem: typing.Optional[str] = None,
|
|
491
|
+
cpu: typing.Optional[str] = None,
|
|
492
|
+
gpus: typing.Optional[int] = None,
|
|
462
493
|
gpu_type: str = "nvidia.com/gpu",
|
|
463
494
|
patch: bool = False,
|
|
464
495
|
):
|
|
@@ -474,7 +505,12 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
474
505
|
"""
|
|
475
506
|
self._verify_and_set_limits("resources", mem, cpu, gpus, gpu_type, patch=patch)
|
|
476
507
|
|
|
477
|
-
def with_requests(
|
|
508
|
+
def with_requests(
|
|
509
|
+
self,
|
|
510
|
+
mem: typing.Optional[str] = None,
|
|
511
|
+
cpu: typing.Optional[str] = None,
|
|
512
|
+
patch: bool = False,
|
|
513
|
+
):
|
|
478
514
|
"""
|
|
479
515
|
Set requested (desired) pod cpu/memory resources
|
|
480
516
|
|
|
@@ -936,12 +972,12 @@ class AutoMountType(str, Enum):
|
|
|
936
972
|
@classmethod
|
|
937
973
|
def all_mount_modifiers(cls):
|
|
938
974
|
return [
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
975
|
+
mlrun.runtimes.mounts.v3io_cred.__name__,
|
|
976
|
+
mlrun.runtimes.mounts.mount_v3io.__name__,
|
|
977
|
+
mlrun.runtimes.mounts.mount_pvc.__name__,
|
|
978
|
+
mlrun.runtimes.mounts.auto_mount.__name__,
|
|
979
|
+
mlrun.runtimes.mounts.mount_s3.__name__,
|
|
980
|
+
mlrun.runtimes.mounts.set_env_variables.__name__,
|
|
945
981
|
]
|
|
946
982
|
|
|
947
983
|
@classmethod
|
|
@@ -958,27 +994,27 @@ class AutoMountType(str, Enum):
|
|
|
958
994
|
def _get_auto_modifier():
|
|
959
995
|
# If we're running on Iguazio - use v3io_cred
|
|
960
996
|
if mlconf.igz_version != "":
|
|
961
|
-
return
|
|
997
|
+
return mlrun.runtimes.mounts.v3io_cred
|
|
962
998
|
# Else, either pvc mount if it's configured or do nothing otherwise
|
|
963
999
|
pvc_configured = (
|
|
964
1000
|
"MLRUN_PVC_MOUNT" in os.environ
|
|
965
1001
|
or "pvc_name" in mlconf.get_storage_auto_mount_params()
|
|
966
1002
|
)
|
|
967
|
-
return
|
|
1003
|
+
return mlrun.runtimes.mounts.mount_pvc if pvc_configured else None
|
|
968
1004
|
|
|
969
1005
|
def get_modifier(self):
|
|
970
1006
|
return {
|
|
971
1007
|
AutoMountType.none: None,
|
|
972
|
-
AutoMountType.v3io_credentials:
|
|
973
|
-
AutoMountType.v3io_fuse:
|
|
974
|
-
AutoMountType.pvc:
|
|
1008
|
+
AutoMountType.v3io_credentials: mlrun.runtimes.mounts.v3io_cred,
|
|
1009
|
+
AutoMountType.v3io_fuse: mlrun.runtimes.mounts.mount_v3io,
|
|
1010
|
+
AutoMountType.pvc: mlrun.runtimes.mounts.mount_pvc,
|
|
975
1011
|
AutoMountType.auto: self._get_auto_modifier(),
|
|
976
|
-
AutoMountType.s3:
|
|
977
|
-
AutoMountType.env:
|
|
1012
|
+
AutoMountType.s3: mlrun.runtimes.mounts.mount_s3,
|
|
1013
|
+
AutoMountType.env: mlrun.runtimes.mounts.set_env_variables,
|
|
978
1014
|
}[self]
|
|
979
1015
|
|
|
980
1016
|
|
|
981
|
-
class KubeResource(BaseRuntime
|
|
1017
|
+
class KubeResource(BaseRuntime):
|
|
982
1018
|
"""
|
|
983
1019
|
A parent class for runtimes that generate k8s resources when executing.
|
|
984
1020
|
"""
|
|
@@ -1020,7 +1056,8 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1020
1056
|
|
|
1021
1057
|
def get_env(self, name, default=None):
|
|
1022
1058
|
"""Get the pod environment variable for the given name, if not found return the default
|
|
1023
|
-
If it's a scalar value, will return it, if the value is from source, return the k8s struct (V1EnvVarSource)
|
|
1059
|
+
If it's a scalar value, will return it, if the value is from source, return the k8s struct (V1EnvVarSource)
|
|
1060
|
+
"""
|
|
1024
1061
|
for env_var in self.spec.env:
|
|
1025
1062
|
if get_item_name(env_var) == name:
|
|
1026
1063
|
# valueFrom is a workaround for now, for some reason the envs aren't getting sanitized
|
|
@@ -1050,7 +1087,11 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1050
1087
|
self.spec.env.append(new_var)
|
|
1051
1088
|
return self
|
|
1052
1089
|
|
|
1053
|
-
def set_envs(
|
|
1090
|
+
def set_envs(
|
|
1091
|
+
self,
|
|
1092
|
+
env_vars: typing.Optional[dict] = None,
|
|
1093
|
+
file_path: typing.Optional[str] = None,
|
|
1094
|
+
):
|
|
1054
1095
|
"""set pod environment var from key/value dict or .env file
|
|
1055
1096
|
|
|
1056
1097
|
:param env_vars: dict with env key/values
|
|
@@ -1070,11 +1111,16 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1070
1111
|
else:
|
|
1071
1112
|
raise mlrun.errors.MLRunNotFoundError(f"{file_path} does not exist")
|
|
1072
1113
|
for name, value in env_vars.items():
|
|
1073
|
-
|
|
1114
|
+
if isinstance(value, dict) and "valueFrom" in value:
|
|
1115
|
+
self.set_env(name, value_from=value["valueFrom"])
|
|
1116
|
+
else:
|
|
1117
|
+
self.set_env(name, value)
|
|
1074
1118
|
return self
|
|
1075
1119
|
|
|
1076
1120
|
def set_image_pull_configuration(
|
|
1077
|
-
self,
|
|
1121
|
+
self,
|
|
1122
|
+
image_pull_policy: typing.Optional[str] = None,
|
|
1123
|
+
image_pull_secret_name: typing.Optional[str] = None,
|
|
1078
1124
|
):
|
|
1079
1125
|
"""
|
|
1080
1126
|
Configure the image pull parameters for the runtime.
|
|
@@ -1123,9 +1169,9 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1123
1169
|
|
|
1124
1170
|
def with_limits(
|
|
1125
1171
|
self,
|
|
1126
|
-
mem: str = None,
|
|
1127
|
-
cpu: str = None,
|
|
1128
|
-
gpus: int = None,
|
|
1172
|
+
mem: typing.Optional[str] = None,
|
|
1173
|
+
cpu: typing.Optional[str] = None,
|
|
1174
|
+
gpus: typing.Optional[int] = None,
|
|
1129
1175
|
gpu_type: str = "nvidia.com/gpu",
|
|
1130
1176
|
patch: bool = False,
|
|
1131
1177
|
):
|
|
@@ -1141,7 +1187,12 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1141
1187
|
"""
|
|
1142
1188
|
self.spec.with_limits(mem, cpu, gpus, gpu_type, patch=patch)
|
|
1143
1189
|
|
|
1144
|
-
def with_requests(
|
|
1190
|
+
def with_requests(
|
|
1191
|
+
self,
|
|
1192
|
+
mem: typing.Optional[str] = None,
|
|
1193
|
+
cpu: typing.Optional[str] = None,
|
|
1194
|
+
patch: bool = False,
|
|
1195
|
+
):
|
|
1145
1196
|
"""
|
|
1146
1197
|
Set requested (desired) pod cpu/memory resources
|
|
1147
1198
|
|
|
@@ -1253,6 +1304,36 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1253
1304
|
)
|
|
1254
1305
|
self.spec.security_context = security_context
|
|
1255
1306
|
|
|
1307
|
+
def apply(
|
|
1308
|
+
self,
|
|
1309
|
+
modifier: typing.Callable[["KubeResource"], "KubeResource"],
|
|
1310
|
+
) -> "KubeResource":
|
|
1311
|
+
"""
|
|
1312
|
+
Apply a modifier to the runtime which is used to change the runtimes k8s object's spec.
|
|
1313
|
+
All modifiers accept Kube, apply some changes on its spec and return it so modifiers can be chained
|
|
1314
|
+
one after the other.
|
|
1315
|
+
|
|
1316
|
+
:param modifier: a modifier callable object
|
|
1317
|
+
:return: the runtime (self) after the modifications
|
|
1318
|
+
"""
|
|
1319
|
+
modifier(self)
|
|
1320
|
+
if AutoMountType.is_auto_modifier(modifier):
|
|
1321
|
+
self.spec.disable_auto_mount = True
|
|
1322
|
+
|
|
1323
|
+
api_client = k8s_client.ApiClient()
|
|
1324
|
+
if self.spec.env:
|
|
1325
|
+
for index, env in enumerate(
|
|
1326
|
+
api_client.sanitize_for_serialization(self.spec.env)
|
|
1327
|
+
):
|
|
1328
|
+
self.spec.env[index] = env
|
|
1329
|
+
|
|
1330
|
+
if self.spec.volumes and self.spec.volume_mounts:
|
|
1331
|
+
vols = api_client.sanitize_for_serialization(self.spec.volumes)
|
|
1332
|
+
mounts = api_client.sanitize_for_serialization(self.spec.volume_mounts)
|
|
1333
|
+
self.spec.update_vols_and_mounts(vols, mounts)
|
|
1334
|
+
|
|
1335
|
+
return self
|
|
1336
|
+
|
|
1256
1337
|
def list_valid_priority_class_names(self):
|
|
1257
1338
|
return mlconf.get_valid_function_priority_class_names()
|
|
1258
1339
|
|
|
@@ -1412,20 +1493,32 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1412
1493
|
):
|
|
1413
1494
|
db = self._get_db()
|
|
1414
1495
|
offset = 0
|
|
1496
|
+
events_offset = 0
|
|
1415
1497
|
try:
|
|
1416
|
-
text, _ = db.get_builder_status(
|
|
1498
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1499
|
+
self,
|
|
1500
|
+
offset=0,
|
|
1501
|
+
logs=logs,
|
|
1502
|
+
events_offset=0,
|
|
1503
|
+
)
|
|
1417
1504
|
except mlrun.db.RunDBError:
|
|
1418
|
-
raise ValueError("
|
|
1505
|
+
raise ValueError("Function or build process not found")
|
|
1419
1506
|
|
|
1420
|
-
def print_log(
|
|
1421
|
-
if
|
|
1507
|
+
def print_log(_text):
|
|
1508
|
+
if _text and (
|
|
1422
1509
|
not show_on_failure
|
|
1423
1510
|
or self.status.state == mlrun.common.schemas.FunctionState.error
|
|
1424
1511
|
):
|
|
1425
|
-
print(
|
|
1512
|
+
print(_text, end="")
|
|
1426
1513
|
|
|
1427
1514
|
print_log(text)
|
|
1428
|
-
|
|
1515
|
+
if (
|
|
1516
|
+
deploy_status_text_kind
|
|
1517
|
+
== mlrun.common.constants.DeployStatusTextKind.events
|
|
1518
|
+
):
|
|
1519
|
+
events_offset += len(text)
|
|
1520
|
+
else:
|
|
1521
|
+
offset += len(text)
|
|
1429
1522
|
if watch:
|
|
1430
1523
|
while self.status.state in [
|
|
1431
1524
|
mlrun.common.schemas.FunctionState.pending,
|
|
@@ -1434,14 +1527,30 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1434
1527
|
time.sleep(2)
|
|
1435
1528
|
if show_on_failure:
|
|
1436
1529
|
text = ""
|
|
1437
|
-
db.get_builder_status(self, 0, logs=False)
|
|
1530
|
+
db.get_builder_status(self, offset=0, logs=False, events_offset=0)
|
|
1438
1531
|
if self.status.state == mlrun.common.schemas.FunctionState.error:
|
|
1439
1532
|
# re-read the full log on failure
|
|
1440
|
-
text, _ = db.get_builder_status(
|
|
1533
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1534
|
+
self,
|
|
1535
|
+
offset=offset,
|
|
1536
|
+
logs=logs,
|
|
1537
|
+
events_offset=events_offset,
|
|
1538
|
+
)
|
|
1441
1539
|
else:
|
|
1442
|
-
text, _ = db.get_builder_status(
|
|
1540
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1541
|
+
self,
|
|
1542
|
+
offset=offset,
|
|
1543
|
+
logs=logs,
|
|
1544
|
+
events_offset=events_offset,
|
|
1545
|
+
)
|
|
1443
1546
|
print_log(text)
|
|
1444
|
-
|
|
1547
|
+
if (
|
|
1548
|
+
deploy_status_text_kind
|
|
1549
|
+
== mlrun.common.constants.DeployStatusTextKind.events
|
|
1550
|
+
):
|
|
1551
|
+
events_offset += len(text)
|
|
1552
|
+
else:
|
|
1553
|
+
offset += len(text)
|
|
1445
1554
|
|
|
1446
1555
|
return self.status.state
|
|
1447
1556
|
|
mlrun/runtimes/remotesparkjob.py
CHANGED
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import re
|
|
15
15
|
from subprocess import run
|
|
16
|
+
from typing import Optional
|
|
16
17
|
|
|
17
18
|
import kubernetes.client
|
|
18
|
-
from mlrun_pipelines.mounts import mount_v3io, mount_v3iod
|
|
19
19
|
|
|
20
20
|
import mlrun.errors
|
|
21
21
|
from mlrun.config import config
|
|
22
|
+
from mlrun.runtimes.mounts import mount_v3io, mount_v3iod
|
|
22
23
|
|
|
23
24
|
from .kubejob import KubejobRuntime
|
|
24
25
|
from .pod import KubeResourceSpec
|
|
@@ -179,7 +180,7 @@ class RemoteSparkRuntime(KubejobRuntime):
|
|
|
179
180
|
skip_deployed=False,
|
|
180
181
|
is_kfp=False,
|
|
181
182
|
mlrun_version_specifier=None,
|
|
182
|
-
builder_env: dict = None,
|
|
183
|
+
builder_env: Optional[dict] = None,
|
|
183
184
|
show_on_failure: bool = False,
|
|
184
185
|
force_build: bool = False,
|
|
185
186
|
):
|