mlrun 1.7.1rc10__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 +0 -1
- 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 +61 -6
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +255 -29
- 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 +71 -36
- 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 +54 -16
- 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.1rc10.dist-info → mlrun-1.8.0rc8.dist-info}/METADATA +21 -16
- mlrun-1.8.0rc8.dist-info/RECORD +347 -0
- 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.1rc10.dist-info/RECORD +0 -351
- {mlrun-1.7.1rc10.dist-info → mlrun-1.8.0rc8.dist-info}/LICENSE +0 -0
- {mlrun-1.7.1rc10.dist-info → mlrun-1.8.0rc8.dist-info}/WHEEL +0 -0
- {mlrun-1.7.1rc10.dist-info → mlrun-1.8.0rc8.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.1rc10.dist-info → mlrun-1.8.0rc8.dist-info}/top_level.txt +0 -0
mlrun/run.py
CHANGED
|
@@ -30,15 +30,15 @@ from typing import Optional, Union
|
|
|
30
30
|
|
|
31
31
|
import nuclio
|
|
32
32
|
import yaml
|
|
33
|
-
from mlrun_pipelines.common.models import RunStatuses
|
|
34
|
-
from mlrun_pipelines.common.ops import format_summary_from_kfp_run, show_kfp_run
|
|
35
|
-
from mlrun_pipelines.utils import get_client
|
|
36
33
|
|
|
37
34
|
import mlrun.common.constants as mlrun_constants
|
|
38
35
|
import mlrun.common.formatters
|
|
39
36
|
import mlrun.common.schemas
|
|
40
37
|
import mlrun.errors
|
|
41
38
|
import mlrun.utils.helpers
|
|
39
|
+
from mlrun_pipelines.common.models import RunStatuses
|
|
40
|
+
from mlrun_pipelines.common.ops import format_summary_from_kfp_run, show_kfp_run
|
|
41
|
+
from mlrun_pipelines.utils import get_client
|
|
42
42
|
|
|
43
43
|
from .common.helpers import parse_versioned_object_uri
|
|
44
44
|
from .config import config as mlconf
|
|
@@ -73,6 +73,9 @@ from .utils import (
|
|
|
73
73
|
update_in,
|
|
74
74
|
)
|
|
75
75
|
|
|
76
|
+
if typing.TYPE_CHECKING:
|
|
77
|
+
from mlrun.datastore import DataItem
|
|
78
|
+
|
|
76
79
|
|
|
77
80
|
def function_to_module(code="", workdir=None, secrets=None, silent=False):
|
|
78
81
|
"""Load code, notebook or mlrun function as .py module
|
|
@@ -200,7 +203,7 @@ def get_or_create_ctx(
|
|
|
200
203
|
event=None,
|
|
201
204
|
spec: Optional[dict] = None,
|
|
202
205
|
with_env: bool = True,
|
|
203
|
-
rundb: str = "",
|
|
206
|
+
rundb: Union[str, "mlrun.db.RunDBInterface"] = "",
|
|
204
207
|
project: str = "",
|
|
205
208
|
upload_artifacts: bool = False,
|
|
206
209
|
labels: Optional[dict] = None,
|
|
@@ -306,7 +309,7 @@ def get_or_create_ctx(
|
|
|
306
309
|
out = rundb or mlconf.dbpath or environ.get("MLRUN_DBPATH")
|
|
307
310
|
if out:
|
|
308
311
|
autocommit = True
|
|
309
|
-
logger.info(f"
|
|
312
|
+
logger.info(f"Logging run results to: {out}")
|
|
310
313
|
|
|
311
314
|
newspec["metadata"]["project"] = (
|
|
312
315
|
newspec["metadata"].get("project") or project or mlconf.default_project
|
|
@@ -434,7 +437,7 @@ def new_function(
|
|
|
434
437
|
mode: Optional[str] = None,
|
|
435
438
|
handler: Optional[str] = None,
|
|
436
439
|
source: Optional[str] = None,
|
|
437
|
-
requirements: Union[str, list[str]] = None,
|
|
440
|
+
requirements: Optional[Union[str, list[str]]] = None,
|
|
438
441
|
kfp: Optional[bool] = None,
|
|
439
442
|
requirements_file: str = "",
|
|
440
443
|
):
|
|
@@ -906,13 +909,53 @@ def _run_pipeline(
|
|
|
906
909
|
return pipeline_run_id
|
|
907
910
|
|
|
908
911
|
|
|
912
|
+
def retry_pipeline(
|
|
913
|
+
run_id: str,
|
|
914
|
+
project: Optional[str] = None,
|
|
915
|
+
namespace: Optional[str] = None,
|
|
916
|
+
) -> str:
|
|
917
|
+
"""Retry a pipeline run.
|
|
918
|
+
|
|
919
|
+
This function retries a previously executed pipeline run using the specified run ID. If the run is not in a
|
|
920
|
+
retryable state, a new run is created as a clone of the original run.
|
|
921
|
+
|
|
922
|
+
:param run_id: ID of the pipeline run to retry.
|
|
923
|
+
:param project: Optional; name of the project associated with the pipeline run.
|
|
924
|
+
:param namespace: Optional; Kubernetes namespace to use if not the default.
|
|
925
|
+
|
|
926
|
+
:returns: ID of the retried pipeline run or the ID of a cloned run if the original run is not retryable.
|
|
927
|
+
:raises ValueError: If access to the remote API service is not available.
|
|
928
|
+
"""
|
|
929
|
+
mldb = mlrun.db.get_run_db()
|
|
930
|
+
if mldb.kind != "http":
|
|
931
|
+
raise ValueError(
|
|
932
|
+
"Retrying a pipeline requires access to remote API service. "
|
|
933
|
+
"Please set the dbpath URL."
|
|
934
|
+
)
|
|
935
|
+
|
|
936
|
+
pipeline_run_id = mldb.retry_pipeline(
|
|
937
|
+
run_id=run_id,
|
|
938
|
+
project=project,
|
|
939
|
+
namespace=namespace,
|
|
940
|
+
)
|
|
941
|
+
if pipeline_run_id == run_id:
|
|
942
|
+
logger.info(
|
|
943
|
+
f"Retried pipeline run ID={pipeline_run_id}, check UI for progress."
|
|
944
|
+
)
|
|
945
|
+
else:
|
|
946
|
+
logger.info(
|
|
947
|
+
f"Copy of pipeline {run_id} was retried as run ID={pipeline_run_id}, check UI for progress."
|
|
948
|
+
)
|
|
949
|
+
return pipeline_run_id
|
|
950
|
+
|
|
951
|
+
|
|
909
952
|
def wait_for_pipeline_completion(
|
|
910
953
|
run_id,
|
|
911
954
|
timeout=60 * 60,
|
|
912
|
-
expected_statuses: list[str] = None,
|
|
955
|
+
expected_statuses: Optional[list[str]] = None,
|
|
913
956
|
namespace=None,
|
|
914
957
|
remote=True,
|
|
915
|
-
project: str = None,
|
|
958
|
+
project: Optional[str] = None,
|
|
916
959
|
):
|
|
917
960
|
"""Wait for Pipeline status, timeout in sec
|
|
918
961
|
|
|
@@ -1004,7 +1047,7 @@ def get_pipeline(
|
|
|
1004
1047
|
format_: Union[
|
|
1005
1048
|
str, mlrun.common.formatters.PipelineFormat
|
|
1006
1049
|
] = mlrun.common.formatters.PipelineFormat.summary,
|
|
1007
|
-
project: str = None,
|
|
1050
|
+
project: Optional[str] = None,
|
|
1008
1051
|
remote: bool = True,
|
|
1009
1052
|
):
|
|
1010
1053
|
"""Get Pipeline status
|
|
@@ -1089,7 +1132,7 @@ def get_object(url, secrets=None, size=None, offset=0, db=None):
|
|
|
1089
1132
|
return stores.object(url=url).get(size, offset)
|
|
1090
1133
|
|
|
1091
1134
|
|
|
1092
|
-
def get_dataitem(url, secrets=None, db=None) ->
|
|
1135
|
+
def get_dataitem(url, secrets=None, db=None) -> "DataItem":
|
|
1093
1136
|
"""get mlrun dataitem object (from path/url)"""
|
|
1094
1137
|
stores = store_manager.set(secrets, db=db)
|
|
1095
1138
|
return stores.object(url=url)
|
mlrun/runtimes/__init__.py
CHANGED
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
# flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
|
|
16
|
-
|
|
17
15
|
__all__ = [
|
|
18
16
|
"BaseRuntime",
|
|
19
17
|
"KubejobRuntime",
|
|
@@ -60,7 +58,7 @@ from ..serving import MLModelServer, new_v1_model_server # noqa isort: skip
|
|
|
60
58
|
def new_model_server(
|
|
61
59
|
name,
|
|
62
60
|
model_class: str,
|
|
63
|
-
models: dict = None,
|
|
61
|
+
models: typing.Optional[dict] = None,
|
|
64
62
|
filename="",
|
|
65
63
|
protocol="",
|
|
66
64
|
image="",
|
mlrun/runtimes/base.py
CHANGED
|
@@ -21,20 +21,21 @@ from os import environ
|
|
|
21
21
|
from typing import Callable, Optional, Union
|
|
22
22
|
|
|
23
23
|
import requests.exceptions
|
|
24
|
-
from mlrun_pipelines.common.ops import mlrun_op
|
|
25
24
|
from nuclio.build import mlrun_footer
|
|
26
25
|
|
|
27
26
|
import mlrun.common.constants
|
|
28
27
|
import mlrun.common.constants as mlrun_constants
|
|
28
|
+
import mlrun.common.formatters
|
|
29
|
+
import mlrun.common.runtimes
|
|
29
30
|
import mlrun.common.schemas
|
|
30
31
|
import mlrun.common.schemas.model_monitoring.constants as mm_constants
|
|
31
|
-
import mlrun.db
|
|
32
32
|
import mlrun.errors
|
|
33
33
|
import mlrun.launcher.factory
|
|
34
34
|
import mlrun.utils.helpers
|
|
35
35
|
import mlrun.utils.notifications
|
|
36
36
|
import mlrun.utils.regex
|
|
37
37
|
from mlrun.utils.helpers import generate_object_uri, verify_field_regex
|
|
38
|
+
from mlrun_pipelines.common.ops import mlrun_op
|
|
38
39
|
|
|
39
40
|
from ..config import config
|
|
40
41
|
from ..datastore import store_manager
|
|
@@ -517,7 +518,7 @@ class BaseRuntime(ModelObj):
|
|
|
517
518
|
run_results = resp["status"].get("results", {})
|
|
518
519
|
if generator.eval_stop_condition(run_results):
|
|
519
520
|
logger.info(
|
|
520
|
-
f"
|
|
521
|
+
f"Reached early stop condition ({generator.options.stop_condition}), stopping iterations!"
|
|
521
522
|
)
|
|
522
523
|
results.append(resp)
|
|
523
524
|
break
|
|
@@ -529,7 +530,7 @@ class BaseRuntime(ModelObj):
|
|
|
529
530
|
resp = self._update_run_state(task=task, err=error_string)
|
|
530
531
|
num_errors += 1
|
|
531
532
|
if num_errors > generator.max_errors:
|
|
532
|
-
logger.error("
|
|
533
|
+
logger.error("Too many errors, stopping iterations!")
|
|
533
534
|
results.append(resp)
|
|
534
535
|
break
|
|
535
536
|
|
|
@@ -553,9 +554,9 @@ class BaseRuntime(ModelObj):
|
|
|
553
554
|
|
|
554
555
|
def _update_run_state(
|
|
555
556
|
self,
|
|
556
|
-
resp: dict = None,
|
|
557
|
+
resp: Optional[dict] = None,
|
|
557
558
|
task: RunObject = None,
|
|
558
|
-
err: Union[Exception, str] = None,
|
|
559
|
+
err: Optional[Union[Exception, str]] = None,
|
|
559
560
|
run_format: mlrun.common.formatters.RunFormat = mlrun.common.formatters.RunFormat.full,
|
|
560
561
|
) -> typing.Optional[dict]:
|
|
561
562
|
"""update the task state in the DB"""
|
|
@@ -644,7 +645,10 @@ class BaseRuntime(ModelObj):
|
|
|
644
645
|
return updates
|
|
645
646
|
|
|
646
647
|
def full_image_path(
|
|
647
|
-
self,
|
|
648
|
+
self,
|
|
649
|
+
image=None,
|
|
650
|
+
client_version: Optional[str] = None,
|
|
651
|
+
client_python_version: Optional[str] = None,
|
|
648
652
|
):
|
|
649
653
|
image = image or self.spec.image or ""
|
|
650
654
|
|
|
@@ -669,16 +673,16 @@ class BaseRuntime(ModelObj):
|
|
|
669
673
|
handler=None,
|
|
670
674
|
name: str = "",
|
|
671
675
|
project: str = "",
|
|
672
|
-
params: dict = None,
|
|
676
|
+
params: Optional[dict] = None,
|
|
673
677
|
hyperparams=None,
|
|
674
678
|
selector="",
|
|
675
679
|
hyper_param_options: HyperParamOptions = None,
|
|
676
|
-
inputs: dict = None,
|
|
677
|
-
outputs: list = None,
|
|
680
|
+
inputs: Optional[dict] = None,
|
|
681
|
+
outputs: Optional[list] = None,
|
|
678
682
|
workdir: str = "",
|
|
679
683
|
artifact_path: str = "",
|
|
680
684
|
image: str = "",
|
|
681
|
-
labels: dict = None,
|
|
685
|
+
labels: Optional[dict] = None,
|
|
682
686
|
use_db=True,
|
|
683
687
|
verbose=None,
|
|
684
688
|
scrape_metrics=False,
|
mlrun/runtimes/daskjob.py
CHANGED
|
@@ -363,7 +363,7 @@ class DaskCluster(KubejobRuntime):
|
|
|
363
363
|
skip_deployed=False,
|
|
364
364
|
is_kfp=False,
|
|
365
365
|
mlrun_version_specifier=None,
|
|
366
|
-
builder_env: dict = None,
|
|
366
|
+
builder_env: Optional[dict] = None,
|
|
367
367
|
show_on_failure: bool = False,
|
|
368
368
|
force_build: bool = False,
|
|
369
369
|
):
|
|
@@ -406,9 +406,9 @@ class DaskCluster(KubejobRuntime):
|
|
|
406
406
|
|
|
407
407
|
def with_scheduler_limits(
|
|
408
408
|
self,
|
|
409
|
-
mem: str = None,
|
|
410
|
-
cpu: str = None,
|
|
411
|
-
gpus: int = None,
|
|
409
|
+
mem: Optional[str] = None,
|
|
410
|
+
cpu: Optional[str] = None,
|
|
411
|
+
gpus: Optional[int] = None,
|
|
412
412
|
gpu_type: str = "nvidia.com/gpu",
|
|
413
413
|
patch: bool = False,
|
|
414
414
|
):
|
|
@@ -422,9 +422,9 @@ class DaskCluster(KubejobRuntime):
|
|
|
422
422
|
|
|
423
423
|
def with_worker_limits(
|
|
424
424
|
self,
|
|
425
|
-
mem: str = None,
|
|
426
|
-
cpu: str = None,
|
|
427
|
-
gpus: int = None,
|
|
425
|
+
mem: Optional[str] = None,
|
|
426
|
+
cpu: Optional[str] = None,
|
|
427
|
+
gpus: Optional[int] = None,
|
|
428
428
|
gpu_type: str = "nvidia.com/gpu",
|
|
429
429
|
patch: bool = False,
|
|
430
430
|
):
|
|
@@ -442,7 +442,7 @@ class DaskCluster(KubejobRuntime):
|
|
|
442
442
|
)
|
|
443
443
|
|
|
444
444
|
def with_scheduler_requests(
|
|
445
|
-
self, mem: str = None, cpu: str = None, patch: bool = False
|
|
445
|
+
self, mem: Optional[str] = None, cpu: Optional[str] = None, patch: bool = False
|
|
446
446
|
):
|
|
447
447
|
"""
|
|
448
448
|
set scheduler pod resources requests
|
|
@@ -451,7 +451,7 @@ class DaskCluster(KubejobRuntime):
|
|
|
451
451
|
self.spec._verify_and_set_requests("scheduler_resources", mem, cpu, patch=patch)
|
|
452
452
|
|
|
453
453
|
def with_worker_requests(
|
|
454
|
-
self, mem: str = None, cpu: str = None, patch: bool = False
|
|
454
|
+
self, mem: Optional[str] = None, cpu: Optional[str] = None, patch: bool = False
|
|
455
455
|
):
|
|
456
456
|
"""
|
|
457
457
|
set worker pod resources requests
|
mlrun/runtimes/generators.py
CHANGED
|
@@ -15,6 +15,7 @@ import json
|
|
|
15
15
|
import random
|
|
16
16
|
import sys
|
|
17
17
|
from copy import deepcopy
|
|
18
|
+
from typing import Optional
|
|
18
19
|
|
|
19
20
|
import pandas as pd
|
|
20
21
|
|
|
@@ -26,7 +27,7 @@ default_max_iterations = 10
|
|
|
26
27
|
default_max_errors = 3
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
def get_generator(spec: RunSpec, execution, param_file_secrets: dict = None):
|
|
30
|
+
def get_generator(spec: RunSpec, execution, param_file_secrets: Optional[dict] = None):
|
|
30
31
|
options = spec.hyper_param_options
|
|
31
32
|
strategy = spec.strategy or options.strategy
|
|
32
33
|
if not spec.is_hyper_job() or strategy == "custom":
|
mlrun/runtimes/kubejob.py
CHANGED
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
import typing
|
|
15
15
|
import warnings
|
|
16
16
|
|
|
17
|
-
from mlrun_pipelines.common.ops import build_op
|
|
18
|
-
|
|
19
17
|
import mlrun.common.schemas
|
|
20
18
|
import mlrun.db
|
|
21
19
|
import mlrun.errors
|
|
20
|
+
from mlrun_pipelines.common.ops import build_op
|
|
22
21
|
|
|
23
22
|
from ..model import RunObject
|
|
24
23
|
from .pod import KubeResource
|
|
@@ -76,7 +75,7 @@ class KubejobRuntime(KubeResource):
|
|
|
76
75
|
self,
|
|
77
76
|
image="",
|
|
78
77
|
base_image=None,
|
|
79
|
-
commands: list = None,
|
|
78
|
+
commands: typing.Optional[list] = None,
|
|
80
79
|
secret=None,
|
|
81
80
|
source=None,
|
|
82
81
|
extra=None,
|
|
@@ -148,7 +147,7 @@ class KubejobRuntime(KubeResource):
|
|
|
148
147
|
skip_deployed: bool = False,
|
|
149
148
|
is_kfp: bool = False,
|
|
150
149
|
mlrun_version_specifier: typing.Optional[bool] = None,
|
|
151
|
-
builder_env: dict = None,
|
|
150
|
+
builder_env: typing.Optional[dict] = None,
|
|
152
151
|
show_on_failure: bool = False,
|
|
153
152
|
force_build: bool = False,
|
|
154
153
|
) -> bool:
|
|
@@ -190,7 +189,7 @@ class KubejobRuntime(KubeResource):
|
|
|
190
189
|
self,
|
|
191
190
|
image=None,
|
|
192
191
|
base_image=None,
|
|
193
|
-
commands: list = None,
|
|
192
|
+
commands: typing.Optional[list] = None,
|
|
194
193
|
secret_name="",
|
|
195
194
|
with_mlrun=True,
|
|
196
195
|
skip_deployed=False,
|