mlrun 1.6.4rc7__py3-none-any.whl → 1.7.0__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 +11 -1
- mlrun/__main__.py +40 -122
- mlrun/alerts/__init__.py +15 -0
- mlrun/alerts/alert.py +248 -0
- mlrun/api/schemas/__init__.py +5 -4
- mlrun/artifacts/__init__.py +8 -3
- mlrun/artifacts/base.py +47 -257
- mlrun/artifacts/dataset.py +11 -192
- mlrun/artifacts/manager.py +79 -47
- mlrun/artifacts/model.py +31 -159
- mlrun/artifacts/plots.py +23 -380
- mlrun/common/constants.py +74 -1
- mlrun/common/db/sql_session.py +5 -5
- mlrun/common/formatters/__init__.py +21 -0
- mlrun/common/formatters/artifact.py +45 -0
- mlrun/common/formatters/base.py +113 -0
- mlrun/common/formatters/feature_set.py +33 -0
- mlrun/common/formatters/function.py +46 -0
- mlrun/common/formatters/pipeline.py +53 -0
- mlrun/common/formatters/project.py +51 -0
- mlrun/common/formatters/run.py +29 -0
- mlrun/common/helpers.py +12 -3
- mlrun/common/model_monitoring/helpers.py +9 -5
- mlrun/{runtimes → common/runtimes}/constants.py +37 -9
- mlrun/common/schemas/__init__.py +31 -5
- mlrun/common/schemas/alert.py +202 -0
- mlrun/common/schemas/api_gateway.py +196 -0
- mlrun/common/schemas/artifact.py +25 -4
- mlrun/common/schemas/auth.py +16 -5
- mlrun/common/schemas/background_task.py +1 -1
- mlrun/common/schemas/client_spec.py +4 -2
- mlrun/common/schemas/common.py +7 -4
- mlrun/common/schemas/constants.py +3 -0
- mlrun/common/schemas/feature_store.py +74 -44
- mlrun/common/schemas/frontend_spec.py +15 -7
- mlrun/common/schemas/function.py +12 -1
- mlrun/common/schemas/hub.py +11 -18
- mlrun/common/schemas/memory_reports.py +2 -2
- mlrun/common/schemas/model_monitoring/__init__.py +20 -4
- mlrun/common/schemas/model_monitoring/constants.py +123 -42
- mlrun/common/schemas/model_monitoring/grafana.py +13 -9
- mlrun/common/schemas/model_monitoring/model_endpoints.py +101 -54
- mlrun/common/schemas/notification.py +71 -14
- mlrun/common/schemas/object.py +2 -2
- mlrun/{model_monitoring/controller_handler.py → common/schemas/pagination.py} +9 -12
- mlrun/common/schemas/pipeline.py +8 -1
- mlrun/common/schemas/project.py +69 -18
- mlrun/common/schemas/runs.py +7 -1
- mlrun/common/schemas/runtime_resource.py +8 -12
- mlrun/common/schemas/schedule.py +4 -4
- mlrun/common/schemas/tag.py +1 -2
- mlrun/common/schemas/workflow.py +12 -4
- mlrun/common/types.py +14 -1
- mlrun/config.py +154 -69
- mlrun/data_types/data_types.py +6 -1
- mlrun/data_types/spark.py +2 -2
- mlrun/data_types/to_pandas.py +67 -37
- mlrun/datastore/__init__.py +6 -8
- mlrun/datastore/alibaba_oss.py +131 -0
- mlrun/datastore/azure_blob.py +143 -42
- mlrun/datastore/base.py +102 -58
- mlrun/datastore/datastore.py +34 -13
- mlrun/datastore/datastore_profile.py +146 -20
- mlrun/datastore/dbfs_store.py +3 -7
- mlrun/datastore/filestore.py +1 -4
- mlrun/datastore/google_cloud_storage.py +97 -33
- mlrun/datastore/hdfs.py +56 -0
- mlrun/datastore/inmem.py +6 -3
- mlrun/datastore/redis.py +7 -2
- mlrun/datastore/s3.py +34 -12
- mlrun/datastore/snowflake_utils.py +45 -0
- mlrun/datastore/sources.py +303 -111
- mlrun/datastore/spark_utils.py +31 -2
- mlrun/datastore/store_resources.py +9 -7
- mlrun/datastore/storeytargets.py +151 -0
- mlrun/datastore/targets.py +453 -176
- mlrun/datastore/utils.py +72 -58
- mlrun/datastore/v3io.py +6 -1
- mlrun/db/base.py +274 -41
- mlrun/db/factory.py +1 -1
- mlrun/db/httpdb.py +893 -225
- mlrun/db/nopdb.py +291 -33
- mlrun/errors.py +36 -6
- mlrun/execution.py +115 -42
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +65 -73
- mlrun/feature_store/common.py +7 -12
- mlrun/feature_store/feature_set.py +76 -55
- mlrun/feature_store/feature_vector.py +39 -31
- mlrun/feature_store/ingestion.py +7 -6
- mlrun/feature_store/retrieval/base.py +16 -11
- mlrun/feature_store/retrieval/dask_merger.py +2 -0
- mlrun/feature_store/retrieval/job.py +13 -4
- mlrun/feature_store/retrieval/local_merger.py +2 -0
- mlrun/feature_store/retrieval/spark_merger.py +24 -32
- mlrun/feature_store/steps.py +45 -34
- mlrun/features.py +11 -21
- mlrun/frameworks/_common/artifacts_library.py +9 -9
- mlrun/frameworks/_common/mlrun_interface.py +5 -5
- mlrun/frameworks/_common/model_handler.py +48 -48
- mlrun/frameworks/_common/plan.py +5 -6
- mlrun/frameworks/_common/producer.py +3 -4
- mlrun/frameworks/_common/utils.py +5 -5
- mlrun/frameworks/_dl_common/loggers/logger.py +6 -7
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +9 -9
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +23 -47
- mlrun/frameworks/_ml_common/artifacts_library.py +1 -2
- mlrun/frameworks/_ml_common/loggers/logger.py +3 -4
- mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +4 -5
- mlrun/frameworks/_ml_common/model_handler.py +24 -24
- mlrun/frameworks/_ml_common/pkl_model_server.py +2 -2
- mlrun/frameworks/_ml_common/plan.py +2 -2
- mlrun/frameworks/_ml_common/plans/calibration_curve_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/feature_importance_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/_ml_common/utils.py +4 -4
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +9 -9
- mlrun/frameworks/huggingface/model_server.py +4 -4
- mlrun/frameworks/lgbm/__init__.py +33 -33
- mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -5
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -5
- mlrun/frameworks/lgbm/mlrun_interfaces/booster_mlrun_interface.py +1 -3
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +6 -6
- mlrun/frameworks/lgbm/model_handler.py +10 -10
- mlrun/frameworks/lgbm/model_server.py +6 -6
- mlrun/frameworks/lgbm/utils.py +5 -5
- mlrun/frameworks/onnx/dataset.py +8 -8
- mlrun/frameworks/onnx/mlrun_interface.py +3 -3
- mlrun/frameworks/onnx/model_handler.py +6 -6
- mlrun/frameworks/onnx/model_server.py +7 -7
- mlrun/frameworks/parallel_coordinates.py +6 -6
- mlrun/frameworks/pytorch/__init__.py +18 -18
- mlrun/frameworks/pytorch/callbacks/callback.py +4 -5
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +17 -17
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +23 -29
- mlrun/frameworks/pytorch/callbacks_handler.py +38 -38
- mlrun/frameworks/pytorch/mlrun_interface.py +20 -20
- mlrun/frameworks/pytorch/model_handler.py +17 -17
- mlrun/frameworks/pytorch/model_server.py +7 -7
- mlrun/frameworks/sklearn/__init__.py +13 -13
- mlrun/frameworks/sklearn/estimator.py +4 -4
- mlrun/frameworks/sklearn/metrics_library.py +14 -14
- mlrun/frameworks/sklearn/mlrun_interface.py +16 -9
- mlrun/frameworks/sklearn/model_handler.py +2 -2
- mlrun/frameworks/tf_keras/__init__.py +10 -7
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +15 -15
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +19 -23
- mlrun/frameworks/tf_keras/mlrun_interface.py +9 -11
- mlrun/frameworks/tf_keras/model_handler.py +14 -14
- mlrun/frameworks/tf_keras/model_server.py +6 -6
- mlrun/frameworks/xgboost/__init__.py +13 -13
- mlrun/frameworks/xgboost/model_handler.py +6 -6
- mlrun/k8s_utils.py +61 -17
- mlrun/launcher/__init__.py +1 -1
- mlrun/launcher/base.py +16 -15
- mlrun/launcher/client.py +13 -11
- mlrun/launcher/factory.py +1 -1
- mlrun/launcher/local.py +23 -13
- mlrun/launcher/remote.py +17 -10
- mlrun/lists.py +7 -6
- mlrun/model.py +478 -103
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +163 -371
- mlrun/{runtimes/mpijob/v1alpha1.py → model_monitoring/applications/__init__.py} +9 -15
- mlrun/model_monitoring/applications/_application_steps.py +188 -0
- mlrun/model_monitoring/applications/base.py +108 -0
- mlrun/model_monitoring/applications/context.py +341 -0
- mlrun/model_monitoring/{evidently_application.py → applications/evidently_base.py} +27 -22
- mlrun/model_monitoring/applications/histogram_data_drift.py +354 -0
- mlrun/model_monitoring/applications/results.py +99 -0
- mlrun/model_monitoring/controller.py +131 -278
- mlrun/model_monitoring/db/__init__.py +18 -0
- mlrun/model_monitoring/db/stores/__init__.py +136 -0
- mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
- mlrun/model_monitoring/db/stores/base/store.py +213 -0
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +190 -0
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +103 -0
- mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +659 -0
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +726 -0
- mlrun/model_monitoring/db/tsdb/__init__.py +105 -0
- mlrun/model_monitoring/db/tsdb/base.py +448 -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 +279 -0
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +42 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +507 -0
- mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +158 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +849 -0
- mlrun/model_monitoring/features_drift_table.py +134 -106
- mlrun/model_monitoring/helpers.py +199 -55
- mlrun/model_monitoring/metrics/__init__.py +13 -0
- mlrun/model_monitoring/metrics/histogram_distance.py +127 -0
- mlrun/model_monitoring/model_endpoint.py +3 -2
- mlrun/model_monitoring/stream_processing.py +131 -398
- mlrun/model_monitoring/tracking_policy.py +9 -2
- mlrun/model_monitoring/writer.py +161 -125
- mlrun/package/__init__.py +6 -6
- mlrun/package/context_handler.py +5 -5
- mlrun/package/packager.py +7 -7
- mlrun/package/packagers/default_packager.py +8 -8
- mlrun/package/packagers/numpy_packagers.py +15 -15
- mlrun/package/packagers/pandas_packagers.py +5 -5
- mlrun/package/packagers/python_standard_library_packagers.py +10 -10
- mlrun/package/packagers_manager.py +19 -23
- mlrun/package/utils/_formatter.py +6 -6
- mlrun/package/utils/_pickler.py +2 -2
- mlrun/package/utils/_supported_format.py +4 -4
- mlrun/package/utils/log_hint_utils.py +2 -2
- mlrun/package/utils/type_hint_utils.py +4 -9
- mlrun/platforms/__init__.py +11 -10
- mlrun/platforms/iguazio.py +24 -203
- mlrun/projects/operations.py +52 -25
- mlrun/projects/pipelines.py +191 -197
- mlrun/projects/project.py +1227 -400
- mlrun/render.py +16 -19
- mlrun/run.py +209 -184
- mlrun/runtimes/__init__.py +83 -15
- mlrun/runtimes/base.py +51 -35
- mlrun/runtimes/daskjob.py +17 -10
- mlrun/runtimes/databricks_job/databricks_cancel_task.py +1 -1
- mlrun/runtimes/databricks_job/databricks_runtime.py +8 -7
- mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
- mlrun/runtimes/funcdoc.py +1 -29
- mlrun/runtimes/function_reference.py +1 -1
- mlrun/runtimes/kubejob.py +34 -128
- mlrun/runtimes/local.py +40 -11
- mlrun/runtimes/mpijob/__init__.py +0 -20
- mlrun/runtimes/mpijob/abstract.py +9 -10
- mlrun/runtimes/mpijob/v1.py +1 -1
- mlrun/{model_monitoring/stores/models/sqlite.py → runtimes/nuclio/__init__.py} +7 -9
- mlrun/runtimes/nuclio/api_gateway.py +769 -0
- mlrun/runtimes/nuclio/application/__init__.py +15 -0
- mlrun/runtimes/nuclio/application/application.py +758 -0
- mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
- mlrun/runtimes/{function.py → nuclio/function.py} +200 -83
- mlrun/runtimes/{nuclio.py → nuclio/nuclio.py} +6 -6
- mlrun/runtimes/{serving.py → nuclio/serving.py} +65 -68
- mlrun/runtimes/pod.py +281 -101
- mlrun/runtimes/remotesparkjob.py +12 -9
- mlrun/runtimes/sparkjob/spark3job.py +67 -51
- mlrun/runtimes/utils.py +41 -75
- mlrun/secrets.py +9 -5
- mlrun/serving/__init__.py +8 -1
- mlrun/serving/remote.py +2 -7
- mlrun/serving/routers.py +85 -69
- mlrun/serving/server.py +69 -44
- mlrun/serving/states.py +209 -36
- mlrun/serving/utils.py +22 -14
- mlrun/serving/v1_serving.py +6 -7
- mlrun/serving/v2_serving.py +129 -54
- mlrun/track/tracker.py +2 -1
- mlrun/track/tracker_manager.py +3 -3
- mlrun/track/trackers/mlflow_tracker.py +6 -2
- mlrun/utils/async_http.py +6 -8
- mlrun/utils/azure_vault.py +1 -1
- mlrun/utils/clones.py +1 -2
- mlrun/utils/condition_evaluator.py +3 -3
- mlrun/utils/db.py +21 -3
- mlrun/utils/helpers.py +405 -225
- mlrun/utils/http.py +3 -6
- mlrun/utils/logger.py +112 -16
- mlrun/utils/notifications/notification/__init__.py +17 -13
- mlrun/utils/notifications/notification/base.py +50 -2
- mlrun/utils/notifications/notification/console.py +2 -0
- mlrun/utils/notifications/notification/git.py +24 -1
- mlrun/utils/notifications/notification/ipython.py +3 -1
- mlrun/utils/notifications/notification/slack.py +96 -21
- mlrun/utils/notifications/notification/webhook.py +59 -2
- mlrun/utils/notifications/notification_pusher.py +149 -30
- mlrun/utils/regex.py +9 -0
- mlrun/utils/retryer.py +208 -0
- mlrun/utils/singleton.py +1 -1
- mlrun/utils/v3io_clients.py +4 -6
- mlrun/utils/version/version.json +2 -2
- mlrun/utils/version/version.py +2 -6
- mlrun-1.7.0.dist-info/METADATA +378 -0
- mlrun-1.7.0.dist-info/RECORD +351 -0
- {mlrun-1.6.4rc7.dist-info → mlrun-1.7.0.dist-info}/WHEEL +1 -1
- mlrun/feature_store/retrieval/conversion.py +0 -273
- mlrun/kfpops.py +0 -868
- mlrun/model_monitoring/application.py +0 -310
- mlrun/model_monitoring/batch.py +0 -1095
- mlrun/model_monitoring/prometheus.py +0 -219
- mlrun/model_monitoring/stores/__init__.py +0 -111
- mlrun/model_monitoring/stores/kv_model_endpoint_store.py +0 -576
- mlrun/model_monitoring/stores/model_endpoint_store.py +0 -147
- mlrun/model_monitoring/stores/models/__init__.py +0 -27
- mlrun/model_monitoring/stores/models/base.py +0 -84
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -384
- mlrun/platforms/other.py +0 -306
- mlrun-1.6.4rc7.dist-info/METADATA +0 -272
- mlrun-1.6.4rc7.dist-info/RECORD +0 -314
- {mlrun-1.6.4rc7.dist-info → mlrun-1.7.0.dist-info}/LICENSE +0 -0
- {mlrun-1.6.4rc7.dist-info → mlrun-1.7.0.dist-info}/entry_points.txt +0 -0
- {mlrun-1.6.4rc7.dist-info → mlrun-1.7.0.dist-info}/top_level.txt +0 -0
|
@@ -22,11 +22,48 @@ import mlrun.common.types
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class NotificationKind(mlrun.common.types.StrEnum):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
"""Currently, the supported notification kinds and their params are as follows:"""
|
|
26
|
+
|
|
27
|
+
console: str = "console"
|
|
28
|
+
"""no params, local only"""
|
|
29
|
+
|
|
30
|
+
git: str = "git"
|
|
31
|
+
"""
|
|
32
|
+
**token** - The git token to use for the git notification.\n
|
|
33
|
+
**repo** - The git repo to which to send the notification.\n
|
|
34
|
+
**issue** - The git issue to which to send the notification.\n
|
|
35
|
+
**merge_request** -
|
|
36
|
+
In GitLab (as opposed to GitHub), merge requests and issues are separate entities.
|
|
37
|
+
If using merge request, the issue will be ignored, and vice versa.\n
|
|
38
|
+
**server** - The git server to which to send the notification.\n
|
|
39
|
+
**gitlab** - (bool) Whether the git server is GitLab or not.\n
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
ipython: str = "ipython"
|
|
43
|
+
"""no params, local only"""
|
|
44
|
+
|
|
45
|
+
slack: str = "slack"
|
|
46
|
+
"""**webhook** - The slack webhook to which to send the notification."""
|
|
47
|
+
|
|
48
|
+
webhook: str = "webhook"
|
|
49
|
+
"""
|
|
50
|
+
**url** - The webhook url to which to send the notification.\n
|
|
51
|
+
**method** - The http method to use when sending the notification (GET, POST, PUT, etc…).\n
|
|
52
|
+
**headers** - (dict) The http headers to send with the notification.\n
|
|
53
|
+
**override_body** -
|
|
54
|
+
(dict) The body to send with the notification. If not specified, the
|
|
55
|
+
default body will be a dictionary containing `name`, `message`, `severity`, and a `runs` list of the
|
|
56
|
+
completed runs. You can also add the run's details.\n
|
|
57
|
+
Example::
|
|
58
|
+
|
|
59
|
+
"override_body": {"message":"Run Completed {{ runs }}"
|
|
60
|
+
# Results would look like:
|
|
61
|
+
"message": "Run Completed [{'project': 'my-project', 'name': 'my-function', 'host': <run-host>,
|
|
62
|
+
'status': {'state': 'completed', 'results': <run-results>}}]"
|
|
63
|
+
**verify_ssl** -
|
|
64
|
+
(bool) Whether SSL certificates are validated during HTTP requests or not.
|
|
65
|
+
The default is set to True.\n
|
|
66
|
+
"""
|
|
30
67
|
|
|
31
68
|
|
|
32
69
|
class NotificationSeverity(mlrun.common.types.StrEnum):
|
|
@@ -50,18 +87,38 @@ class NotificationLimits(enum.Enum):
|
|
|
50
87
|
|
|
51
88
|
|
|
52
89
|
class Notification(pydantic.BaseModel):
|
|
90
|
+
"""
|
|
91
|
+
Notification object schema
|
|
92
|
+
|
|
93
|
+
:param kind: notification implementation kind - slack, webhook, etc.
|
|
94
|
+
:param name: for logging and identification
|
|
95
|
+
:param message: message content in the notification
|
|
96
|
+
:param severity: severity to display in the notification
|
|
97
|
+
:param when: list of statuses to trigger the notification: 'running', 'completed', 'error'
|
|
98
|
+
:param condition: optional condition to trigger the notification, a jinja2 expression that can use run data
|
|
99
|
+
to evaluate if the notification should be sent in addition to the 'when' statuses.
|
|
100
|
+
e.g.: '{{ run["status"]["results"]["accuracy"] < 0.9}}'
|
|
101
|
+
:param params: Implementation specific parameters for the notification implementation (e.g. slack webhook url,
|
|
102
|
+
git repository details, etc.)
|
|
103
|
+
:param secret_params: secret parameters for the notification implementation, same as params but will be stored
|
|
104
|
+
in a k8s secret and passed as a secret reference to the implementation.
|
|
105
|
+
:param status: notification status - pending, sent, error
|
|
106
|
+
:param sent_time: time the notification was sent
|
|
107
|
+
:param reason: failure reason if the notification failed to send
|
|
108
|
+
"""
|
|
109
|
+
|
|
53
110
|
kind: NotificationKind
|
|
54
111
|
name: str
|
|
55
|
-
message: str
|
|
56
|
-
severity: NotificationSeverity
|
|
57
|
-
when: typing.
|
|
58
|
-
condition: str
|
|
59
|
-
params: typing.
|
|
60
|
-
status: NotificationStatus = None
|
|
61
|
-
sent_time: typing.Union[str, datetime.datetime] = None
|
|
62
|
-
secret_params: typing.Optional[
|
|
112
|
+
message: typing.Optional[str] = None
|
|
113
|
+
severity: typing.Optional[NotificationSeverity] = None
|
|
114
|
+
when: typing.Optional[list[str]] = None
|
|
115
|
+
condition: typing.Optional[str] = None
|
|
116
|
+
params: typing.Optional[dict[str, typing.Any]] = None
|
|
117
|
+
status: typing.Optional[NotificationStatus] = None
|
|
118
|
+
sent_time: typing.Optional[typing.Union[str, datetime.datetime]] = None
|
|
119
|
+
secret_params: typing.Optional[dict[str, typing.Any]] = None
|
|
63
120
|
reason: typing.Optional[str] = None
|
|
64
121
|
|
|
65
122
|
|
|
66
123
|
class SetNotificationRequest(pydantic.BaseModel):
|
|
67
|
-
notifications:
|
|
124
|
+
notifications: list[Notification] = None
|
mlrun/common/schemas/object.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from datetime import datetime
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Optional
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel, Extra
|
|
19
19
|
|
|
@@ -60,7 +60,7 @@ class ObjectRecord(BaseModel):
|
|
|
60
60
|
project: str
|
|
61
61
|
uid: str
|
|
62
62
|
updated: Optional[datetime] = None
|
|
63
|
-
labels:
|
|
63
|
+
labels: list[LabelRecord]
|
|
64
64
|
# state is extracted from the full status dict to enable queries
|
|
65
65
|
state: Optional[str] = None
|
|
66
66
|
full_object: Optional[dict] = None
|
|
@@ -12,18 +12,15 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
import
|
|
16
|
-
from mlrun.model_monitoring.controller import MonitoringApplicationController
|
|
15
|
+
import typing
|
|
17
16
|
|
|
17
|
+
import pydantic
|
|
18
18
|
|
|
19
|
-
def handler(context: mlrun.run.MLClientCtx) -> None:
|
|
20
|
-
"""
|
|
21
|
-
Run model monitoring application processor
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
29
|
-
|
|
20
|
+
class PaginationInfo(pydantic.BaseModel):
|
|
21
|
+
class Config:
|
|
22
|
+
allow_population_by_field_name = True
|
|
23
|
+
|
|
24
|
+
page: typing.Optional[int]
|
|
25
|
+
page_size: typing.Optional[int] = pydantic.Field(alias="page-size")
|
|
26
|
+
page_token: typing.Optional[str] = pydantic.Field(alias="page-token")
|
mlrun/common/schemas/pipeline.py
CHANGED
|
@@ -15,10 +15,17 @@
|
|
|
15
15
|
import typing
|
|
16
16
|
|
|
17
17
|
import pydantic
|
|
18
|
+
from deprecated import deprecated
|
|
18
19
|
|
|
19
20
|
import mlrun.common.types
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
@deprecated(
|
|
24
|
+
version="1.7.0",
|
|
25
|
+
reason="mlrun.common.schemas.PipelinesFormat is deprecated and will be removed in 1.9.0. "
|
|
26
|
+
"Use mlrun.common.formatters.PipelineFormat instead.",
|
|
27
|
+
category=FutureWarning,
|
|
28
|
+
)
|
|
22
29
|
class PipelinesFormat(mlrun.common.types.StrEnum):
|
|
23
30
|
full = "full"
|
|
24
31
|
metadata_only = "metadata_only"
|
|
@@ -34,6 +41,6 @@ class PipelinesPagination(str):
|
|
|
34
41
|
|
|
35
42
|
class PipelinesOutput(pydantic.BaseModel):
|
|
36
43
|
# use the format query param to control what is returned
|
|
37
|
-
runs:
|
|
44
|
+
runs: list[typing.Union[dict, str]]
|
|
38
45
|
total_size: int
|
|
39
46
|
next_page_token: typing.Optional[str]
|
mlrun/common/schemas/project.py
CHANGED
|
@@ -16,6 +16,7 @@ import datetime
|
|
|
16
16
|
import typing
|
|
17
17
|
|
|
18
18
|
import pydantic
|
|
19
|
+
from deprecated import deprecated
|
|
19
20
|
|
|
20
21
|
import mlrun.common.types
|
|
21
22
|
|
|
@@ -23,6 +24,12 @@ from .common import ImageBuilder
|
|
|
23
24
|
from .object import ObjectKind, ObjectStatus
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
@deprecated(
|
|
28
|
+
version="1.7.0",
|
|
29
|
+
reason="mlrun.common.schemas.ProjectsFormat is deprecated and will be removed in 1.9.0. "
|
|
30
|
+
"Use mlrun.common.formatters.ProjectFormat instead.",
|
|
31
|
+
category=FutureWarning,
|
|
32
|
+
)
|
|
26
33
|
class ProjectsFormat(mlrun.common.types.StrEnum):
|
|
27
34
|
full = "full"
|
|
28
35
|
name_only = "name_only"
|
|
@@ -84,9 +91,33 @@ class ProjectSpec(pydantic.BaseModel):
|
|
|
84
91
|
subpath: typing.Optional[str] = None
|
|
85
92
|
origin_url: typing.Optional[str] = None
|
|
86
93
|
desired_state: typing.Optional[ProjectDesiredState] = ProjectDesiredState.online
|
|
87
|
-
custom_packagers: typing.Optional[
|
|
94
|
+
custom_packagers: typing.Optional[list[tuple[str, bool]]] = None
|
|
88
95
|
default_image: typing.Optional[str] = None
|
|
89
96
|
build: typing.Optional[ImageBuilder] = None
|
|
97
|
+
default_function_node_selector: typing.Optional[dict] = {}
|
|
98
|
+
|
|
99
|
+
class Config:
|
|
100
|
+
extra = pydantic.Extra.allow
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class ProjectSpecOut(pydantic.BaseModel):
|
|
104
|
+
description: typing.Optional[str] = None
|
|
105
|
+
owner: typing.Optional[str] = None
|
|
106
|
+
goals: typing.Optional[str] = None
|
|
107
|
+
params: typing.Optional[dict] = {}
|
|
108
|
+
functions: typing.Optional[list] = []
|
|
109
|
+
workflows: typing.Optional[list] = []
|
|
110
|
+
artifacts: typing.Optional[list] = []
|
|
111
|
+
artifact_path: typing.Optional[str] = None
|
|
112
|
+
conda: typing.Optional[str] = None
|
|
113
|
+
source: typing.Optional[str] = None
|
|
114
|
+
subpath: typing.Optional[str] = None
|
|
115
|
+
origin_url: typing.Optional[str] = None
|
|
116
|
+
desired_state: typing.Optional[ProjectDesiredState] = ProjectDesiredState.online
|
|
117
|
+
custom_packagers: typing.Optional[list[tuple[str, bool]]] = None
|
|
118
|
+
default_image: typing.Optional[str] = None
|
|
119
|
+
build: typing.Any = None
|
|
120
|
+
default_function_node_selector: typing.Optional[dict] = {}
|
|
90
121
|
|
|
91
122
|
class Config:
|
|
92
123
|
extra = pydantic.Extra.allow
|
|
@@ -99,6 +130,15 @@ class Project(pydantic.BaseModel):
|
|
|
99
130
|
status: ObjectStatus = ObjectStatus()
|
|
100
131
|
|
|
101
132
|
|
|
133
|
+
# The reason we have a different schema for the response model is that we don't want to validate project.spec.build in
|
|
134
|
+
# the response as the validation was added late and there may be corrupted values in the DB.
|
|
135
|
+
class ProjectOut(pydantic.BaseModel):
|
|
136
|
+
kind: ObjectKind = pydantic.Field(ObjectKind.project, const=True)
|
|
137
|
+
metadata: ProjectMetadata
|
|
138
|
+
spec: ProjectSpecOut = ProjectSpecOut()
|
|
139
|
+
status: ObjectStatus = ObjectStatus()
|
|
140
|
+
|
|
141
|
+
|
|
102
142
|
class ProjectOwner(pydantic.BaseModel):
|
|
103
143
|
username: str
|
|
104
144
|
access_key: str
|
|
@@ -106,31 +146,42 @@ class ProjectOwner(pydantic.BaseModel):
|
|
|
106
146
|
|
|
107
147
|
class ProjectSummary(pydantic.BaseModel):
|
|
108
148
|
name: str
|
|
109
|
-
files_count: int
|
|
110
|
-
feature_sets_count: int
|
|
111
|
-
models_count: int
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
149
|
+
files_count: int = 0
|
|
150
|
+
feature_sets_count: int = 0
|
|
151
|
+
models_count: int = 0
|
|
152
|
+
runs_completed_recent_count: int = 0
|
|
153
|
+
runs_failed_recent_count: int = 0
|
|
154
|
+
runs_running_count: int = 0
|
|
155
|
+
distinct_schedules_count: int = 0
|
|
156
|
+
distinct_scheduled_jobs_pending_count: int = 0
|
|
157
|
+
distinct_scheduled_pipelines_pending_count: int = 0
|
|
158
|
+
pipelines_completed_recent_count: typing.Optional[int] = None
|
|
159
|
+
pipelines_failed_recent_count: typing.Optional[int] = None
|
|
115
160
|
pipelines_running_count: typing.Optional[int] = None
|
|
161
|
+
updated: typing.Optional[datetime.datetime] = None
|
|
116
162
|
|
|
117
163
|
|
|
118
164
|
class IguazioProject(pydantic.BaseModel):
|
|
119
165
|
data: dict
|
|
120
166
|
|
|
121
167
|
|
|
168
|
+
# The format query param controls the project type used:
|
|
169
|
+
# full - ProjectOut
|
|
170
|
+
# name_only - str
|
|
171
|
+
# summary - ProjectSummary
|
|
172
|
+
# leader - currently only IguazioProject supported
|
|
173
|
+
# The way pydantic handles typing.Union is that it takes the object and tries to coerce it to be the types of the
|
|
174
|
+
# union by the definition order. Therefore, we can't currently add generic dict for all leader formats, but we need
|
|
175
|
+
# to add a specific classes for them. it's frustrating but couldn't find other workaround, see:
|
|
176
|
+
# https://github.com/samuelcolvin/pydantic/issues/1423, https://github.com/samuelcolvin/pydantic/issues/619
|
|
177
|
+
ProjectOutput = typing.TypeVar(
|
|
178
|
+
"ProjectOutput", ProjectOut, str, ProjectSummary, IguazioProject
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
122
182
|
class ProjectsOutput(pydantic.BaseModel):
|
|
123
|
-
|
|
124
|
-
# full - Project
|
|
125
|
-
# name_only - str
|
|
126
|
-
# summary - ProjectSummary
|
|
127
|
-
# leader - currently only IguazioProject supported
|
|
128
|
-
# The way pydantic handles typing.Union is that it takes the object and tries to coerce it to be the types of the
|
|
129
|
-
# union by the definition order. Therefore we can't currently add generic dict for all leader formats, but we need
|
|
130
|
-
# to add a specific classes for them. it's frustrating but couldn't find other workaround, see:
|
|
131
|
-
# https://github.com/samuelcolvin/pydantic/issues/1423, https://github.com/samuelcolvin/pydantic/issues/619
|
|
132
|
-
projects: typing.List[typing.Union[Project, str, ProjectSummary, IguazioProject]]
|
|
183
|
+
projects: list[ProjectOutput]
|
|
133
184
|
|
|
134
185
|
|
|
135
186
|
class ProjectSummariesOutput(pydantic.BaseModel):
|
|
136
|
-
project_summaries:
|
|
187
|
+
project_summaries: list[ProjectSummary]
|
mlrun/common/schemas/runs.py
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import typing
|
|
16
16
|
|
|
17
17
|
import pydantic
|
|
18
|
+
from deprecated import deprecated
|
|
18
19
|
|
|
19
20
|
import mlrun.common.types
|
|
20
21
|
|
|
@@ -25,7 +26,12 @@ class RunIdentifier(pydantic.BaseModel):
|
|
|
25
26
|
iter: typing.Optional[int]
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
@deprecated(
|
|
30
|
+
version="1.7.0",
|
|
31
|
+
reason="mlrun.common.schemas.RunsFormat is deprecated and will be removed in 1.9.0. "
|
|
32
|
+
"Use mlrun.common.formatters.RunFormat instead.",
|
|
33
|
+
category=FutureWarning,
|
|
34
|
+
)
|
|
29
35
|
class RunsFormat(mlrun.common.types.StrEnum):
|
|
30
36
|
# No enrichment, data is pulled as-is from the database.
|
|
31
37
|
standard = "standard"
|
|
@@ -26,15 +26,15 @@ class ListRuntimeResourcesGroupByField(mlrun.common.types.StrEnum):
|
|
|
26
26
|
|
|
27
27
|
class RuntimeResource(pydantic.BaseModel):
|
|
28
28
|
name: str
|
|
29
|
-
labels:
|
|
30
|
-
status: typing.Optional[
|
|
29
|
+
labels: dict[str, str] = {}
|
|
30
|
+
status: typing.Optional[dict]
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class RuntimeResources(pydantic.BaseModel):
|
|
34
|
-
crd_resources:
|
|
35
|
-
pod_resources:
|
|
34
|
+
crd_resources: list[RuntimeResource] = []
|
|
35
|
+
pod_resources: list[RuntimeResource] = []
|
|
36
36
|
# only for dask runtime
|
|
37
|
-
service_resources: typing.Optional[
|
|
37
|
+
service_resources: typing.Optional[list[RuntimeResource]] = None
|
|
38
38
|
|
|
39
39
|
class Config:
|
|
40
40
|
extra = pydantic.Extra.allow
|
|
@@ -45,14 +45,10 @@ class KindRuntimeResources(pydantic.BaseModel):
|
|
|
45
45
|
resources: RuntimeResources
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
RuntimeResourcesOutput =
|
|
48
|
+
RuntimeResourcesOutput = list[KindRuntimeResources]
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
# project name -> job uid -> runtime resources
|
|
52
|
-
GroupedByJobRuntimeResourcesOutput =
|
|
53
|
-
str, typing.Dict[str, RuntimeResources]
|
|
54
|
-
]
|
|
52
|
+
GroupedByJobRuntimeResourcesOutput = dict[str, dict[str, RuntimeResources]]
|
|
55
53
|
# project name -> kind -> runtime resources
|
|
56
|
-
GroupedByProjectRuntimeResourcesOutput =
|
|
57
|
-
str, typing.Dict[str, RuntimeResources]
|
|
58
|
-
]
|
|
54
|
+
GroupedByProjectRuntimeResourcesOutput = dict[str, dict[str, RuntimeResources]]
|
mlrun/common/schemas/schedule.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from datetime import datetime
|
|
16
|
-
from typing import Any,
|
|
16
|
+
from typing import Any, Literal, Optional, Union
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel
|
|
19
19
|
|
|
@@ -96,7 +96,7 @@ class ScheduleUpdate(BaseModel):
|
|
|
96
96
|
scheduled_object: Optional[Any]
|
|
97
97
|
cron_trigger: Optional[Union[str, ScheduleCronTrigger]]
|
|
98
98
|
desired_state: Optional[str]
|
|
99
|
-
labels: Optional[dict] =
|
|
99
|
+
labels: Optional[dict] = None
|
|
100
100
|
concurrency_limit: Optional[int]
|
|
101
101
|
credentials: Credentials = Credentials()
|
|
102
102
|
|
|
@@ -119,7 +119,7 @@ class ScheduleRecord(ScheduleInput):
|
|
|
119
119
|
project: str
|
|
120
120
|
last_run_uri: Optional[str]
|
|
121
121
|
state: Optional[str]
|
|
122
|
-
labels: Optional[
|
|
122
|
+
labels: Optional[list[LabelRecord]]
|
|
123
123
|
next_run_time: Optional[datetime]
|
|
124
124
|
|
|
125
125
|
class Config:
|
|
@@ -135,7 +135,7 @@ class ScheduleOutput(ScheduleRecord):
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
class SchedulesOutput(BaseModel):
|
|
138
|
-
schedules:
|
|
138
|
+
schedules: list[ScheduleOutput]
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
class ScheduleIdentifier(BaseModel):
|
mlrun/common/schemas/tag.py
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
import typing
|
|
16
15
|
|
|
17
16
|
import pydantic
|
|
18
17
|
|
|
@@ -29,4 +28,4 @@ class TagObjects(pydantic.BaseModel):
|
|
|
29
28
|
|
|
30
29
|
kind: str
|
|
31
30
|
# TODO: Add more types to the list for new supported tagged objects
|
|
32
|
-
identifiers:
|
|
31
|
+
identifiers: list[ArtifactIdentifier]
|
mlrun/common/schemas/workflow.py
CHANGED
|
@@ -16,8 +16,9 @@ import typing
|
|
|
16
16
|
|
|
17
17
|
import pydantic
|
|
18
18
|
|
|
19
|
-
from .notification import Notification
|
|
20
|
-
from .schedule import ScheduleCronTrigger
|
|
19
|
+
from mlrun.common.schemas.notification import Notification
|
|
20
|
+
from mlrun.common.schemas.schedule import ScheduleCronTrigger
|
|
21
|
+
from mlrun.common.types import StrEnum
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class WorkflowSpec(pydantic.BaseModel):
|
|
@@ -32,16 +33,17 @@ class WorkflowSpec(pydantic.BaseModel):
|
|
|
32
33
|
schedule: typing.Union[str, ScheduleCronTrigger] = None
|
|
33
34
|
run_local: typing.Optional[bool] = None
|
|
34
35
|
image: typing.Optional[str] = None
|
|
36
|
+
workflow_runner_node_selector: typing.Optional[dict[str, str]] = None
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
class WorkflowRequest(pydantic.BaseModel):
|
|
38
40
|
spec: typing.Optional[WorkflowSpec] = None
|
|
39
|
-
arguments: typing.Optional[
|
|
41
|
+
arguments: typing.Optional[dict] = None
|
|
40
42
|
artifact_path: typing.Optional[str] = None
|
|
41
43
|
source: typing.Optional[str] = None
|
|
42
44
|
run_name: typing.Optional[str] = None
|
|
43
45
|
namespace: typing.Optional[str] = None
|
|
44
|
-
notifications: typing.Optional[
|
|
46
|
+
notifications: typing.Optional[list[Notification]] = None
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
class WorkflowResponse(pydantic.BaseModel):
|
|
@@ -54,3 +56,9 @@ class WorkflowResponse(pydantic.BaseModel):
|
|
|
54
56
|
|
|
55
57
|
class GetWorkflowResponse(pydantic.BaseModel):
|
|
56
58
|
workflow_id: str = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class EngineType(StrEnum):
|
|
62
|
+
LOCAL = "local"
|
|
63
|
+
REMOTE = "remote"
|
|
64
|
+
KFP = "kfp"
|
mlrun/common/types.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
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
|
-
#
|
|
15
14
|
|
|
16
15
|
import enum
|
|
17
16
|
|
|
@@ -23,3 +22,17 @@ class StrEnum(str, enum.Enum):
|
|
|
23
22
|
|
|
24
23
|
def __repr__(self):
|
|
25
24
|
return self.value
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Partial backport from Python 3.11
|
|
28
|
+
# https://docs.python.org/3/library/http.html#http.HTTPMethod
|
|
29
|
+
class HTTPMethod(StrEnum):
|
|
30
|
+
GET = "GET"
|
|
31
|
+
POST = "POST"
|
|
32
|
+
DELETE = "DELETE"
|
|
33
|
+
PATCH = "PATCH"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Operation(StrEnum):
|
|
37
|
+
ADD = "add"
|
|
38
|
+
REMOVE = "remove"
|