mlrun 1.7.0rc13__py3-none-any.whl → 1.7.0rc21__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 +144 -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 +6 -11
- mlrun/common/types.py +1 -0
- mlrun/config.py +36 -8
- 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/hdfs.py +5 -0
- 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 +129 -9
- mlrun/datastore/utils.py +42 -0
- mlrun/datastore/v3io.py +1 -1
- mlrun/db/auth_utils.py +152 -0
- mlrun/db/base.py +55 -11
- mlrun/db/httpdb.py +346 -107
- mlrun/db/nopdb.py +52 -10
- mlrun/errors.py +11 -0
- mlrun/execution.py +24 -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/_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 +8 -2
- mlrun/launcher/remote.py +8 -2
- mlrun/lists.py +6 -2
- mlrun/model.py +62 -20
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +41 -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 +329 -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 +397 -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 +636 -0
- mlrun/model_monitoring/evidently_application.py +6 -118
- mlrun/model_monitoring/helpers.py +46 -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/utils/_formatter.py +2 -2
- mlrun/platforms/__init__.py +10 -9
- mlrun/platforms/iguazio.py +21 -202
- mlrun/projects/operations.py +19 -12
- mlrun/projects/pipelines.py +103 -109
- mlrun/projects/project.py +377 -137
- mlrun/render.py +15 -14
- mlrun/run.py +16 -47
- mlrun/runtimes/__init__.py +6 -3
- mlrun/runtimes/base.py +8 -7
- 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 +5 -2
- mlrun/runtimes/mpijob/__init__.py +0 -20
- mlrun/runtimes/mpijob/v1.py +1 -1
- mlrun/runtimes/nuclio/api_gateway.py +440 -208
- mlrun/runtimes/nuclio/application/application.py +170 -8
- mlrun/runtimes/nuclio/function.py +39 -49
- mlrun/runtimes/pod.py +21 -41
- mlrun/runtimes/remotesparkjob.py +9 -3
- mlrun/runtimes/sparkjob/spark3job.py +1 -1
- mlrun/runtimes/utils.py +6 -45
- mlrun/serving/server.py +2 -1
- mlrun/serving/states.py +53 -2
- mlrun/serving/v2_serving.py +5 -1
- mlrun/track/tracker.py +2 -1
- mlrun/utils/async_http.py +25 -5
- mlrun/utils/helpers.py +107 -75
- 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 +61 -13
- 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.0rc13.dist-info → mlrun-1.7.0rc21.dist-info}/METADATA +14 -6
- {mlrun-1.7.0rc13.dist-info → mlrun-1.7.0rc21.dist-info}/RECORD +154 -133
- mlrun/kfpops.py +0 -865
- mlrun/platforms/other.py +0 -305
- {mlrun-1.7.0rc13.dist-info → mlrun-1.7.0rc21.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc13.dist-info → mlrun-1.7.0rc21.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc13.dist-info → mlrun-1.7.0rc21.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc13.dist-info → mlrun-1.7.0rc21.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,
|
|
@@ -661,7 +631,6 @@ def code_to_function(
|
|
|
661
631
|
:param embed_code: indicates whether or not to inject the code directly into the function runtime spec,
|
|
662
632
|
defaults to True
|
|
663
633
|
:param description: short function description, defaults to ''
|
|
664
|
-
:param requirements: list of python packages or pip requirements file path, defaults to None
|
|
665
634
|
:param requirements: a list of python packages
|
|
666
635
|
:param requirements_file: path to a python requirements file
|
|
667
636
|
:param categories: list of categories for mlrun Function Hub, defaults to None
|
|
@@ -1009,8 +978,8 @@ def get_pipeline(
|
|
|
1009
978
|
run_id,
|
|
1010
979
|
namespace=None,
|
|
1011
980
|
format_: Union[
|
|
1012
|
-
str, mlrun.common.
|
|
1013
|
-
] = mlrun.common.
|
|
981
|
+
str, mlrun.common.formatters.PipelineFormat
|
|
982
|
+
] = mlrun.common.formatters.PipelineFormat.summary,
|
|
1014
983
|
project: str = None,
|
|
1015
984
|
remote: bool = True,
|
|
1016
985
|
):
|
|
@@ -1024,7 +993,7 @@ def get_pipeline(
|
|
|
1024
993
|
:param project: the project of the pipeline run
|
|
1025
994
|
:param remote: read kfp data from mlrun service (default=True)
|
|
1026
995
|
|
|
1027
|
-
:return: kfp run
|
|
996
|
+
:return: kfp run
|
|
1028
997
|
"""
|
|
1029
998
|
namespace = namespace or mlconf.namespace
|
|
1030
999
|
if remote:
|
|
@@ -1046,9 +1015,9 @@ def get_pipeline(
|
|
|
1046
1015
|
resp = resp.to_dict()
|
|
1047
1016
|
if (
|
|
1048
1017
|
not format_
|
|
1049
|
-
or format_ == mlrun.common.
|
|
1018
|
+
or format_ == mlrun.common.formatters.PipelineFormat.summary.value
|
|
1050
1019
|
):
|
|
1051
|
-
resp =
|
|
1020
|
+
resp = mlrun.common.formatters.PipelineFormat.format_obj(resp, format_)
|
|
1052
1021
|
|
|
1053
1022
|
show_kfp_run(resp)
|
|
1054
1023
|
return resp
|
|
@@ -1062,7 +1031,7 @@ def list_pipelines(
|
|
|
1062
1031
|
filter_="",
|
|
1063
1032
|
namespace=None,
|
|
1064
1033
|
project="*",
|
|
1065
|
-
format_: mlrun.common.
|
|
1034
|
+
format_: mlrun.common.formatters.PipelineFormat = mlrun.common.formatters.PipelineFormat.metadata_only,
|
|
1066
1035
|
) -> tuple[int, Optional[int], list[dict]]:
|
|
1067
1036
|
"""List pipelines
|
|
1068
1037
|
|
|
@@ -1082,7 +1051,7 @@ def list_pipelines(
|
|
|
1082
1051
|
:param format_: Control what will be returned (full/metadata_only/name_only)
|
|
1083
1052
|
"""
|
|
1084
1053
|
if full:
|
|
1085
|
-
format_ = mlrun.common.
|
|
1054
|
+
format_ = mlrun.common.formatters.PipelineFormat.full
|
|
1086
1055
|
run_db = mlrun.db.get_run_db()
|
|
1087
1056
|
pipelines = run_db.list_pipelines(
|
|
1088
1057
|
project, namespace, sort_by, page_token, filter_, format_, page_size
|
|
@@ -1151,7 +1120,7 @@ def wait_for_runs_completion(
|
|
|
1151
1120
|
running = []
|
|
1152
1121
|
for run in runs:
|
|
1153
1122
|
state = run.state()
|
|
1154
|
-
if state in mlrun.runtimes.constants.RunStates.terminal_states():
|
|
1123
|
+
if state in mlrun.common.runtimes.constants.RunStates.terminal_states():
|
|
1155
1124
|
completed.append(run)
|
|
1156
1125
|
else:
|
|
1157
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 (
|
|
@@ -469,11 +470,11 @@ class BaseRuntime(ModelObj):
|
|
|
469
470
|
def _store_function(self, runspec, meta, db):
|
|
470
471
|
meta.labels["kind"] = self.kind
|
|
471
472
|
mlrun.runtimes.utils.enrich_run_labels(
|
|
472
|
-
meta.labels, [mlrun.runtimes.constants.RunLabels.owner]
|
|
473
|
+
meta.labels, [mlrun.common.runtimes.constants.RunLabels.owner]
|
|
473
474
|
)
|
|
474
475
|
if runspec.spec.output_path:
|
|
475
476
|
runspec.spec.output_path = runspec.spec.output_path.replace(
|
|
476
|
-
"{{run.user}}", meta.labels[
|
|
477
|
+
"{{run.user}}", meta.labels[mlrun_constants.MLRunInternalLabels.owner]
|
|
477
478
|
)
|
|
478
479
|
|
|
479
480
|
if db and self.kind != "handler":
|
|
@@ -580,9 +581,9 @@ class BaseRuntime(ModelObj):
|
|
|
580
581
|
|
|
581
582
|
elif (
|
|
582
583
|
not was_none
|
|
583
|
-
and last_state != mlrun.runtimes.constants.RunStates.completed
|
|
584
|
+
and last_state != mlrun.common.runtimes.constants.RunStates.completed
|
|
584
585
|
and last_state
|
|
585
|
-
not in mlrun.runtimes.constants.RunStates.error_and_abortion_states()
|
|
586
|
+
not in mlrun.common.runtimes.constants.RunStates.error_and_abortion_states()
|
|
586
587
|
):
|
|
587
588
|
try:
|
|
588
589
|
runtime_cls = mlrun.runtimes.get_runtime_class(kind)
|
|
@@ -707,11 +708,11 @@ class BaseRuntime(ModelObj):
|
|
|
707
708
|
"key": "the_key".
|
|
708
709
|
:param auto_build: when set to True and the function require build it will be built on the first
|
|
709
710
|
function run, use only if you dont plan on changing the build config between runs
|
|
710
|
-
:return:
|
|
711
|
+
:return: mlrun_pipelines.models.PipelineNodeWrapper
|
|
711
712
|
"""
|
|
712
713
|
|
|
713
714
|
# if the function contain KFP PipelineParams (futures) pass the full spec to the
|
|
714
|
-
#
|
|
715
|
+
# PipelineNodeWrapper this way KFP will substitute the params with previous step outputs
|
|
715
716
|
if use_db and not self._has_pipeline_param():
|
|
716
717
|
# if the same function is built as part of the pipeline we do not use the versioned function
|
|
717
718
|
# rather the latest function w the same tag so we can pick up the updated image/status
|
|
@@ -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,6 +384,7 @@ 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 = {}
|
|
@@ -493,7 +496,7 @@ def exec_from_params(handler, runobj: RunObject, context: MLClientCtx, cwd=None)
|
|
|
493
496
|
logger.warning("Run was aborted", err=err_to_str(exc))
|
|
494
497
|
# Run was aborted, the state run state is updated by the abort job, no need to commit again
|
|
495
498
|
context.set_state(
|
|
496
|
-
mlrun.runtimes.constants.RunStates.aborted, commit=False
|
|
499
|
+
mlrun.common.runtimes.constants.RunStates.aborted, commit=False
|
|
497
500
|
)
|
|
498
501
|
commit = False
|
|
499
502
|
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
|
|