mlrun 1.7.2rc3__py3-none-any.whl → 1.8.0rc1__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 +14 -12
- mlrun/__main__.py +3 -3
- mlrun/alerts/alert.py +19 -12
- mlrun/artifacts/__init__.py +0 -2
- mlrun/artifacts/base.py +34 -11
- mlrun/artifacts/dataset.py +16 -16
- mlrun/artifacts/manager.py +13 -13
- mlrun/artifacts/model.py +66 -53
- mlrun/common/constants.py +6 -0
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/feature_set.py +1 -0
- mlrun/common/formatters/function.py +1 -0
- mlrun/common/formatters/model_endpoint.py +30 -0
- mlrun/common/formatters/pipeline.py +1 -2
- mlrun/common/model_monitoring/__init__.py +0 -3
- mlrun/common/model_monitoring/helpers.py +1 -1
- mlrun/common/runtimes/constants.py +1 -2
- mlrun/common/schemas/__init__.py +4 -2
- mlrun/common/schemas/artifact.py +0 -6
- mlrun/common/schemas/common.py +50 -0
- mlrun/common/schemas/model_monitoring/__init__.py +8 -1
- mlrun/common/schemas/model_monitoring/constants.py +62 -12
- mlrun/common/schemas/model_monitoring/model_endpoint_v2.py +149 -0
- mlrun/common/schemas/model_monitoring/model_endpoints.py +21 -5
- mlrun/common/schemas/partition.py +122 -0
- mlrun/config.py +43 -15
- mlrun/data_types/__init__.py +0 -2
- mlrun/data_types/data_types.py +0 -1
- mlrun/data_types/infer.py +3 -1
- mlrun/data_types/spark.py +4 -4
- mlrun/data_types/to_pandas.py +2 -11
- 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 +1 -1
- 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 +51 -49
- mlrun/datastore/store_resources.py +0 -2
- mlrun/datastore/targets.py +22 -23
- mlrun/datastore/utils.py +2 -2
- mlrun/datastore/v3io.py +4 -1
- mlrun/datastore/wasbfs/fs.py +13 -12
- mlrun/db/base.py +126 -62
- mlrun/db/factory.py +3 -0
- mlrun/db/httpdb.py +767 -231
- mlrun/db/nopdb.py +126 -57
- mlrun/errors.py +2 -2
- mlrun/execution.py +55 -29
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +40 -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 +108 -44
- mlrun/model_monitoring/__init__.py +1 -2
- mlrun/model_monitoring/api.py +6 -6
- mlrun/model_monitoring/applications/_application_steps.py +13 -15
- mlrun/model_monitoring/applications/histogram_data_drift.py +41 -15
- mlrun/model_monitoring/applications/results.py +55 -3
- mlrun/model_monitoring/controller.py +185 -223
- mlrun/model_monitoring/db/_schedules.py +156 -0
- mlrun/model_monitoring/db/_stats.py +189 -0
- mlrun/model_monitoring/db/stores/__init__.py +1 -1
- mlrun/model_monitoring/db/stores/base/store.py +6 -65
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -25
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -97
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +2 -58
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -15
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +6 -257
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +9 -271
- mlrun/model_monitoring/db/tsdb/base.py +74 -22
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +66 -35
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +284 -51
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +35 -17
- mlrun/model_monitoring/helpers.py +97 -1
- mlrun/model_monitoring/model_endpoint.py +4 -2
- mlrun/model_monitoring/stream_processing.py +2 -2
- mlrun/model_monitoring/tracking_policy.py +10 -3
- mlrun/model_monitoring/writer.py +47 -26
- 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 +3 -3
- mlrun/platforms/iguazio.py +4 -1
- mlrun/projects/__init__.py +1 -6
- mlrun/projects/operations.py +27 -27
- mlrun/projects/pipelines.py +85 -215
- mlrun/projects/project.py +444 -158
- mlrun/run.py +9 -9
- mlrun/runtimes/__init__.py +1 -3
- mlrun/runtimes/base.py +13 -10
- mlrun/runtimes/daskjob.py +9 -9
- mlrun/runtimes/generators.py +2 -1
- mlrun/runtimes/kubejob.py +4 -5
- 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 +14 -13
- mlrun/runtimes/nuclio/serving.py +9 -9
- mlrun/runtimes/pod.py +74 -29
- 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 +27 -27
- mlrun/serving/server.py +1 -1
- mlrun/serving/states.py +76 -71
- mlrun/serving/utils.py +13 -2
- mlrun/serving/v1_serving.py +3 -2
- mlrun/serving/v2_serving.py +4 -4
- 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/helpers.py +72 -28
- mlrun/utils/logger.py +104 -2
- mlrun/utils/notifications/notification/base.py +23 -4
- mlrun/utils/notifications/notification/console.py +1 -1
- mlrun/utils/notifications/notification/git.py +6 -6
- mlrun/utils/notifications/notification/ipython.py +5 -4
- mlrun/utils/notifications/notification/slack.py +1 -1
- mlrun/utils/notifications/notification/webhook.py +13 -17
- mlrun/utils/notifications/notification_pusher.py +23 -19
- mlrun/utils/regex.py +1 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc1.dist-info}/METADATA +186 -186
- mlrun-1.8.0rc1.dist-info/RECORD +356 -0
- {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc1.dist-info}/WHEEL +1 -1
- mlrun-1.7.2rc3.dist-info/RECORD +0 -351
- {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc1.dist-info}/LICENSE +0 -0
- {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc1.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.2rc3.dist-info → mlrun-1.8.0rc1.dist-info}/top_level.txt +0 -0
mlrun/runtimes/pod.py
CHANGED
|
@@ -21,16 +21,17 @@ from enum import Enum
|
|
|
21
21
|
|
|
22
22
|
import dotenv
|
|
23
23
|
import kubernetes.client as k8s_client
|
|
24
|
-
import mlrun_pipelines.mounts
|
|
25
|
-
from mlrun_pipelines.mixins import KfpAdapterMixin
|
|
26
24
|
|
|
25
|
+
import mlrun.common.constants
|
|
27
26
|
import mlrun.errors
|
|
28
27
|
import mlrun.utils.regex
|
|
28
|
+
import mlrun_pipelines.mounts
|
|
29
29
|
from mlrun.common.schemas import (
|
|
30
30
|
NodeSelectorOperator,
|
|
31
31
|
PreemptionModes,
|
|
32
32
|
SecurityContextEnrichmentModes,
|
|
33
33
|
)
|
|
34
|
+
from mlrun_pipelines.mixins import KfpAdapterMixin
|
|
34
35
|
|
|
35
36
|
from ..config import config as mlconf
|
|
36
37
|
from ..k8s_utils import (
|
|
@@ -309,7 +310,7 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
309
310
|
return self._termination_grace_period_seconds
|
|
310
311
|
|
|
311
312
|
def _serialize_field(
|
|
312
|
-
self, struct: dict, field_name: str = None, strip: bool = False
|
|
313
|
+
self, struct: dict, field_name: typing.Optional[str] = None, strip: bool = False
|
|
313
314
|
) -> typing.Any:
|
|
314
315
|
"""
|
|
315
316
|
Serialize a field to a dict, list, or primitive type.
|
|
@@ -321,7 +322,7 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
321
322
|
return super()._serialize_field(struct, field_name, strip)
|
|
322
323
|
|
|
323
324
|
def _enrich_field(
|
|
324
|
-
self, struct: dict, field_name: str = None, strip: bool = False
|
|
325
|
+
self, struct: dict, field_name: typing.Optional[str] = None, strip: bool = False
|
|
325
326
|
) -> typing.Any:
|
|
326
327
|
k8s_api = k8s_client.ApiClient()
|
|
327
328
|
if strip:
|
|
@@ -380,9 +381,9 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
380
381
|
def _verify_and_set_limits(
|
|
381
382
|
self,
|
|
382
383
|
resources_field_name,
|
|
383
|
-
mem: str = None,
|
|
384
|
-
cpu: str = None,
|
|
385
|
-
gpus: int = None,
|
|
384
|
+
mem: typing.Optional[str] = None,
|
|
385
|
+
cpu: typing.Optional[str] = None,
|
|
386
|
+
gpus: typing.Optional[int] = None,
|
|
386
387
|
gpu_type: str = "nvidia.com/gpu",
|
|
387
388
|
patch: bool = False,
|
|
388
389
|
):
|
|
@@ -430,8 +431,8 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
430
431
|
def _verify_and_set_requests(
|
|
431
432
|
self,
|
|
432
433
|
resources_field_name,
|
|
433
|
-
mem: str = None,
|
|
434
|
-
cpu: str = None,
|
|
434
|
+
mem: typing.Optional[str] = None,
|
|
435
|
+
cpu: typing.Optional[str] = None,
|
|
435
436
|
patch: bool = False,
|
|
436
437
|
):
|
|
437
438
|
resources = verify_requests(resources_field_name, mem=mem, cpu=cpu)
|
|
@@ -456,9 +457,9 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
456
457
|
|
|
457
458
|
def with_limits(
|
|
458
459
|
self,
|
|
459
|
-
mem: str = None,
|
|
460
|
-
cpu: str = None,
|
|
461
|
-
gpus: int = None,
|
|
460
|
+
mem: typing.Optional[str] = None,
|
|
461
|
+
cpu: typing.Optional[str] = None,
|
|
462
|
+
gpus: typing.Optional[int] = None,
|
|
462
463
|
gpu_type: str = "nvidia.com/gpu",
|
|
463
464
|
patch: bool = False,
|
|
464
465
|
):
|
|
@@ -474,7 +475,12 @@ class KubeResourceSpec(FunctionSpec):
|
|
|
474
475
|
"""
|
|
475
476
|
self._verify_and_set_limits("resources", mem, cpu, gpus, gpu_type, patch=patch)
|
|
476
477
|
|
|
477
|
-
def with_requests(
|
|
478
|
+
def with_requests(
|
|
479
|
+
self,
|
|
480
|
+
mem: typing.Optional[str] = None,
|
|
481
|
+
cpu: typing.Optional[str] = None,
|
|
482
|
+
patch: bool = False,
|
|
483
|
+
):
|
|
478
484
|
"""
|
|
479
485
|
Set requested (desired) pod cpu/memory resources
|
|
480
486
|
|
|
@@ -1050,7 +1056,11 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1050
1056
|
self.spec.env.append(new_var)
|
|
1051
1057
|
return self
|
|
1052
1058
|
|
|
1053
|
-
def set_envs(
|
|
1059
|
+
def set_envs(
|
|
1060
|
+
self,
|
|
1061
|
+
env_vars: typing.Optional[dict] = None,
|
|
1062
|
+
file_path: typing.Optional[str] = None,
|
|
1063
|
+
):
|
|
1054
1064
|
"""set pod environment var from key/value dict or .env file
|
|
1055
1065
|
|
|
1056
1066
|
:param env_vars: dict with env key/values
|
|
@@ -1074,7 +1084,9 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1074
1084
|
return self
|
|
1075
1085
|
|
|
1076
1086
|
def set_image_pull_configuration(
|
|
1077
|
-
self,
|
|
1087
|
+
self,
|
|
1088
|
+
image_pull_policy: typing.Optional[str] = None,
|
|
1089
|
+
image_pull_secret_name: typing.Optional[str] = None,
|
|
1078
1090
|
):
|
|
1079
1091
|
"""
|
|
1080
1092
|
Configure the image pull parameters for the runtime.
|
|
@@ -1123,9 +1135,9 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1123
1135
|
|
|
1124
1136
|
def with_limits(
|
|
1125
1137
|
self,
|
|
1126
|
-
mem: str = None,
|
|
1127
|
-
cpu: str = None,
|
|
1128
|
-
gpus: int = None,
|
|
1138
|
+
mem: typing.Optional[str] = None,
|
|
1139
|
+
cpu: typing.Optional[str] = None,
|
|
1140
|
+
gpus: typing.Optional[int] = None,
|
|
1129
1141
|
gpu_type: str = "nvidia.com/gpu",
|
|
1130
1142
|
patch: bool = False,
|
|
1131
1143
|
):
|
|
@@ -1141,7 +1153,12 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1141
1153
|
"""
|
|
1142
1154
|
self.spec.with_limits(mem, cpu, gpus, gpu_type, patch=patch)
|
|
1143
1155
|
|
|
1144
|
-
def with_requests(
|
|
1156
|
+
def with_requests(
|
|
1157
|
+
self,
|
|
1158
|
+
mem: typing.Optional[str] = None,
|
|
1159
|
+
cpu: typing.Optional[str] = None,
|
|
1160
|
+
patch: bool = False,
|
|
1161
|
+
):
|
|
1145
1162
|
"""
|
|
1146
1163
|
Set requested (desired) pod cpu/memory resources
|
|
1147
1164
|
|
|
@@ -1412,20 +1429,32 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1412
1429
|
):
|
|
1413
1430
|
db = self._get_db()
|
|
1414
1431
|
offset = 0
|
|
1432
|
+
events_offset = 0
|
|
1415
1433
|
try:
|
|
1416
|
-
text, _ = db.get_builder_status(
|
|
1434
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1435
|
+
self,
|
|
1436
|
+
offset=0,
|
|
1437
|
+
logs=logs,
|
|
1438
|
+
events_offset=0,
|
|
1439
|
+
)
|
|
1417
1440
|
except mlrun.db.RunDBError:
|
|
1418
|
-
raise ValueError("
|
|
1441
|
+
raise ValueError("Function or build process not found")
|
|
1419
1442
|
|
|
1420
|
-
def print_log(
|
|
1421
|
-
if
|
|
1443
|
+
def print_log(_text):
|
|
1444
|
+
if _text and (
|
|
1422
1445
|
not show_on_failure
|
|
1423
1446
|
or self.status.state == mlrun.common.schemas.FunctionState.error
|
|
1424
1447
|
):
|
|
1425
|
-
print(
|
|
1448
|
+
print(_text, end="")
|
|
1426
1449
|
|
|
1427
1450
|
print_log(text)
|
|
1428
|
-
|
|
1451
|
+
if (
|
|
1452
|
+
deploy_status_text_kind
|
|
1453
|
+
== mlrun.common.constants.DeployStatusTextKind.events
|
|
1454
|
+
):
|
|
1455
|
+
events_offset += len(text)
|
|
1456
|
+
else:
|
|
1457
|
+
offset += len(text)
|
|
1429
1458
|
if watch:
|
|
1430
1459
|
while self.status.state in [
|
|
1431
1460
|
mlrun.common.schemas.FunctionState.pending,
|
|
@@ -1434,14 +1463,30 @@ class KubeResource(BaseRuntime, KfpAdapterMixin):
|
|
|
1434
1463
|
time.sleep(2)
|
|
1435
1464
|
if show_on_failure:
|
|
1436
1465
|
text = ""
|
|
1437
|
-
db.get_builder_status(self, 0, logs=False)
|
|
1466
|
+
db.get_builder_status(self, offset=0, logs=False, events_offset=0)
|
|
1438
1467
|
if self.status.state == mlrun.common.schemas.FunctionState.error:
|
|
1439
1468
|
# re-read the full log on failure
|
|
1440
|
-
text, _ = db.get_builder_status(
|
|
1469
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1470
|
+
self,
|
|
1471
|
+
offset=offset,
|
|
1472
|
+
logs=logs,
|
|
1473
|
+
events_offset=events_offset,
|
|
1474
|
+
)
|
|
1441
1475
|
else:
|
|
1442
|
-
text, _ = db.get_builder_status(
|
|
1476
|
+
text, _, deploy_status_text_kind = db.get_builder_status(
|
|
1477
|
+
self,
|
|
1478
|
+
offset=offset,
|
|
1479
|
+
logs=logs,
|
|
1480
|
+
events_offset=events_offset,
|
|
1481
|
+
)
|
|
1443
1482
|
print_log(text)
|
|
1444
|
-
|
|
1483
|
+
if (
|
|
1484
|
+
deploy_status_text_kind
|
|
1485
|
+
== mlrun.common.constants.DeployStatusTextKind.events
|
|
1486
|
+
):
|
|
1487
|
+
events_offset += len(text)
|
|
1488
|
+
else:
|
|
1489
|
+
offset += len(text)
|
|
1445
1490
|
|
|
1446
1491
|
return self.status.state
|
|
1447
1492
|
|
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_pipelines.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
|
):
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
import typing
|
|
15
15
|
|
|
16
16
|
import kubernetes.client
|
|
17
|
-
from mlrun_pipelines.mounts import mount_v3io, mount_v3iod
|
|
18
17
|
|
|
19
18
|
import mlrun.common.schemas.function
|
|
20
19
|
import mlrun.errors
|
|
21
20
|
import mlrun.k8s_utils
|
|
22
21
|
import mlrun.runtimes.pod
|
|
23
22
|
from mlrun.config import config
|
|
23
|
+
from mlrun_pipelines.mounts import mount_v3io, mount_v3iod
|
|
24
24
|
|
|
25
25
|
from ...execution import MLClientCtx
|
|
26
26
|
from ...model import RunObject
|
|
@@ -405,8 +405,8 @@ class Spark3JobSpec(KubeResourceSpec):
|
|
|
405
405
|
def _verify_and_set_requests(
|
|
406
406
|
self,
|
|
407
407
|
resources_field_name,
|
|
408
|
-
mem: str = None,
|
|
409
|
-
cpu: str = None,
|
|
408
|
+
mem: typing.Optional[str] = None,
|
|
409
|
+
cpu: typing.Optional[str] = None,
|
|
410
410
|
patch: bool = False,
|
|
411
411
|
):
|
|
412
412
|
# Spark operator uses JVM notation for memory, so we must verify it separately
|
|
@@ -774,7 +774,11 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
774
774
|
exporter_jar="/spark/jars/jmx_prometheus_javaagent-0.16.1.jar",
|
|
775
775
|
)
|
|
776
776
|
|
|
777
|
-
def with_cores(
|
|
777
|
+
def with_cores(
|
|
778
|
+
self,
|
|
779
|
+
executor_cores: typing.Optional[int] = None,
|
|
780
|
+
driver_cores: typing.Optional[int] = None,
|
|
781
|
+
):
|
|
778
782
|
"""
|
|
779
783
|
Allows to configure spark.executor.cores and spark.driver.cores parameters. The values must be integers
|
|
780
784
|
greater than or equal to 1. If a parameter is not specified, it defaults to 1.
|
|
@@ -853,7 +857,7 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
853
857
|
skip_deployed=False,
|
|
854
858
|
is_kfp=False,
|
|
855
859
|
mlrun_version_specifier=None,
|
|
856
|
-
builder_env: dict = None,
|
|
860
|
+
builder_env: typing.Optional[dict] = None,
|
|
857
861
|
show_on_failure: bool = False,
|
|
858
862
|
force_build: bool = False,
|
|
859
863
|
):
|
|
@@ -944,7 +948,10 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
944
948
|
)
|
|
945
949
|
|
|
946
950
|
def with_executor_requests(
|
|
947
|
-
self,
|
|
951
|
+
self,
|
|
952
|
+
mem: typing.Optional[str] = None,
|
|
953
|
+
cpu: typing.Optional[str] = None,
|
|
954
|
+
patch: bool = False,
|
|
948
955
|
):
|
|
949
956
|
"""
|
|
950
957
|
set executor pod required cpu/memory/gpu resources
|
|
@@ -954,8 +961,8 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
954
961
|
|
|
955
962
|
def with_executor_limits(
|
|
956
963
|
self,
|
|
957
|
-
cpu: str = None,
|
|
958
|
-
gpus: int = None,
|
|
964
|
+
cpu: typing.Optional[str] = None,
|
|
965
|
+
gpus: typing.Optional[int] = None,
|
|
959
966
|
gpu_type: str = "nvidia.com/gpu",
|
|
960
967
|
patch: bool = False,
|
|
961
968
|
):
|
|
@@ -970,7 +977,10 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
970
977
|
)
|
|
971
978
|
|
|
972
979
|
def with_driver_requests(
|
|
973
|
-
self,
|
|
980
|
+
self,
|
|
981
|
+
mem: typing.Optional[str] = None,
|
|
982
|
+
cpu: typing.Optional[str] = None,
|
|
983
|
+
patch: bool = False,
|
|
974
984
|
):
|
|
975
985
|
"""
|
|
976
986
|
set driver pod required cpu/memory/gpu resources
|
|
@@ -980,8 +990,8 @@ class Spark3Runtime(KubejobRuntime):
|
|
|
980
990
|
|
|
981
991
|
def with_driver_limits(
|
|
982
992
|
self,
|
|
983
|
-
cpu: str = None,
|
|
984
|
-
gpus: int = None,
|
|
993
|
+
cpu: typing.Optional[str] = None,
|
|
994
|
+
gpus: typing.Optional[int] = None,
|
|
985
995
|
gpu_type: str = "nvidia.com/gpu",
|
|
986
996
|
patch: bool = False,
|
|
987
997
|
):
|
mlrun/runtimes/utils.py
CHANGED
|
@@ -18,6 +18,7 @@ import os
|
|
|
18
18
|
import re
|
|
19
19
|
from io import StringIO
|
|
20
20
|
from sys import stderr
|
|
21
|
+
from typing import Optional
|
|
21
22
|
|
|
22
23
|
import pandas as pd
|
|
23
24
|
|
|
@@ -147,7 +148,7 @@ def add_code_metadata(path=""):
|
|
|
147
148
|
|
|
148
149
|
def results_to_iter(results, runspec, execution):
|
|
149
150
|
if not results:
|
|
150
|
-
logger.error("
|
|
151
|
+
logger.error("Got an empty results list in to_iter")
|
|
151
152
|
return
|
|
152
153
|
|
|
153
154
|
iter = []
|
|
@@ -174,7 +175,7 @@ def results_to_iter(results, runspec, execution):
|
|
|
174
175
|
|
|
175
176
|
if not iter:
|
|
176
177
|
execution.set_state("completed", commit=True)
|
|
177
|
-
logger.warning("
|
|
178
|
+
logger.warning("Warning!, zero iteration results")
|
|
178
179
|
return
|
|
179
180
|
if hasattr(pd, "json_normalize"):
|
|
180
181
|
df = pd.json_normalize(iter).sort_values("iter")
|
|
@@ -189,10 +190,10 @@ def results_to_iter(results, runspec, execution):
|
|
|
189
190
|
item, id = selector(results, criteria)
|
|
190
191
|
if runspec.spec.selector and not id:
|
|
191
192
|
logger.warning(
|
|
192
|
-
f"
|
|
193
|
+
f"No best result selected, check selector ({criteria}) or results"
|
|
193
194
|
)
|
|
194
195
|
if id:
|
|
195
|
-
logger.info(f"
|
|
196
|
+
logger.info(f"Best iteration={id}, used criteria {criteria}")
|
|
196
197
|
task = results[item] if id and results else None
|
|
197
198
|
execution.log_iteration_results(id, summary, task)
|
|
198
199
|
|
|
@@ -432,7 +433,7 @@ def enrich_function_from_dict(function, function_dict):
|
|
|
432
433
|
|
|
433
434
|
def enrich_run_labels(
|
|
434
435
|
labels: dict,
|
|
435
|
-
labels_to_enrich: list[RunLabels] = None,
|
|
436
|
+
labels_to_enrich: Optional[list[RunLabels]] = None,
|
|
436
437
|
):
|
|
437
438
|
labels_enrichment = {
|
|
438
439
|
RunLabels.owner: os.environ.get("V3IO_USERNAME") or getpass.getuser(),
|
mlrun/serving/merger.py
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
16
18
|
import storey
|
|
17
19
|
|
|
18
20
|
|
|
@@ -37,10 +39,10 @@ class CacheEntry:
|
|
|
37
39
|
class Merge(storey.Flow):
|
|
38
40
|
def __init__(
|
|
39
41
|
self,
|
|
40
|
-
full_event: bool = None,
|
|
41
|
-
key_path: str = None,
|
|
42
|
-
max_behind: int = None,
|
|
43
|
-
expected_num_events: int = None,
|
|
42
|
+
full_event: Optional[bool] = None,
|
|
43
|
+
key_path: Optional[str] = None,
|
|
44
|
+
max_behind: Optional[int] = None,
|
|
45
|
+
expected_num_events: Optional[int] = None,
|
|
44
46
|
**kwargs,
|
|
45
47
|
):
|
|
46
48
|
"""Merge multiple events based on event id or provided key path
|
mlrun/serving/remote.py
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#
|
|
15
15
|
import asyncio
|
|
16
16
|
import json
|
|
17
|
+
from typing import Optional
|
|
17
18
|
|
|
18
19
|
import aiohttp
|
|
19
20
|
import requests
|
|
@@ -40,14 +41,14 @@ class RemoteStep(storey.SendToHttp):
|
|
|
40
41
|
def __init__(
|
|
41
42
|
self,
|
|
42
43
|
url: str,
|
|
43
|
-
subpath: str = None,
|
|
44
|
-
method: str = None,
|
|
45
|
-
headers: dict = None,
|
|
46
|
-
url_expression: str = None,
|
|
47
|
-
body_expression: str = None,
|
|
44
|
+
subpath: Optional[str] = None,
|
|
45
|
+
method: Optional[str] = None,
|
|
46
|
+
headers: Optional[dict] = None,
|
|
47
|
+
url_expression: Optional[str] = None,
|
|
48
|
+
body_expression: Optional[str] = None,
|
|
48
49
|
return_json: bool = True,
|
|
49
|
-
input_path: str = None,
|
|
50
|
-
result_path: str = None,
|
|
50
|
+
input_path: Optional[str] = None,
|
|
51
|
+
result_path: Optional[str] = None,
|
|
51
52
|
max_in_flight=None,
|
|
52
53
|
retries=None,
|
|
53
54
|
backoff_factor=None,
|
|
@@ -57,7 +58,7 @@ class RemoteStep(storey.SendToHttp):
|
|
|
57
58
|
"""class for calling remote endpoints
|
|
58
59
|
|
|
59
60
|
sync and async graph step implementation for request/resp to remote service (class shortcut = "$remote")
|
|
60
|
-
url can be an http(s) url (e.g.
|
|
61
|
+
url can be an http(s) url (e.g. `https://myservice/path`) or an mlrun function uri ([project/]name).
|
|
61
62
|
alternatively the url_expression can be specified to build the url from the event (e.g. "event['url']").
|
|
62
63
|
|
|
63
64
|
example pipeline::
|
|
@@ -241,15 +242,15 @@ class RemoteStep(storey.SendToHttp):
|
|
|
241
242
|
class BatchHttpRequests(_ConcurrentJobExecution):
|
|
242
243
|
def __init__(
|
|
243
244
|
self,
|
|
244
|
-
url: str = None,
|
|
245
|
-
subpath: str = None,
|
|
246
|
-
method: str = None,
|
|
247
|
-
headers: dict = None,
|
|
248
|
-
url_expression: str = None,
|
|
249
|
-
body_expression: str = None,
|
|
245
|
+
url: Optional[str] = None,
|
|
246
|
+
subpath: Optional[str] = None,
|
|
247
|
+
method: Optional[str] = None,
|
|
248
|
+
headers: Optional[dict] = None,
|
|
249
|
+
url_expression: Optional[str] = None,
|
|
250
|
+
body_expression: Optional[str] = None,
|
|
250
251
|
return_json: bool = True,
|
|
251
|
-
input_path: str = None,
|
|
252
|
-
result_path: str = None,
|
|
252
|
+
input_path: Optional[str] = None,
|
|
253
|
+
result_path: Optional[str] = None,
|
|
253
254
|
retries=None,
|
|
254
255
|
backoff_factor=None,
|
|
255
256
|
timeout=None,
|
|
@@ -258,7 +259,7 @@ class BatchHttpRequests(_ConcurrentJobExecution):
|
|
|
258
259
|
"""class for calling remote endpoints in parallel
|
|
259
260
|
|
|
260
261
|
sync and async graph step implementation for request/resp to remote service (class shortcut = "$remote")
|
|
261
|
-
url can be an http(s) url (e.g.
|
|
262
|
+
url can be an http(s) url (e.g. `https://myservice/path`) or an mlrun function uri ([project/]name).
|
|
262
263
|
alternatively the url_expression can be specified to build the url from the event (e.g. "event['url']").
|
|
263
264
|
|
|
264
265
|
example pipeline::
|
mlrun/serving/routers.py
CHANGED
|
@@ -46,13 +46,13 @@ class BaseModelRouter(RouterToDict):
|
|
|
46
46
|
def __init__(
|
|
47
47
|
self,
|
|
48
48
|
context=None,
|
|
49
|
-
name: str = None,
|
|
49
|
+
name: typing.Optional[str] = None,
|
|
50
50
|
routes=None,
|
|
51
|
-
protocol: str = None,
|
|
52
|
-
url_prefix: str = None,
|
|
53
|
-
health_prefix: str = None,
|
|
54
|
-
input_path: str = None,
|
|
55
|
-
result_path: str = None,
|
|
51
|
+
protocol: typing.Optional[str] = None,
|
|
52
|
+
url_prefix: typing.Optional[str] = None,
|
|
53
|
+
health_prefix: typing.Optional[str] = None,
|
|
54
|
+
input_path: typing.Optional[str] = None,
|
|
55
|
+
result_path: typing.Optional[str] = None,
|
|
56
56
|
**kwargs,
|
|
57
57
|
):
|
|
58
58
|
"""Model Serving Router, route between child models
|
|
@@ -249,11 +249,11 @@ class ParallelRun(BaseModelRouter):
|
|
|
249
249
|
def __init__(
|
|
250
250
|
self,
|
|
251
251
|
context=None,
|
|
252
|
-
name: str = None,
|
|
252
|
+
name: typing.Optional[str] = None,
|
|
253
253
|
routes=None,
|
|
254
|
-
protocol: str = None,
|
|
255
|
-
url_prefix: str = None,
|
|
256
|
-
health_prefix: str = None,
|
|
254
|
+
protocol: typing.Optional[str] = None,
|
|
255
|
+
url_prefix: typing.Optional[str] = None,
|
|
256
|
+
health_prefix: typing.Optional[str] = None,
|
|
257
257
|
extend_event=None,
|
|
258
258
|
executor_type: Union[ParallelRunnerModes, str] = ParallelRunnerModes.thread,
|
|
259
259
|
**kwargs,
|
|
@@ -481,13 +481,13 @@ class VotingEnsemble(ParallelRun):
|
|
|
481
481
|
def __init__(
|
|
482
482
|
self,
|
|
483
483
|
context=None,
|
|
484
|
-
name: str = None,
|
|
484
|
+
name: typing.Optional[str] = None,
|
|
485
485
|
routes=None,
|
|
486
|
-
protocol: str = None,
|
|
487
|
-
url_prefix: str = None,
|
|
488
|
-
health_prefix: str = None,
|
|
489
|
-
vote_type: str = None,
|
|
490
|
-
weights: dict[str, float] = None,
|
|
486
|
+
protocol: typing.Optional[str] = None,
|
|
487
|
+
url_prefix: typing.Optional[str] = None,
|
|
488
|
+
health_prefix: typing.Optional[str] = None,
|
|
489
|
+
vote_type: typing.Optional[str] = None,
|
|
490
|
+
weights: typing.Optional[dict[str, float]] = None,
|
|
491
491
|
executor_type: Union[ParallelRunnerModes, str] = ParallelRunnerModes.thread,
|
|
492
492
|
format_response_with_col_name_flag: bool = False,
|
|
493
493
|
prediction_col_name: str = "prediction",
|
|
@@ -1130,13 +1130,13 @@ class EnrichmentModelRouter(ModelRouter):
|
|
|
1130
1130
|
def __init__(
|
|
1131
1131
|
self,
|
|
1132
1132
|
context=None,
|
|
1133
|
-
name: str = None,
|
|
1133
|
+
name: typing.Optional[str] = None,
|
|
1134
1134
|
routes=None,
|
|
1135
|
-
protocol: str = None,
|
|
1136
|
-
url_prefix: str = None,
|
|
1137
|
-
health_prefix: str = None,
|
|
1135
|
+
protocol: typing.Optional[str] = None,
|
|
1136
|
+
url_prefix: typing.Optional[str] = None,
|
|
1137
|
+
health_prefix: typing.Optional[str] = None,
|
|
1138
1138
|
feature_vector_uri: str = "",
|
|
1139
|
-
impute_policy: dict = None,
|
|
1139
|
+
impute_policy: typing.Optional[dict] = None,
|
|
1140
1140
|
**kwargs,
|
|
1141
1141
|
):
|
|
1142
1142
|
"""Model router with feature enrichment (from the feature store)
|
|
@@ -1211,16 +1211,16 @@ class EnrichmentVotingEnsemble(VotingEnsemble):
|
|
|
1211
1211
|
def __init__(
|
|
1212
1212
|
self,
|
|
1213
1213
|
context=None,
|
|
1214
|
-
name: str = None,
|
|
1214
|
+
name: typing.Optional[str] = None,
|
|
1215
1215
|
routes=None,
|
|
1216
1216
|
protocol=None,
|
|
1217
|
-
url_prefix: str = None,
|
|
1218
|
-
health_prefix: str = None,
|
|
1219
|
-
vote_type: str = None,
|
|
1217
|
+
url_prefix: typing.Optional[str] = None,
|
|
1218
|
+
health_prefix: typing.Optional[str] = None,
|
|
1219
|
+
vote_type: typing.Optional[str] = None,
|
|
1220
1220
|
executor_type: Union[ParallelRunnerModes, str] = ParallelRunnerModes.thread,
|
|
1221
|
-
prediction_col_name: str = None,
|
|
1221
|
+
prediction_col_name: typing.Optional[str] = None,
|
|
1222
1222
|
feature_vector_uri: str = "",
|
|
1223
|
-
impute_policy: dict = None,
|
|
1223
|
+
impute_policy: typing.Optional[dict] = None,
|
|
1224
1224
|
**kwargs,
|
|
1225
1225
|
):
|
|
1226
1226
|
"""Voting Ensemble with feature enrichment (from the feature store)
|
mlrun/serving/server.py
CHANGED
|
@@ -196,7 +196,7 @@ class GraphServer(ModelObj):
|
|
|
196
196
|
def test(
|
|
197
197
|
self,
|
|
198
198
|
path: str = "/",
|
|
199
|
-
body: Union[str, bytes, dict] = None,
|
|
199
|
+
body: Optional[Union[str, bytes, dict]] = None,
|
|
200
200
|
method: str = "",
|
|
201
201
|
headers: Optional[str] = None,
|
|
202
202
|
content_type: Optional[str] = None,
|