mlrun 1.7.0rc14__py3-none-any.whl → 1.7.0rc22__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 +10 -1
- mlrun/__main__.py +23 -111
- mlrun/alerts/__init__.py +15 -0
- mlrun/alerts/alert.py +169 -0
- mlrun/api/schemas/__init__.py +4 -3
- mlrun/artifacts/__init__.py +8 -3
- mlrun/artifacts/base.py +36 -253
- mlrun/artifacts/dataset.py +9 -190
- mlrun/artifacts/manager.py +46 -42
- mlrun/artifacts/model.py +9 -141
- mlrun/artifacts/plots.py +14 -375
- mlrun/common/constants.py +65 -3
- mlrun/common/formatters/__init__.py +19 -0
- mlrun/{runtimes/mpijob/v1alpha1.py → common/formatters/artifact.py} +6 -14
- mlrun/common/formatters/base.py +113 -0
- mlrun/common/formatters/function.py +46 -0
- mlrun/common/formatters/pipeline.py +53 -0
- mlrun/common/formatters/project.py +51 -0
- mlrun/{runtimes → common/runtimes}/constants.py +32 -4
- mlrun/common/schemas/__init__.py +10 -5
- mlrun/common/schemas/alert.py +92 -11
- mlrun/common/schemas/api_gateway.py +56 -0
- mlrun/common/schemas/artifact.py +15 -5
- mlrun/common/schemas/auth.py +2 -0
- mlrun/common/schemas/client_spec.py +1 -0
- mlrun/common/schemas/frontend_spec.py +1 -0
- mlrun/common/schemas/function.py +4 -0
- mlrun/common/schemas/model_monitoring/__init__.py +15 -3
- mlrun/common/schemas/model_monitoring/constants.py +58 -7
- mlrun/common/schemas/model_monitoring/grafana.py +9 -5
- mlrun/common/schemas/model_monitoring/model_endpoints.py +86 -2
- mlrun/common/schemas/pipeline.py +0 -9
- mlrun/common/schemas/project.py +5 -11
- mlrun/common/types.py +1 -0
- mlrun/config.py +30 -9
- mlrun/data_types/to_pandas.py +9 -9
- mlrun/datastore/base.py +41 -9
- mlrun/datastore/datastore.py +6 -2
- mlrun/datastore/datastore_profile.py +56 -4
- mlrun/datastore/inmem.py +2 -2
- mlrun/datastore/redis.py +2 -2
- mlrun/datastore/s3.py +5 -0
- mlrun/datastore/sources.py +147 -7
- mlrun/datastore/store_resources.py +7 -7
- mlrun/datastore/targets.py +110 -42
- mlrun/datastore/utils.py +42 -0
- mlrun/db/base.py +54 -10
- mlrun/db/httpdb.py +282 -79
- mlrun/db/nopdb.py +52 -10
- mlrun/errors.py +11 -0
- mlrun/execution.py +26 -9
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +12 -47
- mlrun/feature_store/feature_set.py +9 -0
- mlrun/feature_store/feature_vector.py +8 -0
- mlrun/feature_store/ingestion.py +7 -6
- mlrun/feature_store/retrieval/base.py +9 -4
- mlrun/feature_store/retrieval/conversion.py +9 -9
- mlrun/feature_store/retrieval/dask_merger.py +2 -0
- mlrun/feature_store/retrieval/job.py +9 -3
- mlrun/feature_store/retrieval/local_merger.py +2 -0
- mlrun/feature_store/retrieval/spark_merger.py +16 -0
- mlrun/frameworks/__init__.py +6 -0
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +7 -12
- mlrun/frameworks/parallel_coordinates.py +2 -1
- mlrun/frameworks/tf_keras/__init__.py +4 -1
- mlrun/k8s_utils.py +10 -11
- mlrun/launcher/base.py +4 -3
- mlrun/launcher/client.py +5 -3
- mlrun/launcher/local.py +12 -2
- mlrun/launcher/remote.py +9 -2
- mlrun/lists.py +6 -2
- mlrun/model.py +47 -21
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +42 -18
- mlrun/model_monitoring/application.py +5 -305
- mlrun/model_monitoring/applications/__init__.py +11 -0
- mlrun/model_monitoring/applications/_application_steps.py +157 -0
- mlrun/model_monitoring/applications/base.py +280 -0
- mlrun/model_monitoring/applications/context.py +214 -0
- mlrun/model_monitoring/applications/evidently_base.py +211 -0
- mlrun/model_monitoring/applications/histogram_data_drift.py +132 -91
- mlrun/model_monitoring/applications/results.py +99 -0
- mlrun/model_monitoring/controller.py +3 -1
- mlrun/model_monitoring/db/__init__.py +2 -0
- mlrun/model_monitoring/db/stores/__init__.py +0 -2
- mlrun/model_monitoring/db/stores/base/store.py +22 -37
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +43 -21
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +39 -8
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +27 -7
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +5 -0
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +246 -224
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +232 -216
- mlrun/model_monitoring/db/tsdb/__init__.py +100 -0
- mlrun/model_monitoring/db/tsdb/base.py +316 -0
- mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
- mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +240 -0
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +45 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +401 -0
- mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +117 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +658 -0
- mlrun/model_monitoring/evidently_application.py +6 -118
- mlrun/model_monitoring/helpers.py +63 -1
- mlrun/model_monitoring/model_endpoint.py +3 -2
- mlrun/model_monitoring/stream_processing.py +57 -216
- mlrun/model_monitoring/writer.py +134 -124
- mlrun/package/__init__.py +13 -1
- mlrun/package/packagers/__init__.py +6 -1
- mlrun/package/utils/_formatter.py +2 -2
- mlrun/platforms/__init__.py +10 -9
- mlrun/platforms/iguazio.py +21 -202
- mlrun/projects/operations.py +24 -12
- mlrun/projects/pipelines.py +79 -102
- mlrun/projects/project.py +271 -103
- mlrun/render.py +15 -14
- mlrun/run.py +16 -46
- mlrun/runtimes/__init__.py +6 -3
- mlrun/runtimes/base.py +14 -7
- mlrun/runtimes/daskjob.py +1 -0
- mlrun/runtimes/databricks_job/databricks_runtime.py +1 -0
- mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
- mlrun/runtimes/funcdoc.py +0 -28
- mlrun/runtimes/kubejob.py +2 -1
- mlrun/runtimes/local.py +12 -3
- mlrun/runtimes/mpijob/__init__.py +0 -20
- mlrun/runtimes/mpijob/v1.py +1 -1
- mlrun/runtimes/nuclio/api_gateway.py +194 -84
- mlrun/runtimes/nuclio/application/application.py +170 -8
- mlrun/runtimes/nuclio/function.py +39 -49
- mlrun/runtimes/pod.py +16 -36
- mlrun/runtimes/remotesparkjob.py +9 -3
- mlrun/runtimes/sparkjob/spark3job.py +1 -1
- mlrun/runtimes/utils.py +6 -45
- mlrun/serving/__init__.py +8 -1
- mlrun/serving/server.py +2 -1
- mlrun/serving/states.py +51 -8
- mlrun/serving/utils.py +19 -11
- mlrun/serving/v2_serving.py +5 -1
- mlrun/track/tracker.py +2 -1
- mlrun/utils/async_http.py +25 -5
- mlrun/utils/helpers.py +157 -83
- mlrun/utils/logger.py +39 -7
- mlrun/utils/notifications/notification/__init__.py +14 -9
- mlrun/utils/notifications/notification/base.py +1 -1
- mlrun/utils/notifications/notification/slack.py +34 -7
- mlrun/utils/notifications/notification/webhook.py +1 -1
- mlrun/utils/notifications/notification_pusher.py +147 -16
- mlrun/utils/regex.py +9 -0
- mlrun/utils/v3io_clients.py +0 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/METADATA +14 -6
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/RECORD +158 -138
- mlrun/kfpops.py +0 -865
- mlrun/platforms/other.py +0 -305
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc14.dist-info → mlrun-1.7.0rc22.dist-info}/top_level.txt +0 -0
mlrun/render.py
CHANGED
|
@@ -121,20 +121,12 @@ def artifacts_html(
|
|
|
121
121
|
html = ""
|
|
122
122
|
|
|
123
123
|
for artifact in artifacts:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
attribute_value = artifact.get(attribute_name)
|
|
127
|
-
else:
|
|
128
|
-
attribute_value = artifact["spec"].get(attribute_name)
|
|
129
|
-
|
|
130
|
-
if mlrun.utils.is_legacy_artifact(artifact):
|
|
131
|
-
key = artifact["key"]
|
|
132
|
-
else:
|
|
133
|
-
key = artifact["metadata"]["key"]
|
|
124
|
+
attribute_value = artifact["spec"].get(attribute_name)
|
|
125
|
+
key = artifact["metadata"]["key"]
|
|
134
126
|
|
|
135
127
|
if not attribute_value:
|
|
136
128
|
mlrun.utils.logger.warning(
|
|
137
|
-
"Artifact is
|
|
129
|
+
f"Artifact required attribute {attribute_name} is missing, omitting from output",
|
|
138
130
|
artifact_key=key,
|
|
139
131
|
)
|
|
140
132
|
continue
|
|
@@ -404,12 +396,21 @@ def runs_to_html(
|
|
|
404
396
|
df.drop("labels", axis=1, inplace=True)
|
|
405
397
|
df.drop("inputs", axis=1, inplace=True)
|
|
406
398
|
df.drop("artifacts", axis=1, inplace=True)
|
|
399
|
+
df.drop("artifact_uris", axis=1, inplace=True)
|
|
407
400
|
else:
|
|
408
401
|
df["labels"] = df["labels"].apply(dict_html)
|
|
409
402
|
df["inputs"] = df["inputs"].apply(inputs_html)
|
|
410
|
-
df["artifacts"]
|
|
411
|
-
|
|
412
|
-
|
|
403
|
+
if df["artifacts"][0]:
|
|
404
|
+
df["artifacts"] = df["artifacts"].apply(
|
|
405
|
+
lambda artifacts: artifacts_html(artifacts, "target_path"),
|
|
406
|
+
)
|
|
407
|
+
df.drop("artifact_uris", axis=1, inplace=True)
|
|
408
|
+
elif df["artifact_uris"][0]:
|
|
409
|
+
df["artifact_uris"] = df["artifact_uris"].apply(dict_html)
|
|
410
|
+
df.drop("artifacts", axis=1, inplace=True)
|
|
411
|
+
else:
|
|
412
|
+
df.drop("artifacts", axis=1, inplace=True)
|
|
413
|
+
df.drop("artifact_uris", axis=1, inplace=True)
|
|
413
414
|
|
|
414
415
|
def expand_error(x):
|
|
415
416
|
if x["state"] == "error":
|
mlrun/run.py
CHANGED
|
@@ -29,11 +29,14 @@ from typing import Optional, Union
|
|
|
29
29
|
import nuclio
|
|
30
30
|
import yaml
|
|
31
31
|
from kfp import Client
|
|
32
|
+
from mlrun_pipelines.common.models import RunStatuses
|
|
33
|
+
from mlrun_pipelines.common.ops import format_summary_from_kfp_run, show_kfp_run
|
|
32
34
|
|
|
35
|
+
import mlrun.common.constants as mlrun_constants
|
|
36
|
+
import mlrun.common.formatters
|
|
33
37
|
import mlrun.common.schemas
|
|
34
38
|
import mlrun.errors
|
|
35
39
|
import mlrun.utils.helpers
|
|
36
|
-
from mlrun.kfpops import format_summary_from_kfp_run, show_kfp_run
|
|
37
40
|
|
|
38
41
|
from .common.helpers import parse_versioned_object_uri
|
|
39
42
|
from .config import config as mlconf
|
|
@@ -47,7 +50,6 @@ from .runtimes import (
|
|
|
47
50
|
KubejobRuntime,
|
|
48
51
|
LocalRuntime,
|
|
49
52
|
MpiRuntimeV1,
|
|
50
|
-
MpiRuntimeV1Alpha1,
|
|
51
53
|
RemoteRuntime,
|
|
52
54
|
RemoteSparkRuntime,
|
|
53
55
|
RuntimeKinds,
|
|
@@ -69,41 +71,6 @@ from .utils import (
|
|
|
69
71
|
)
|
|
70
72
|
|
|
71
73
|
|
|
72
|
-
class RunStatuses:
|
|
73
|
-
succeeded = "Succeeded"
|
|
74
|
-
failed = "Failed"
|
|
75
|
-
skipped = "Skipped"
|
|
76
|
-
error = "Error"
|
|
77
|
-
running = "Running"
|
|
78
|
-
|
|
79
|
-
@staticmethod
|
|
80
|
-
def all():
|
|
81
|
-
return [
|
|
82
|
-
RunStatuses.succeeded,
|
|
83
|
-
RunStatuses.failed,
|
|
84
|
-
RunStatuses.skipped,
|
|
85
|
-
RunStatuses.error,
|
|
86
|
-
RunStatuses.running,
|
|
87
|
-
]
|
|
88
|
-
|
|
89
|
-
@staticmethod
|
|
90
|
-
def stable_statuses():
|
|
91
|
-
return [
|
|
92
|
-
RunStatuses.succeeded,
|
|
93
|
-
RunStatuses.failed,
|
|
94
|
-
RunStatuses.skipped,
|
|
95
|
-
RunStatuses.error,
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
@staticmethod
|
|
99
|
-
def transient_statuses():
|
|
100
|
-
return [
|
|
101
|
-
status
|
|
102
|
-
for status in RunStatuses.all()
|
|
103
|
-
if status not in RunStatuses.stable_statuses()
|
|
104
|
-
]
|
|
105
|
-
|
|
106
|
-
|
|
107
74
|
def function_to_module(code="", workdir=None, secrets=None, silent=False):
|
|
108
75
|
"""Load code, notebook or mlrun function as .py module
|
|
109
76
|
this function can import a local/remote py file or notebook
|
|
@@ -326,6 +293,10 @@ def get_or_create_ctx(
|
|
|
326
293
|
newspec["metadata"]["project"] = (
|
|
327
294
|
newspec["metadata"].get("project") or project or mlconf.default_project
|
|
328
295
|
)
|
|
296
|
+
newspec["metadata"].setdefault("labels", {})
|
|
297
|
+
newspec["metadata"]["labels"] = {
|
|
298
|
+
mlrun_constants.MLRunInternalLabels.kind: RuntimeKinds.local
|
|
299
|
+
}
|
|
329
300
|
|
|
330
301
|
ctx = MLClientCtx.from_dict(
|
|
331
302
|
newspec, rundb=out, autocommit=autocommit, tmp=tmp, host=socket.gethostname()
|
|
@@ -606,7 +577,6 @@ def code_to_function(
|
|
|
606
577
|
ignored_tags: Optional[str] = None,
|
|
607
578
|
requirements_file: Optional[str] = "",
|
|
608
579
|
) -> Union[
|
|
609
|
-
MpiRuntimeV1Alpha1,
|
|
610
580
|
MpiRuntimeV1,
|
|
611
581
|
RemoteRuntime,
|
|
612
582
|
ServingRuntime,
|
|
@@ -1008,8 +978,8 @@ def get_pipeline(
|
|
|
1008
978
|
run_id,
|
|
1009
979
|
namespace=None,
|
|
1010
980
|
format_: Union[
|
|
1011
|
-
str, mlrun.common.
|
|
1012
|
-
] = mlrun.common.
|
|
981
|
+
str, mlrun.common.formatters.PipelineFormat
|
|
982
|
+
] = mlrun.common.formatters.PipelineFormat.summary,
|
|
1013
983
|
project: str = None,
|
|
1014
984
|
remote: bool = True,
|
|
1015
985
|
):
|
|
@@ -1023,7 +993,7 @@ def get_pipeline(
|
|
|
1023
993
|
:param project: the project of the pipeline run
|
|
1024
994
|
:param remote: read kfp data from mlrun service (default=True)
|
|
1025
995
|
|
|
1026
|
-
:return: kfp run
|
|
996
|
+
:return: kfp run
|
|
1027
997
|
"""
|
|
1028
998
|
namespace = namespace or mlconf.namespace
|
|
1029
999
|
if remote:
|
|
@@ -1045,9 +1015,9 @@ def get_pipeline(
|
|
|
1045
1015
|
resp = resp.to_dict()
|
|
1046
1016
|
if (
|
|
1047
1017
|
not format_
|
|
1048
|
-
or format_ == mlrun.common.
|
|
1018
|
+
or format_ == mlrun.common.formatters.PipelineFormat.summary.value
|
|
1049
1019
|
):
|
|
1050
|
-
resp =
|
|
1020
|
+
resp = mlrun.common.formatters.PipelineFormat.format_obj(resp, format_)
|
|
1051
1021
|
|
|
1052
1022
|
show_kfp_run(resp)
|
|
1053
1023
|
return resp
|
|
@@ -1061,7 +1031,7 @@ def list_pipelines(
|
|
|
1061
1031
|
filter_="",
|
|
1062
1032
|
namespace=None,
|
|
1063
1033
|
project="*",
|
|
1064
|
-
format_: mlrun.common.
|
|
1034
|
+
format_: mlrun.common.formatters.PipelineFormat = mlrun.common.formatters.PipelineFormat.metadata_only,
|
|
1065
1035
|
) -> tuple[int, Optional[int], list[dict]]:
|
|
1066
1036
|
"""List pipelines
|
|
1067
1037
|
|
|
@@ -1081,7 +1051,7 @@ def list_pipelines(
|
|
|
1081
1051
|
:param format_: Control what will be returned (full/metadata_only/name_only)
|
|
1082
1052
|
"""
|
|
1083
1053
|
if full:
|
|
1084
|
-
format_ = mlrun.common.
|
|
1054
|
+
format_ = mlrun.common.formatters.PipelineFormat.full
|
|
1085
1055
|
run_db = mlrun.db.get_run_db()
|
|
1086
1056
|
pipelines = run_db.list_pipelines(
|
|
1087
1057
|
project, namespace, sort_by, page_token, filter_, format_, page_size
|
|
@@ -1150,7 +1120,7 @@ def wait_for_runs_completion(
|
|
|
1150
1120
|
running = []
|
|
1151
1121
|
for run in runs:
|
|
1152
1122
|
state = run.state()
|
|
1153
|
-
if state in mlrun.runtimes.constants.RunStates.terminal_states():
|
|
1123
|
+
if state in mlrun.common.runtimes.constants.RunStates.terminal_states():
|
|
1154
1124
|
completed.append(run)
|
|
1155
1125
|
else:
|
|
1156
1126
|
running.append(run)
|
mlrun/runtimes/__init__.py
CHANGED
|
@@ -26,23 +26,26 @@ __all__ = [
|
|
|
26
26
|
"Spark3Runtime",
|
|
27
27
|
"DatabricksRuntime",
|
|
28
28
|
"KubeResource",
|
|
29
|
+
"ApplicationRuntime",
|
|
30
|
+
"MpiRuntimeV1",
|
|
29
31
|
]
|
|
30
32
|
|
|
31
33
|
from mlrun.runtimes.utils import resolve_spark_operator_version
|
|
32
34
|
|
|
35
|
+
from ..common.runtimes.constants import MPIJobCRDVersions
|
|
33
36
|
from .base import BaseRuntime, RunError, RuntimeClassMode # noqa
|
|
34
|
-
from .constants import MPIJobCRDVersions
|
|
35
37
|
from .daskjob import DaskCluster # noqa
|
|
36
38
|
from .databricks_job.databricks_runtime import DatabricksRuntime
|
|
37
39
|
from .kubejob import KubejobRuntime, KubeResource # noqa
|
|
38
40
|
from .local import HandlerRuntime, LocalRuntime # noqa
|
|
39
|
-
from .mpijob import
|
|
41
|
+
from .mpijob import MpiRuntimeV1 # noqa
|
|
40
42
|
from .nuclio import (
|
|
41
43
|
RemoteRuntime,
|
|
42
44
|
ServingRuntime,
|
|
43
45
|
new_v2_model_server,
|
|
44
46
|
nuclio_init_hook,
|
|
45
47
|
)
|
|
48
|
+
from .nuclio.api_gateway import APIGateway
|
|
46
49
|
from .nuclio.application import ApplicationRuntime
|
|
47
50
|
from .nuclio.serving import serving_subkind
|
|
48
51
|
from .remotesparkjob import RemoteSparkRuntime
|
|
@@ -264,7 +267,7 @@ class RuntimeKinds:
|
|
|
264
267
|
|
|
265
268
|
def get_runtime_class(kind: str):
|
|
266
269
|
if kind == RuntimeKinds.mpijob:
|
|
267
|
-
return
|
|
270
|
+
return MpiRuntimeV1
|
|
268
271
|
|
|
269
272
|
if kind == RuntimeKinds.spark:
|
|
270
273
|
return Spark3Runtime
|
mlrun/runtimes/base.py
CHANGED
|
@@ -21,9 +21,11 @@ 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
|
|
24
25
|
from nuclio.build import mlrun_footer
|
|
25
26
|
|
|
26
27
|
import mlrun.common.constants
|
|
28
|
+
import mlrun.common.constants as mlrun_constants
|
|
27
29
|
import mlrun.common.schemas
|
|
28
30
|
import mlrun.common.schemas.model_monitoring.constants as mm_constants
|
|
29
31
|
import mlrun.db
|
|
@@ -37,7 +39,6 @@ from mlrun.utils.helpers import generate_object_uri, verify_field_regex
|
|
|
37
39
|
from ..config import config
|
|
38
40
|
from ..datastore import store_manager
|
|
39
41
|
from ..errors import err_to_str
|
|
40
|
-
from ..kfpops import mlrun_op
|
|
41
42
|
from ..lists import RunList
|
|
42
43
|
from ..model import BaseMetadata, HyperParamOptions, ImageBuilder, ModelObj, RunObject
|
|
43
44
|
from ..utils import (
|
|
@@ -67,6 +68,7 @@ spec_fields = [
|
|
|
67
68
|
"disable_auto_mount",
|
|
68
69
|
"allow_empty_resources",
|
|
69
70
|
"clone_target_dir",
|
|
71
|
+
"reset_on_run",
|
|
70
72
|
]
|
|
71
73
|
|
|
72
74
|
|
|
@@ -335,6 +337,7 @@ class BaseRuntime(ModelObj):
|
|
|
335
337
|
notifications: Optional[list[mlrun.model.Notification]] = None,
|
|
336
338
|
returns: Optional[list[Union[str, dict[str, str]]]] = None,
|
|
337
339
|
state_thresholds: Optional[dict[str, int]] = None,
|
|
340
|
+
reset_on_run: Optional[bool] = None,
|
|
338
341
|
**launcher_kwargs,
|
|
339
342
|
) -> RunObject:
|
|
340
343
|
"""
|
|
@@ -389,6 +392,9 @@ class BaseRuntime(ModelObj):
|
|
|
389
392
|
standards and is at least 1 minute (-1 for infinite).
|
|
390
393
|
If the phase is active for longer than the threshold, the run will be aborted.
|
|
391
394
|
See mlconf.function.spec.state_thresholds for the state options and default values.
|
|
395
|
+
:param reset_on_run: When True, function python modules would reload prior to code execution.
|
|
396
|
+
This ensures latest code changes are executed. This argument must be used in
|
|
397
|
+
conjunction with the local=True argument.
|
|
392
398
|
:return: Run context object (RunObject) with run metadata, results and status
|
|
393
399
|
"""
|
|
394
400
|
launcher = mlrun.launcher.factory.LauncherFactory().create_launcher(
|
|
@@ -417,6 +423,7 @@ class BaseRuntime(ModelObj):
|
|
|
417
423
|
notifications=notifications,
|
|
418
424
|
returns=returns,
|
|
419
425
|
state_thresholds=state_thresholds,
|
|
426
|
+
reset_on_run=reset_on_run,
|
|
420
427
|
)
|
|
421
428
|
|
|
422
429
|
def _get_db_run(self, task: RunObject = None):
|
|
@@ -469,11 +476,11 @@ class BaseRuntime(ModelObj):
|
|
|
469
476
|
def _store_function(self, runspec, meta, db):
|
|
470
477
|
meta.labels["kind"] = self.kind
|
|
471
478
|
mlrun.runtimes.utils.enrich_run_labels(
|
|
472
|
-
meta.labels, [mlrun.runtimes.constants.RunLabels.owner]
|
|
479
|
+
meta.labels, [mlrun.common.runtimes.constants.RunLabels.owner]
|
|
473
480
|
)
|
|
474
481
|
if runspec.spec.output_path:
|
|
475
482
|
runspec.spec.output_path = runspec.spec.output_path.replace(
|
|
476
|
-
"{{run.user}}", meta.labels[
|
|
483
|
+
"{{run.user}}", meta.labels[mlrun_constants.MLRunInternalLabels.owner]
|
|
477
484
|
)
|
|
478
485
|
|
|
479
486
|
if db and self.kind != "handler":
|
|
@@ -580,9 +587,9 @@ class BaseRuntime(ModelObj):
|
|
|
580
587
|
|
|
581
588
|
elif (
|
|
582
589
|
not was_none
|
|
583
|
-
and last_state != mlrun.runtimes.constants.RunStates.completed
|
|
590
|
+
and last_state != mlrun.common.runtimes.constants.RunStates.completed
|
|
584
591
|
and last_state
|
|
585
|
-
not in mlrun.runtimes.constants.RunStates.error_and_abortion_states()
|
|
592
|
+
not in mlrun.common.runtimes.constants.RunStates.error_and_abortion_states()
|
|
586
593
|
):
|
|
587
594
|
try:
|
|
588
595
|
runtime_cls = mlrun.runtimes.get_runtime_class(kind)
|
|
@@ -707,11 +714,11 @@ class BaseRuntime(ModelObj):
|
|
|
707
714
|
"key": "the_key".
|
|
708
715
|
:param auto_build: when set to True and the function require build it will be built on the first
|
|
709
716
|
function run, use only if you dont plan on changing the build config between runs
|
|
710
|
-
:return:
|
|
717
|
+
:return: mlrun_pipelines.models.PipelineNodeWrapper
|
|
711
718
|
"""
|
|
712
719
|
|
|
713
720
|
# if the function contain KFP PipelineParams (futures) pass the full spec to the
|
|
714
|
-
#
|
|
721
|
+
# PipelineNodeWrapper this way KFP will substitute the params with previous step outputs
|
|
715
722
|
if use_db and not self._has_pipeline_param():
|
|
716
723
|
# if the same function is built as part of the pipeline we do not use the versioned function
|
|
717
724
|
# rather the latest function w the same tag so we can pick up the updated image/status
|
mlrun/runtimes/daskjob.py
CHANGED
|
@@ -494,6 +494,7 @@ class DaskCluster(KubejobRuntime):
|
|
|
494
494
|
notifications: Optional[list[mlrun.model.Notification]] = None,
|
|
495
495
|
returns: Optional[list[Union[str, dict[str, str]]]] = None,
|
|
496
496
|
state_thresholds: Optional[dict[str, int]] = None,
|
|
497
|
+
reset_on_run: Optional[bool] = None,
|
|
497
498
|
**launcher_kwargs,
|
|
498
499
|
) -> RunObject:
|
|
499
500
|
if state_thresholds:
|
|
@@ -232,6 +232,7 @@ def run_mlrun_databricks_job(context,task_parameters: dict, **kwargs):
|
|
|
232
232
|
notifications: Optional[list[mlrun.model.Notification]] = None,
|
|
233
233
|
returns: Optional[list[Union[str, dict[str, str]]]] = None,
|
|
234
234
|
state_thresholds: Optional[dict[str, int]] = None,
|
|
235
|
+
reset_on_run: Optional[bool] = None,
|
|
235
236
|
**launcher_kwargs,
|
|
236
237
|
) -> RunObject:
|
|
237
238
|
if local:
|
|
@@ -99,7 +99,7 @@ def save_credentials(
|
|
|
99
99
|
credentials["DATABRICKS_CLUSTER_ID"] = cluster_id
|
|
100
100
|
|
|
101
101
|
with open(credentials_path, "w") as yaml_file:
|
|
102
|
-
yaml.
|
|
102
|
+
yaml.safe_dump(credentials, yaml_file, default_flow_style=False)
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
def run_mlrun_databricks_job(
|
mlrun/runtimes/funcdoc.py
CHANGED
|
@@ -16,8 +16,6 @@ import ast
|
|
|
16
16
|
import inspect
|
|
17
17
|
import re
|
|
18
18
|
|
|
19
|
-
from deprecated import deprecated
|
|
20
|
-
|
|
21
19
|
from mlrun.model import FunctionEntrypoint
|
|
22
20
|
|
|
23
21
|
|
|
@@ -73,32 +71,6 @@ def func_dict(
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
|
|
76
|
-
# TODO: remove in 1.7.0
|
|
77
|
-
@deprecated(
|
|
78
|
-
version="1.5.0",
|
|
79
|
-
reason="'func_info' is deprecated and will be removed in 1.7.0, use 'ast_func_info' instead",
|
|
80
|
-
category=FutureWarning,
|
|
81
|
-
)
|
|
82
|
-
def func_info(fn) -> dict:
|
|
83
|
-
sig = inspect.signature(fn)
|
|
84
|
-
doc = inspect.getdoc(fn) or ""
|
|
85
|
-
|
|
86
|
-
out = func_dict(
|
|
87
|
-
name=fn.__name__,
|
|
88
|
-
doc=doc,
|
|
89
|
-
params=[inspect_param(p) for p in sig.parameters.values()],
|
|
90
|
-
returns=param_dict(
|
|
91
|
-
type=type_name(sig.return_annotation, empty_is_none=True), default=None
|
|
92
|
-
),
|
|
93
|
-
lineno=func_lineno(fn),
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
if not fn.__doc__ or not fn.__doc__.strip():
|
|
97
|
-
return out
|
|
98
|
-
|
|
99
|
-
return merge_doc(out, doc)
|
|
100
|
-
|
|
101
|
-
|
|
102
74
|
def func_lineno(fn):
|
|
103
75
|
try:
|
|
104
76
|
return inspect.getsourcelines(fn)[1]
|
mlrun/runtimes/kubejob.py
CHANGED
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
import warnings
|
|
16
16
|
|
|
17
|
+
from mlrun_pipelines.common.ops import build_op
|
|
18
|
+
|
|
17
19
|
import mlrun.common.schemas
|
|
18
20
|
import mlrun.db
|
|
19
21
|
import mlrun.errors
|
|
20
22
|
|
|
21
|
-
from ..kfpops import build_op
|
|
22
23
|
from ..model import RunObject
|
|
23
24
|
from .pod import KubeResource
|
|
24
25
|
|
mlrun/runtimes/local.py
CHANGED
|
@@ -33,6 +33,7 @@ from sys import executable
|
|
|
33
33
|
from nuclio import Event
|
|
34
34
|
|
|
35
35
|
import mlrun
|
|
36
|
+
import mlrun.common.constants as mlrun_constants
|
|
36
37
|
from mlrun.lists import RunList
|
|
37
38
|
|
|
38
39
|
from ..errors import err_to_str
|
|
@@ -257,7 +258,8 @@ class LocalRuntime(BaseRuntime, ParallelRunner):
|
|
|
257
258
|
set_paths(os.path.realpath("."))
|
|
258
259
|
|
|
259
260
|
if (
|
|
260
|
-
runobj.metadata.labels.get(
|
|
261
|
+
runobj.metadata.labels.get(mlrun_constants.MLRunInternalLabels.kind)
|
|
262
|
+
== RemoteSparkRuntime.kind
|
|
261
263
|
and environ["MLRUN_SPARK_CLIENT_IGZ_SPARK"] == "true"
|
|
262
264
|
):
|
|
263
265
|
from mlrun.runtimes.remotesparkjob import igz_spark_pre_hook
|
|
@@ -382,13 +384,20 @@ def load_module(file_name, handler, context):
|
|
|
382
384
|
if spec is None:
|
|
383
385
|
raise RunError(f"Cannot import from {file_name!r}")
|
|
384
386
|
module = imputil.module_from_spec(spec)
|
|
387
|
+
sys.modules[mod_name] = module
|
|
385
388
|
spec.loader.exec_module(module)
|
|
386
389
|
|
|
387
390
|
class_args = {}
|
|
388
391
|
if context:
|
|
389
392
|
class_args = copy(context._parameters.get("_init_args", {}))
|
|
390
393
|
|
|
391
|
-
return get_handler_extended(
|
|
394
|
+
return get_handler_extended(
|
|
395
|
+
handler,
|
|
396
|
+
context,
|
|
397
|
+
class_args,
|
|
398
|
+
namespaces=module,
|
|
399
|
+
reload_modules=context._reset_on_run,
|
|
400
|
+
)
|
|
392
401
|
|
|
393
402
|
|
|
394
403
|
def run_exec(cmd, args, env=None, cwd=None):
|
|
@@ -493,7 +502,7 @@ def exec_from_params(handler, runobj: RunObject, context: MLClientCtx, cwd=None)
|
|
|
493
502
|
logger.warning("Run was aborted", err=err_to_str(exc))
|
|
494
503
|
# Run was aborted, the state run state is updated by the abort job, no need to commit again
|
|
495
504
|
context.set_state(
|
|
496
|
-
mlrun.runtimes.constants.RunStates.aborted, commit=False
|
|
505
|
+
mlrun.common.runtimes.constants.RunStates.aborted, commit=False
|
|
497
506
|
)
|
|
498
507
|
commit = False
|
|
499
508
|
except Exception as exc:
|
|
@@ -21,28 +21,8 @@ from mlrun.config import config
|
|
|
21
21
|
from .. import MPIJobCRDVersions
|
|
22
22
|
from .abstract import AbstractMPIJobRuntime
|
|
23
23
|
from .v1 import MpiRuntimeV1
|
|
24
|
-
from .v1alpha1 import MpiRuntimeV1Alpha1
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
def _resolve_mpijob_crd_version():
|
|
28
27
|
# config is expected to get enriched from the API through the client-spec
|
|
29
28
|
return config.mpijob_crd_version or MPIJobCRDVersions.default()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class MpiRuntimeContainer(containers.DeclarativeContainer):
|
|
33
|
-
resolver = providers.Callable(
|
|
34
|
-
_resolve_mpijob_crd_version,
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
selector = providers.Selector(
|
|
38
|
-
resolver,
|
|
39
|
-
v1=providers.Object(MpiRuntimeV1),
|
|
40
|
-
v1alpha1=providers.Object(MpiRuntimeV1Alpha1),
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# An empty selector to be overriden by the API
|
|
44
|
-
handler_selector = providers.Selector(
|
|
45
|
-
resolver,
|
|
46
|
-
v1=providers.Object(None),
|
|
47
|
-
v1alpha1=providers.Object(None),
|
|
48
|
-
)
|
mlrun/runtimes/mpijob/v1.py
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
from mlrun.runtimes.constants import MPIJobCRDVersions, MPIJobV1CleanPodPolicies
|
|
14
|
+
from mlrun.common.runtimes.constants import MPIJobCRDVersions, MPIJobV1CleanPodPolicies
|
|
15
15
|
from mlrun.runtimes.mpijob.abstract import AbstractMPIJobRuntime, MPIResourceSpec
|
|
16
16
|
|
|
17
17
|
|