mlrun 1.7.2__py3-none-any.whl → 1.8.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mlrun might be problematic. Click here for more details.
- mlrun/__init__.py +14 -12
- mlrun/__main__.py +3 -3
- mlrun/alerts/alert.py +19 -12
- mlrun/artifacts/__init__.py +0 -2
- mlrun/artifacts/base.py +34 -11
- mlrun/artifacts/dataset.py +16 -16
- mlrun/artifacts/manager.py +13 -13
- mlrun/artifacts/model.py +66 -53
- mlrun/common/constants.py +6 -0
- mlrun/common/formatters/__init__.py +1 -0
- mlrun/common/formatters/feature_set.py +1 -0
- mlrun/common/formatters/function.py +1 -0
- mlrun/common/formatters/model_endpoint.py +30 -0
- mlrun/common/formatters/pipeline.py +1 -2
- mlrun/common/model_monitoring/__init__.py +0 -3
- mlrun/common/model_monitoring/helpers.py +1 -1
- mlrun/common/runtimes/constants.py +1 -2
- mlrun/common/schemas/__init__.py +4 -2
- mlrun/common/schemas/artifact.py +0 -6
- mlrun/common/schemas/common.py +50 -0
- mlrun/common/schemas/model_monitoring/__init__.py +8 -1
- mlrun/common/schemas/model_monitoring/constants.py +62 -12
- mlrun/common/schemas/model_monitoring/model_endpoint_v2.py +149 -0
- mlrun/common/schemas/model_monitoring/model_endpoints.py +21 -5
- mlrun/common/schemas/partition.py +122 -0
- mlrun/config.py +43 -15
- mlrun/data_types/__init__.py +0 -2
- mlrun/data_types/data_types.py +0 -1
- mlrun/data_types/infer.py +3 -1
- mlrun/data_types/spark.py +4 -4
- mlrun/data_types/to_pandas.py +2 -11
- mlrun/datastore/__init__.py +0 -2
- mlrun/datastore/alibaba_oss.py +4 -1
- mlrun/datastore/azure_blob.py +4 -1
- mlrun/datastore/base.py +12 -4
- mlrun/datastore/datastore.py +9 -3
- mlrun/datastore/datastore_profile.py +1 -1
- mlrun/datastore/dbfs_store.py +4 -1
- mlrun/datastore/filestore.py +4 -1
- mlrun/datastore/google_cloud_storage.py +4 -1
- mlrun/datastore/hdfs.py +4 -1
- mlrun/datastore/inmem.py +4 -1
- mlrun/datastore/redis.py +4 -1
- mlrun/datastore/s3.py +4 -1
- mlrun/datastore/sources.py +51 -49
- mlrun/datastore/store_resources.py +0 -2
- mlrun/datastore/targets.py +22 -23
- mlrun/datastore/utils.py +2 -2
- mlrun/datastore/v3io.py +4 -1
- mlrun/datastore/wasbfs/fs.py +13 -12
- mlrun/db/base.py +126 -62
- mlrun/db/factory.py +3 -0
- mlrun/db/httpdb.py +767 -231
- mlrun/db/nopdb.py +126 -57
- mlrun/errors.py +2 -2
- mlrun/execution.py +55 -29
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +40 -40
- mlrun/feature_store/common.py +9 -9
- mlrun/feature_store/feature_set.py +20 -18
- mlrun/feature_store/feature_vector.py +27 -24
- mlrun/feature_store/retrieval/base.py +14 -9
- mlrun/feature_store/retrieval/job.py +2 -1
- mlrun/feature_store/steps.py +2 -2
- mlrun/features.py +30 -13
- mlrun/frameworks/__init__.py +1 -2
- mlrun/frameworks/_common/__init__.py +1 -2
- mlrun/frameworks/_common/artifacts_library.py +2 -2
- mlrun/frameworks/_common/mlrun_interface.py +10 -6
- mlrun/frameworks/_common/model_handler.py +29 -27
- mlrun/frameworks/_common/producer.py +3 -1
- mlrun/frameworks/_dl_common/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +4 -4
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +3 -3
- mlrun/frameworks/_ml_common/__init__.py +1 -2
- mlrun/frameworks/_ml_common/loggers/__init__.py +1 -2
- mlrun/frameworks/_ml_common/model_handler.py +21 -21
- mlrun/frameworks/_ml_common/plans/__init__.py +1 -2
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +3 -1
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/auto_mlrun/__init__.py +1 -2
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +22 -15
- mlrun/frameworks/huggingface/__init__.py +1 -2
- mlrun/frameworks/huggingface/model_server.py +9 -9
- mlrun/frameworks/lgbm/__init__.py +47 -44
- mlrun/frameworks/lgbm/callbacks/__init__.py +1 -2
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -2
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/__init__.py +1 -2
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +5 -5
- mlrun/frameworks/lgbm/model_handler.py +15 -11
- mlrun/frameworks/lgbm/model_server.py +11 -7
- mlrun/frameworks/lgbm/utils.py +2 -2
- mlrun/frameworks/onnx/__init__.py +1 -2
- mlrun/frameworks/onnx/dataset.py +3 -3
- mlrun/frameworks/onnx/mlrun_interface.py +2 -2
- mlrun/frameworks/onnx/model_handler.py +7 -5
- mlrun/frameworks/onnx/model_server.py +8 -6
- mlrun/frameworks/parallel_coordinates.py +11 -11
- mlrun/frameworks/pytorch/__init__.py +22 -23
- mlrun/frameworks/pytorch/callbacks/__init__.py +1 -2
- mlrun/frameworks/pytorch/callbacks/callback.py +2 -1
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +15 -8
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +19 -12
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +22 -15
- mlrun/frameworks/pytorch/callbacks_handler.py +36 -30
- mlrun/frameworks/pytorch/mlrun_interface.py +17 -17
- mlrun/frameworks/pytorch/model_handler.py +21 -17
- mlrun/frameworks/pytorch/model_server.py +13 -9
- mlrun/frameworks/sklearn/__init__.py +19 -18
- mlrun/frameworks/sklearn/estimator.py +2 -2
- mlrun/frameworks/sklearn/metric.py +3 -3
- mlrun/frameworks/sklearn/metrics_library.py +8 -6
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -2
- mlrun/frameworks/sklearn/model_handler.py +4 -3
- mlrun/frameworks/tf_keras/__init__.py +11 -12
- mlrun/frameworks/tf_keras/callbacks/__init__.py +1 -2
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +17 -14
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +15 -12
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +21 -18
- mlrun/frameworks/tf_keras/model_handler.py +17 -13
- mlrun/frameworks/tf_keras/model_server.py +12 -8
- mlrun/frameworks/xgboost/__init__.py +19 -18
- mlrun/frameworks/xgboost/model_handler.py +13 -9
- mlrun/launcher/base.py +3 -4
- mlrun/launcher/local.py +1 -1
- mlrun/launcher/remote.py +1 -1
- mlrun/lists.py +4 -3
- mlrun/model.py +108 -44
- mlrun/model_monitoring/__init__.py +1 -2
- mlrun/model_monitoring/api.py +6 -6
- mlrun/model_monitoring/applications/_application_steps.py +13 -15
- mlrun/model_monitoring/applications/histogram_data_drift.py +41 -15
- mlrun/model_monitoring/applications/results.py +55 -3
- mlrun/model_monitoring/controller.py +185 -223
- mlrun/model_monitoring/db/_schedules.py +156 -0
- mlrun/model_monitoring/db/_stats.py +189 -0
- mlrun/model_monitoring/db/stores/__init__.py +1 -1
- mlrun/model_monitoring/db/stores/base/store.py +6 -65
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +0 -25
- mlrun/model_monitoring/db/stores/sqldb/models/base.py +0 -97
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +2 -58
- mlrun/model_monitoring/db/stores/sqldb/models/sqlite.py +0 -15
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +6 -257
- mlrun/model_monitoring/db/stores/v3io_kv/kv_store.py +9 -271
- mlrun/model_monitoring/db/tsdb/base.py +74 -22
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +66 -35
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +33 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +284 -51
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +1 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +35 -17
- mlrun/model_monitoring/helpers.py +97 -1
- mlrun/model_monitoring/model_endpoint.py +4 -2
- mlrun/model_monitoring/stream_processing.py +2 -2
- mlrun/model_monitoring/tracking_policy.py +10 -3
- mlrun/model_monitoring/writer.py +47 -26
- mlrun/package/__init__.py +3 -6
- mlrun/package/context_handler.py +1 -1
- mlrun/package/packager.py +12 -9
- mlrun/package/packagers/__init__.py +0 -2
- mlrun/package/packagers/default_packager.py +14 -11
- mlrun/package/packagers/numpy_packagers.py +16 -7
- mlrun/package/packagers/pandas_packagers.py +18 -18
- mlrun/package/packagers/python_standard_library_packagers.py +25 -11
- mlrun/package/packagers_manager.py +31 -14
- mlrun/package/utils/__init__.py +0 -3
- mlrun/package/utils/_pickler.py +6 -6
- mlrun/platforms/__init__.py +3 -3
- mlrun/platforms/iguazio.py +4 -1
- mlrun/projects/__init__.py +1 -6
- mlrun/projects/operations.py +27 -27
- mlrun/projects/pipelines.py +85 -215
- mlrun/projects/project.py +444 -158
- mlrun/run.py +9 -9
- mlrun/runtimes/__init__.py +1 -3
- mlrun/runtimes/base.py +13 -10
- mlrun/runtimes/daskjob.py +9 -9
- mlrun/runtimes/generators.py +2 -1
- mlrun/runtimes/kubejob.py +4 -5
- mlrun/runtimes/mpijob/__init__.py +0 -2
- mlrun/runtimes/mpijob/abstract.py +7 -6
- mlrun/runtimes/nuclio/api_gateway.py +7 -7
- mlrun/runtimes/nuclio/application/application.py +11 -11
- mlrun/runtimes/nuclio/function.py +14 -14
- mlrun/runtimes/nuclio/serving.py +9 -9
- mlrun/runtimes/pod.py +74 -29
- mlrun/runtimes/remotesparkjob.py +3 -2
- mlrun/runtimes/sparkjob/__init__.py +0 -2
- mlrun/runtimes/sparkjob/spark3job.py +21 -11
- mlrun/runtimes/utils.py +6 -5
- mlrun/serving/merger.py +6 -4
- mlrun/serving/remote.py +18 -17
- mlrun/serving/routers.py +27 -27
- mlrun/serving/server.py +1 -1
- mlrun/serving/states.py +76 -71
- mlrun/serving/utils.py +13 -2
- mlrun/serving/v1_serving.py +3 -2
- mlrun/serving/v2_serving.py +4 -4
- mlrun/track/__init__.py +1 -1
- mlrun/track/tracker.py +2 -2
- mlrun/track/trackers/mlflow_tracker.py +6 -5
- mlrun/utils/async_http.py +1 -1
- mlrun/utils/helpers.py +72 -28
- mlrun/utils/logger.py +104 -2
- mlrun/utils/notifications/notification/base.py +23 -4
- mlrun/utils/notifications/notification/console.py +1 -1
- mlrun/utils/notifications/notification/git.py +6 -6
- mlrun/utils/notifications/notification/ipython.py +5 -4
- mlrun/utils/notifications/notification/slack.py +1 -1
- mlrun/utils/notifications/notification/webhook.py +13 -17
- mlrun/utils/notifications/notification_pusher.py +23 -19
- mlrun/utils/regex.py +1 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/METADATA +187 -199
- mlrun-1.8.0rc1.dist-info/RECORD +356 -0
- {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/WHEEL +1 -1
- mlrun-1.7.2.dist-info/RECORD +0 -351
- {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/LICENSE +0 -0
- {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.2.dist-info → mlrun-1.8.0rc1.dist-info}/top_level.txt +0 -0
mlrun/db/nopdb.py
CHANGED
|
@@ -104,7 +104,7 @@ class NopDB(RunDBInterface):
|
|
|
104
104
|
name: Optional[str] = None,
|
|
105
105
|
uid: Optional[Union[str, list[str]]] = None,
|
|
106
106
|
project: Optional[str] = None,
|
|
107
|
-
labels: Optional[Union[str, list[str]]] = None,
|
|
107
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
108
108
|
state: Optional[
|
|
109
109
|
mlrun.common.runtimes.constants.RunStates
|
|
110
110
|
] = None, # Backward compatibility
|
|
@@ -112,10 +112,10 @@ class NopDB(RunDBInterface):
|
|
|
112
112
|
sort: bool = True,
|
|
113
113
|
last: int = 0,
|
|
114
114
|
iter: bool = False,
|
|
115
|
-
start_time_from: datetime.datetime = None,
|
|
116
|
-
start_time_to: datetime.datetime = None,
|
|
117
|
-
last_update_time_from: datetime.datetime = None,
|
|
118
|
-
last_update_time_to: datetime.datetime = None,
|
|
115
|
+
start_time_from: Optional[datetime.datetime] = None,
|
|
116
|
+
start_time_to: Optional[datetime.datetime] = None,
|
|
117
|
+
last_update_time_from: Optional[datetime.datetime] = None,
|
|
118
|
+
last_update_time_to: Optional[datetime.datetime] = None,
|
|
119
119
|
partition_by: Union[mlrun.common.schemas.RunPartitionByField, str] = None,
|
|
120
120
|
rows_per_partition: int = 1,
|
|
121
121
|
partition_sort_by: Union[mlrun.common.schemas.SortField, str] = None,
|
|
@@ -127,10 +127,27 @@ class NopDB(RunDBInterface):
|
|
|
127
127
|
):
|
|
128
128
|
return mlrun.lists.RunList()
|
|
129
129
|
|
|
130
|
+
def paginated_list_runs(
|
|
131
|
+
self,
|
|
132
|
+
*args,
|
|
133
|
+
page: Optional[int] = None,
|
|
134
|
+
page_size: Optional[int] = None,
|
|
135
|
+
page_token: Optional[str] = None,
|
|
136
|
+
**kwargs,
|
|
137
|
+
):
|
|
138
|
+
return mlrun.lists.RunList(), None
|
|
139
|
+
|
|
130
140
|
def del_run(self, uid, project="", iter=0):
|
|
131
141
|
pass
|
|
132
142
|
|
|
133
|
-
def del_runs(
|
|
143
|
+
def del_runs(
|
|
144
|
+
self,
|
|
145
|
+
name: str = "",
|
|
146
|
+
project: str = "",
|
|
147
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
148
|
+
state: Optional[mlrun.common.runtimes.constants.RunStates] = None,
|
|
149
|
+
days_ago: int = 0,
|
|
150
|
+
):
|
|
134
151
|
pass
|
|
135
152
|
|
|
136
153
|
def store_artifact(
|
|
@@ -155,19 +172,29 @@ class NopDB(RunDBInterface):
|
|
|
155
172
|
name="",
|
|
156
173
|
project="",
|
|
157
174
|
tag="",
|
|
158
|
-
labels=None,
|
|
175
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
159
176
|
since=None,
|
|
160
177
|
until=None,
|
|
161
|
-
iter: int = None,
|
|
178
|
+
iter: Optional[int] = None,
|
|
162
179
|
best_iteration: bool = False,
|
|
163
|
-
kind: str = None,
|
|
180
|
+
kind: Optional[str] = None,
|
|
164
181
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
165
|
-
tree: str = None,
|
|
182
|
+
tree: Optional[str] = None,
|
|
166
183
|
format_: mlrun.common.formatters.ArtifactFormat = mlrun.common.formatters.ArtifactFormat.full,
|
|
167
|
-
limit: int = None,
|
|
184
|
+
limit: Optional[int] = None,
|
|
168
185
|
):
|
|
169
186
|
return mlrun.lists.ArtifactList()
|
|
170
187
|
|
|
188
|
+
def paginated_list_artifacts(
|
|
189
|
+
self,
|
|
190
|
+
*args,
|
|
191
|
+
page: Optional[int] = None,
|
|
192
|
+
page_size: Optional[int] = None,
|
|
193
|
+
page_token: Optional[str] = None,
|
|
194
|
+
**kwargs,
|
|
195
|
+
):
|
|
196
|
+
return mlrun.lists.ArtifactList(), None
|
|
197
|
+
|
|
171
198
|
def del_artifact(
|
|
172
199
|
self,
|
|
173
200
|
key,
|
|
@@ -178,12 +205,18 @@ class NopDB(RunDBInterface):
|
|
|
178
205
|
deletion_strategy: mlrun.common.schemas.artifact.ArtifactsDeletionStrategies = (
|
|
179
206
|
mlrun.common.schemas.artifact.ArtifactsDeletionStrategies.metadata_only
|
|
180
207
|
),
|
|
181
|
-
secrets: dict = None,
|
|
208
|
+
secrets: Optional[dict] = None,
|
|
182
209
|
iter=None,
|
|
183
210
|
):
|
|
184
211
|
pass
|
|
185
212
|
|
|
186
|
-
def del_artifacts(
|
|
213
|
+
def del_artifacts(
|
|
214
|
+
self,
|
|
215
|
+
name="",
|
|
216
|
+
project="",
|
|
217
|
+
tag="",
|
|
218
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
219
|
+
):
|
|
187
220
|
pass
|
|
188
221
|
|
|
189
222
|
def store_function(self, function, name, project="", tag="", versioned=False):
|
|
@@ -196,10 +229,26 @@ class NopDB(RunDBInterface):
|
|
|
196
229
|
pass
|
|
197
230
|
|
|
198
231
|
def list_functions(
|
|
199
|
-
self,
|
|
232
|
+
self,
|
|
233
|
+
name=None,
|
|
234
|
+
project="",
|
|
235
|
+
tag="",
|
|
236
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
237
|
+
since=None,
|
|
238
|
+
until=None,
|
|
200
239
|
):
|
|
201
240
|
return []
|
|
202
241
|
|
|
242
|
+
def paginated_list_functions(
|
|
243
|
+
self,
|
|
244
|
+
*args,
|
|
245
|
+
page: Optional[int] = None,
|
|
246
|
+
page_size: Optional[int] = None,
|
|
247
|
+
page_token: Optional[str] = None,
|
|
248
|
+
**kwargs,
|
|
249
|
+
):
|
|
250
|
+
return [], None
|
|
251
|
+
|
|
203
252
|
def tag_objects(
|
|
204
253
|
self,
|
|
205
254
|
project: str,
|
|
@@ -249,9 +298,9 @@ class NopDB(RunDBInterface):
|
|
|
249
298
|
|
|
250
299
|
def list_projects(
|
|
251
300
|
self,
|
|
252
|
-
owner: str = None,
|
|
301
|
+
owner: Optional[str] = None,
|
|
253
302
|
format_: mlrun.common.formatters.ProjectFormat = mlrun.common.formatters.ProjectFormat.name_only,
|
|
254
|
-
labels: list[str] = None,
|
|
303
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
255
304
|
state: mlrun.common.schemas.ProjectState = None,
|
|
256
305
|
) -> mlrun.common.schemas.ProjectsOutput:
|
|
257
306
|
pass
|
|
@@ -275,49 +324,61 @@ class NopDB(RunDBInterface):
|
|
|
275
324
|
pass
|
|
276
325
|
|
|
277
326
|
def get_feature_set(
|
|
278
|
-
self,
|
|
327
|
+
self,
|
|
328
|
+
name: str,
|
|
329
|
+
project: str = "",
|
|
330
|
+
tag: Optional[str] = None,
|
|
331
|
+
uid: Optional[str] = None,
|
|
279
332
|
) -> dict:
|
|
280
333
|
pass
|
|
281
334
|
|
|
282
335
|
def list_features(
|
|
283
336
|
self,
|
|
284
337
|
project: str,
|
|
285
|
-
name: str = None,
|
|
286
|
-
tag: str = None,
|
|
287
|
-
entities: list[str] = None,
|
|
288
|
-
labels: list[str] = None,
|
|
338
|
+
name: Optional[str] = None,
|
|
339
|
+
tag: Optional[str] = None,
|
|
340
|
+
entities: Optional[list[str]] = None,
|
|
341
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
289
342
|
) -> mlrun.common.schemas.FeaturesOutput:
|
|
290
343
|
pass
|
|
291
344
|
|
|
292
345
|
def list_features_v2(
|
|
293
346
|
self,
|
|
294
347
|
project: str,
|
|
295
|
-
name: str = None,
|
|
296
|
-
tag: str = None,
|
|
297
|
-
entities: list[str] = None,
|
|
298
|
-
labels: list[str] = None,
|
|
348
|
+
name: Optional[str] = None,
|
|
349
|
+
tag: Optional[str] = None,
|
|
350
|
+
entities: Optional[list[str]] = None,
|
|
351
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
299
352
|
) -> mlrun.common.schemas.FeaturesOutputV2:
|
|
300
353
|
pass
|
|
301
354
|
|
|
302
355
|
def list_entities(
|
|
303
|
-
self,
|
|
356
|
+
self,
|
|
357
|
+
project: str,
|
|
358
|
+
name: Optional[str] = None,
|
|
359
|
+
tag: Optional[str] = None,
|
|
360
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
304
361
|
) -> mlrun.common.schemas.EntitiesOutput:
|
|
305
362
|
pass
|
|
306
363
|
|
|
307
364
|
def list_entities_v2(
|
|
308
|
-
self,
|
|
365
|
+
self,
|
|
366
|
+
project: str,
|
|
367
|
+
name: Optional[str] = None,
|
|
368
|
+
tag: Optional[str] = None,
|
|
369
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
309
370
|
) -> mlrun.common.schemas.EntitiesOutputV2:
|
|
310
371
|
pass
|
|
311
372
|
|
|
312
373
|
def list_feature_sets(
|
|
313
374
|
self,
|
|
314
375
|
project: str = "",
|
|
315
|
-
name: str = None,
|
|
316
|
-
tag: str = None,
|
|
317
|
-
state: str = None,
|
|
318
|
-
entities: list[str] = None,
|
|
319
|
-
features: list[str] = None,
|
|
320
|
-
labels: list[str] = None,
|
|
376
|
+
name: Optional[str] = None,
|
|
377
|
+
tag: Optional[str] = None,
|
|
378
|
+
state: Optional[str] = None,
|
|
379
|
+
entities: Optional[list[str]] = None,
|
|
380
|
+
features: Optional[list[str]] = None,
|
|
381
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
321
382
|
partition_by: Union[
|
|
322
383
|
mlrun.common.schemas.FeatureStorePartitionByField, str
|
|
323
384
|
] = None,
|
|
@@ -368,17 +429,21 @@ class NopDB(RunDBInterface):
|
|
|
368
429
|
pass
|
|
369
430
|
|
|
370
431
|
def get_feature_vector(
|
|
371
|
-
self,
|
|
432
|
+
self,
|
|
433
|
+
name: str,
|
|
434
|
+
project: str = "",
|
|
435
|
+
tag: Optional[str] = None,
|
|
436
|
+
uid: Optional[str] = None,
|
|
372
437
|
) -> dict:
|
|
373
438
|
pass
|
|
374
439
|
|
|
375
440
|
def list_feature_vectors(
|
|
376
441
|
self,
|
|
377
442
|
project: str = "",
|
|
378
|
-
name: str = None,
|
|
379
|
-
tag: str = None,
|
|
380
|
-
state: str = None,
|
|
381
|
-
labels: list[str] = None,
|
|
443
|
+
name: Optional[str] = None,
|
|
444
|
+
tag: Optional[str] = None,
|
|
445
|
+
state: Optional[str] = None,
|
|
446
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
382
447
|
partition_by: Union[
|
|
383
448
|
mlrun.common.schemas.FeatureStorePartitionByField, str
|
|
384
449
|
] = None,
|
|
@@ -420,26 +485,26 @@ class NopDB(RunDBInterface):
|
|
|
420
485
|
def get_pipeline(
|
|
421
486
|
self,
|
|
422
487
|
run_id: str,
|
|
423
|
-
namespace: str = None,
|
|
488
|
+
namespace: Optional[str] = None,
|
|
424
489
|
timeout: int = 30,
|
|
425
490
|
format_: Union[
|
|
426
491
|
str, mlrun.common.formatters.PipelineFormat
|
|
427
492
|
] = mlrun.common.formatters.PipelineFormat.summary,
|
|
428
|
-
project: str = None,
|
|
493
|
+
project: Optional[str] = None,
|
|
429
494
|
):
|
|
430
495
|
pass
|
|
431
496
|
|
|
432
497
|
def list_pipelines(
|
|
433
498
|
self,
|
|
434
499
|
project: str,
|
|
435
|
-
namespace: str = None,
|
|
500
|
+
namespace: Optional[str] = None,
|
|
436
501
|
sort_by: str = "",
|
|
437
502
|
page_token: str = "",
|
|
438
503
|
filter_: str = "",
|
|
439
504
|
format_: Union[
|
|
440
505
|
str, mlrun.common.formatters.PipelineFormat
|
|
441
506
|
] = mlrun.common.formatters.PipelineFormat.metadata_only,
|
|
442
|
-
page_size: int = None,
|
|
507
|
+
page_size: Optional[int] = None,
|
|
443
508
|
) -> mlrun.common.schemas.PipelinesOutput:
|
|
444
509
|
return mlrun.common.schemas.PipelinesOutput(runs=[], total_size=0)
|
|
445
510
|
|
|
@@ -449,7 +514,7 @@ class NopDB(RunDBInterface):
|
|
|
449
514
|
provider: Union[
|
|
450
515
|
str, mlrun.common.schemas.SecretProviderName
|
|
451
516
|
] = mlrun.common.schemas.SecretProviderName.kubernetes,
|
|
452
|
-
secrets: dict = None,
|
|
517
|
+
secrets: Optional[dict] = None,
|
|
453
518
|
):
|
|
454
519
|
pass
|
|
455
520
|
|
|
@@ -460,7 +525,7 @@ class NopDB(RunDBInterface):
|
|
|
460
525
|
provider: Union[
|
|
461
526
|
str, mlrun.common.schemas.SecretProviderName
|
|
462
527
|
] = mlrun.common.schemas.SecretProviderName.kubernetes,
|
|
463
|
-
secrets: list[str] = None,
|
|
528
|
+
secrets: Optional[list[str]] = None,
|
|
464
529
|
) -> mlrun.common.schemas.SecretsData:
|
|
465
530
|
pass
|
|
466
531
|
|
|
@@ -470,7 +535,7 @@ class NopDB(RunDBInterface):
|
|
|
470
535
|
provider: Union[
|
|
471
536
|
str, mlrun.common.schemas.SecretProviderName
|
|
472
537
|
] = mlrun.common.schemas.SecretProviderName.kubernetes,
|
|
473
|
-
token: str = None,
|
|
538
|
+
token: Optional[str] = None,
|
|
474
539
|
) -> mlrun.common.schemas.SecretKeysData:
|
|
475
540
|
pass
|
|
476
541
|
|
|
@@ -480,7 +545,7 @@ class NopDB(RunDBInterface):
|
|
|
480
545
|
provider: Union[
|
|
481
546
|
str, mlrun.common.schemas.SecretProviderName
|
|
482
547
|
] = mlrun.common.schemas.SecretProviderName.kubernetes,
|
|
483
|
-
secrets: list[str] = None,
|
|
548
|
+
secrets: Optional[list[str]] = None,
|
|
484
549
|
):
|
|
485
550
|
pass
|
|
486
551
|
|
|
@@ -490,7 +555,7 @@ class NopDB(RunDBInterface):
|
|
|
490
555
|
provider: Union[
|
|
491
556
|
str, mlrun.common.schemas.SecretProviderName
|
|
492
557
|
] = mlrun.common.schemas.SecretProviderName.vault,
|
|
493
|
-
secrets: dict = None,
|
|
558
|
+
secrets: Optional[dict] = None,
|
|
494
559
|
):
|
|
495
560
|
pass
|
|
496
561
|
|
|
@@ -510,7 +575,7 @@ class NopDB(RunDBInterface):
|
|
|
510
575
|
project: str,
|
|
511
576
|
model: Optional[str] = None,
|
|
512
577
|
function: Optional[str] = None,
|
|
513
|
-
labels: list[str] = None,
|
|
578
|
+
labels: Optional[Union[str, dict[str, Optional[str]], list[str]]] = None,
|
|
514
579
|
start: str = "now-1h",
|
|
515
580
|
end: str = "now",
|
|
516
581
|
metrics: Optional[list[str]] = None,
|
|
@@ -560,9 +625,9 @@ class NopDB(RunDBInterface):
|
|
|
560
625
|
def get_hub_catalog(
|
|
561
626
|
self,
|
|
562
627
|
source_name: str,
|
|
563
|
-
channel: str = None,
|
|
564
|
-
version: str = None,
|
|
565
|
-
tag: str = None,
|
|
628
|
+
channel: Optional[str] = None,
|
|
629
|
+
version: Optional[str] = None,
|
|
630
|
+
tag: Optional[str] = None,
|
|
566
631
|
force_refresh: bool = False,
|
|
567
632
|
):
|
|
568
633
|
pass
|
|
@@ -572,7 +637,7 @@ class NopDB(RunDBInterface):
|
|
|
572
637
|
source_name: str,
|
|
573
638
|
item_name: str,
|
|
574
639
|
channel: str = "development",
|
|
575
|
-
version: str = None,
|
|
640
|
+
version: Optional[str] = None,
|
|
576
641
|
tag: str = "latest",
|
|
577
642
|
force_refresh: bool = False,
|
|
578
643
|
):
|
|
@@ -584,7 +649,7 @@ class NopDB(RunDBInterface):
|
|
|
584
649
|
mlrun.common.schemas.APIGateway,
|
|
585
650
|
mlrun.runtimes.nuclio.api_gateway.APIGateway,
|
|
586
651
|
],
|
|
587
|
-
project: str = None,
|
|
652
|
+
project: Optional[str] = None,
|
|
588
653
|
) -> mlrun.common.schemas.APIGateway:
|
|
589
654
|
pass
|
|
590
655
|
|
|
@@ -628,6 +693,7 @@ class NopDB(RunDBInterface):
|
|
|
628
693
|
logs: bool = True,
|
|
629
694
|
last_log_timestamp: float = 0.0,
|
|
630
695
|
verbose: bool = False,
|
|
696
|
+
events_offset: int = 0,
|
|
631
697
|
):
|
|
632
698
|
pass
|
|
633
699
|
|
|
@@ -651,7 +717,7 @@ class NopDB(RunDBInterface):
|
|
|
651
717
|
self,
|
|
652
718
|
notification_objects: list[mlrun.model.Notification],
|
|
653
719
|
run_uid: str,
|
|
654
|
-
project: str = None,
|
|
720
|
+
project: Optional[str] = None,
|
|
655
721
|
mask_params: bool = True,
|
|
656
722
|
):
|
|
657
723
|
pass
|
|
@@ -694,7 +760,9 @@ class NopDB(RunDBInterface):
|
|
|
694
760
|
pass
|
|
695
761
|
|
|
696
762
|
def start_function(
|
|
697
|
-
self,
|
|
763
|
+
self,
|
|
764
|
+
func_url: Optional[str] = None,
|
|
765
|
+
function: "mlrun.runtimes.BaseRuntime" = None,
|
|
698
766
|
):
|
|
699
767
|
pass
|
|
700
768
|
|
|
@@ -712,7 +780,7 @@ class NopDB(RunDBInterface):
|
|
|
712
780
|
source: Optional[str] = None,
|
|
713
781
|
run_name: Optional[str] = None,
|
|
714
782
|
namespace: Optional[str] = None,
|
|
715
|
-
notifications: list["mlrun.model.Notification"] = None,
|
|
783
|
+
notifications: Optional[list["mlrun.model.Notification"]] = None,
|
|
716
784
|
) -> "mlrun.common.schemas.WorkflowResponse":
|
|
717
785
|
pass
|
|
718
786
|
|
|
@@ -742,7 +810,7 @@ class NopDB(RunDBInterface):
|
|
|
742
810
|
delete_stream_function: bool = False,
|
|
743
811
|
delete_histogram_data_drift_app: bool = True,
|
|
744
812
|
delete_user_applications: bool = False,
|
|
745
|
-
user_application_list: list[str] = None,
|
|
813
|
+
user_application_list: Optional[list[str]] = None,
|
|
746
814
|
) -> bool:
|
|
747
815
|
pass
|
|
748
816
|
|
|
@@ -774,6 +842,7 @@ class NopDB(RunDBInterface):
|
|
|
774
842
|
alert_name: str,
|
|
775
843
|
alert_data: Union[dict, mlrun.alerts.alert.AlertConfig],
|
|
776
844
|
project="",
|
|
845
|
+
force_reset: bool = False,
|
|
777
846
|
):
|
|
778
847
|
pass
|
|
779
848
|
|
mlrun/errors.py
CHANGED
|
@@ -86,7 +86,7 @@ def raise_for_status(
|
|
|
86
86
|
requests.Response,
|
|
87
87
|
aiohttp.ClientResponse,
|
|
88
88
|
],
|
|
89
|
-
message: str = None,
|
|
89
|
+
message: typing.Optional[str] = None,
|
|
90
90
|
):
|
|
91
91
|
"""
|
|
92
92
|
Raise a specific MLRunSDK error depending on the given response status code.
|
|
@@ -107,7 +107,7 @@ def raise_for_status(
|
|
|
107
107
|
raise MLRunHTTPError(error_message, response=response) from exc
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
def err_for_status_code(status_code: int, message: str = None):
|
|
110
|
+
def err_for_status_code(status_code: int, message: typing.Optional[str] = None):
|
|
111
111
|
"""
|
|
112
112
|
Return a specific MLRunSDK error depending on the given response status code.
|
|
113
113
|
If no specific error exists, returns an MLRunHTTPError.
|
mlrun/execution.py
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
import os
|
|
17
17
|
import uuid
|
|
18
|
+
import warnings
|
|
18
19
|
from copy import deepcopy
|
|
19
|
-
from typing import Union
|
|
20
|
+
from typing import Optional, Union
|
|
20
21
|
|
|
21
22
|
import numpy as np
|
|
22
23
|
import yaml
|
|
@@ -25,11 +26,10 @@ from dateutil import parser
|
|
|
25
26
|
import mlrun
|
|
26
27
|
import mlrun.common.constants as mlrun_constants
|
|
27
28
|
import mlrun.common.formatters
|
|
28
|
-
from mlrun.artifacts import ModelArtifact
|
|
29
|
+
from mlrun.artifacts import Artifact, DatasetArtifact, ModelArtifact
|
|
29
30
|
from mlrun.datastore.store_resources import get_store_resource
|
|
30
31
|
from mlrun.errors import MLRunInvalidArgumentError
|
|
31
32
|
|
|
32
|
-
from .artifacts import DatasetArtifact
|
|
33
33
|
from .artifacts.manager import ArtifactManager, dict_to_artifact, extend_artifact_path
|
|
34
34
|
from .datastore import store_manager
|
|
35
35
|
from .features import Feature
|
|
@@ -194,6 +194,11 @@ class MLClientCtx:
|
|
|
194
194
|
"""Dictionary of artifacts (read-only)"""
|
|
195
195
|
return deepcopy(self._artifacts_manager.artifact_list())
|
|
196
196
|
|
|
197
|
+
@property
|
|
198
|
+
def artifact_uris(self):
|
|
199
|
+
"""Dictionary of artifact URIs (read-only)"""
|
|
200
|
+
return deepcopy(self._artifacts_manager.artifact_uris)
|
|
201
|
+
|
|
197
202
|
@property
|
|
198
203
|
def in_path(self):
|
|
199
204
|
"""Default input path for data objects"""
|
|
@@ -296,7 +301,7 @@ class MLClientCtx:
|
|
|
296
301
|
)
|
|
297
302
|
self._parent.log_iteration_results(self._iteration, None, self.to_dict())
|
|
298
303
|
|
|
299
|
-
def get_store_resource(self, url, secrets: dict = None):
|
|
304
|
+
def get_store_resource(self, url, secrets: Optional[dict] = None):
|
|
300
305
|
"""Get mlrun data resource (feature set/vector, artifact, item) from url.
|
|
301
306
|
|
|
302
307
|
Example::
|
|
@@ -317,7 +322,7 @@ class MLClientCtx:
|
|
|
317
322
|
data_store_secrets=secrets,
|
|
318
323
|
)
|
|
319
324
|
|
|
320
|
-
def get_dataitem(self, url, secrets: dict = None):
|
|
325
|
+
def get_dataitem(self, url, secrets: Optional[dict] = None):
|
|
321
326
|
"""Get mlrun dataitem from url
|
|
322
327
|
|
|
323
328
|
Example::
|
|
@@ -425,8 +430,11 @@ class MLClientCtx:
|
|
|
425
430
|
self._results = status.get("results", self._results)
|
|
426
431
|
for artifact in status.get("artifacts", []):
|
|
427
432
|
artifact_obj = dict_to_artifact(artifact)
|
|
428
|
-
key =
|
|
429
|
-
|
|
433
|
+
self._artifacts_manager.artifact_uris[artifact_obj.key] = (
|
|
434
|
+
artifact_obj.uri
|
|
435
|
+
)
|
|
436
|
+
for key, uri in status.get("artifact_uris", {}).items():
|
|
437
|
+
self._artifacts_manager.artifact_uris[key] = uri
|
|
430
438
|
self._state = status.get("state", self._state)
|
|
431
439
|
|
|
432
440
|
# No need to store the run for every worker
|
|
@@ -573,22 +581,25 @@ class MLClientCtx:
|
|
|
573
581
|
"""Reserved for internal use"""
|
|
574
582
|
|
|
575
583
|
if best:
|
|
584
|
+
# Recreate the best iteration context for the interface of getting its artifacts
|
|
585
|
+
best_context = MLClientCtx.from_dict(
|
|
586
|
+
task, store_run=False, include_status=True
|
|
587
|
+
)
|
|
576
588
|
self._results["best_iteration"] = best
|
|
577
|
-
for
|
|
578
|
-
self._results[
|
|
579
|
-
for
|
|
580
|
-
self._artifacts_manager.
|
|
581
|
-
|
|
582
|
-
)
|
|
589
|
+
for key, result in best_context.results.items():
|
|
590
|
+
self._results[key] = result
|
|
591
|
+
for key, artifact_uri in best_context.artifact_uris.items():
|
|
592
|
+
self._artifacts_manager.artifact_uris[key] = artifact_uri
|
|
593
|
+
artifact = best_context.get_artifact(key)
|
|
583
594
|
self._artifacts_manager.link_artifact(
|
|
584
595
|
self.project,
|
|
585
596
|
self.name,
|
|
586
597
|
self.tag,
|
|
587
|
-
|
|
598
|
+
key,
|
|
588
599
|
self.iteration,
|
|
589
|
-
artifact
|
|
600
|
+
artifact.target_path,
|
|
601
|
+
db_key=artifact.db_key,
|
|
590
602
|
link_iteration=best,
|
|
591
|
-
db_key=artifact["spec"]["db_key"],
|
|
592
603
|
)
|
|
593
604
|
|
|
594
605
|
if summary is not None:
|
|
@@ -679,7 +690,7 @@ class MLClientCtx:
|
|
|
679
690
|
db_key=None,
|
|
680
691
|
target_path="",
|
|
681
692
|
extra_data=None,
|
|
682
|
-
label_column: str = None,
|
|
693
|
+
label_column: Optional[str] = None,
|
|
683
694
|
**kwargs,
|
|
684
695
|
):
|
|
685
696
|
"""Log a dataset artifact and optionally upload it to datastore
|
|
@@ -760,12 +771,12 @@ class MLClientCtx:
|
|
|
760
771
|
artifact_path=None,
|
|
761
772
|
upload=True,
|
|
762
773
|
labels=None,
|
|
763
|
-
inputs: list[Feature] = None,
|
|
764
|
-
outputs: list[Feature] = None,
|
|
765
|
-
feature_vector: str = None,
|
|
766
|
-
feature_weights: list = None,
|
|
774
|
+
inputs: Optional[list[Feature]] = None,
|
|
775
|
+
outputs: Optional[list[Feature]] = None,
|
|
776
|
+
feature_vector: Optional[str] = None,
|
|
777
|
+
feature_weights: Optional[list] = None,
|
|
767
778
|
training_set=None,
|
|
768
|
-
label_column: Union[str, list] = None,
|
|
779
|
+
label_column: Optional[Union[str, list]] = None,
|
|
769
780
|
extra_data=None,
|
|
770
781
|
db_key=None,
|
|
771
782
|
**kwargs,
|
|
@@ -788,7 +799,7 @@ class MLClientCtx:
|
|
|
788
799
|
:param key: Artifact key or artifact class ()
|
|
789
800
|
:param body: Will use the body as the artifact content
|
|
790
801
|
:param model_file: Path to the local model file we upload (see also model_dir)
|
|
791
|
-
or to a model file data url (e.g. http://host/path/model.pkl)
|
|
802
|
+
or to a model file data url (e.g. `http://host/path/model.pkl`)
|
|
792
803
|
:param model_dir: Path to the local dir holding the model file and extra files
|
|
793
804
|
:param artifact_path: Target artifact path (when not using the default)
|
|
794
805
|
to define a subpath under the default location use:
|
|
@@ -852,10 +863,18 @@ class MLClientCtx:
|
|
|
852
863
|
|
|
853
864
|
def get_cached_artifact(self, key):
|
|
854
865
|
"""Return a logged artifact from cache (for potential updates)"""
|
|
855
|
-
|
|
866
|
+
warnings.warn(
|
|
867
|
+
"get_cached_artifact is deprecated in 1.8.0 and will be removed in 1.10.0. Use get_artifact instead.",
|
|
868
|
+
FutureWarning,
|
|
869
|
+
)
|
|
870
|
+
return self.get_artifact(key)
|
|
871
|
+
|
|
872
|
+
def get_artifact(self, key: str) -> Artifact:
|
|
873
|
+
artifact_uri = self._artifacts_manager.artifact_uris[key]
|
|
874
|
+
return self.get_store_resource(artifact_uri)
|
|
856
875
|
|
|
857
|
-
def update_artifact(self, artifact_object):
|
|
858
|
-
"""Update an artifact object in the
|
|
876
|
+
def update_artifact(self, artifact_object: Artifact):
|
|
877
|
+
"""Update an artifact object in the DB and the cached uri"""
|
|
859
878
|
self._artifacts_manager.update_artifact(self, artifact_object)
|
|
860
879
|
|
|
861
880
|
def commit(self, message: str = "", completed=False):
|
|
@@ -885,7 +904,12 @@ class MLClientCtx:
|
|
|
885
904
|
if completed and not self.iteration:
|
|
886
905
|
mlrun.runtimes.utils.global_context.set(None)
|
|
887
906
|
|
|
888
|
-
def set_state(
|
|
907
|
+
def set_state(
|
|
908
|
+
self,
|
|
909
|
+
execution_state: Optional[str] = None,
|
|
910
|
+
error: Optional[str] = None,
|
|
911
|
+
commit=True,
|
|
912
|
+
):
|
|
889
913
|
"""
|
|
890
914
|
Modify and store the execution state or mark an error and update the run state accordingly.
|
|
891
915
|
This method allows to set the run state to 'completed' in the DB which is discouraged.
|
|
@@ -1013,7 +1037,7 @@ class MLClientCtx:
|
|
|
1013
1037
|
set_if_not_none(struct["status"], "commit", self._commit)
|
|
1014
1038
|
set_if_not_none(struct["status"], "iterations", self._iteration_results)
|
|
1015
1039
|
|
|
1016
|
-
struct["status"][RunKeys.
|
|
1040
|
+
struct["status"][RunKeys.artifact_uris] = self._artifacts_manager.artifact_uris
|
|
1017
1041
|
self._data_stores.to_dict(struct["spec"])
|
|
1018
1042
|
return struct
|
|
1019
1043
|
|
|
@@ -1107,7 +1131,9 @@ class MLClientCtx:
|
|
|
1107
1131
|
set_if_not_none(struct, "status.commit", self._commit)
|
|
1108
1132
|
set_if_not_none(struct, "status.iterations", self._iteration_results)
|
|
1109
1133
|
|
|
1110
|
-
struct[f"status.{RunKeys.
|
|
1134
|
+
struct[f"status.{RunKeys.artifact_uris}"] = (
|
|
1135
|
+
self._artifacts_manager.artifact_uris
|
|
1136
|
+
)
|
|
1111
1137
|
return struct
|
|
1112
1138
|
|
|
1113
1139
|
def _init_dbs(self, rundb):
|