databricks-sdk 0.0.7__py3-none-any.whl → 0.1.1__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 databricks-sdk might be problematic. Click here for more details.
- databricks/sdk/__init__.py +121 -104
- databricks/sdk/core.py +76 -16
- databricks/sdk/dbutils.py +18 -17
- databricks/sdk/mixins/compute.py +6 -6
- databricks/sdk/mixins/dbfs.py +6 -6
- databricks/sdk/oauth.py +28 -14
- databricks/sdk/service/{unitycatalog.py → catalog.py} +375 -1146
- databricks/sdk/service/{clusters.py → compute.py} +2176 -61
- databricks/sdk/service/{dbfs.py → files.py} +6 -6
- databricks/sdk/service/{scim.py → iam.py} +567 -27
- databricks/sdk/service/jobs.py +44 -34
- databricks/sdk/service/{mlflow.py → ml.py} +976 -1071
- databricks/sdk/service/oauth2.py +3 -3
- databricks/sdk/service/pipelines.py +46 -30
- databricks/sdk/service/{deployment.py → provisioning.py} +47 -29
- databricks/sdk/service/settings.py +849 -0
- databricks/sdk/service/sharing.py +1176 -0
- databricks/sdk/service/sql.py +15 -15
- databricks/sdk/service/workspace.py +917 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/METADATA +3 -1
- databricks_sdk-0.1.1.dist-info/RECORD +37 -0
- databricks/sdk/service/clusterpolicies.py +0 -399
- databricks/sdk/service/commands.py +0 -478
- databricks/sdk/service/gitcredentials.py +0 -202
- databricks/sdk/service/globalinitscripts.py +0 -262
- databricks/sdk/service/instancepools.py +0 -757
- databricks/sdk/service/ipaccesslists.py +0 -340
- databricks/sdk/service/libraries.py +0 -282
- databricks/sdk/service/permissions.py +0 -470
- databricks/sdk/service/repos.py +0 -250
- databricks/sdk/service/secrets.py +0 -472
- databricks/sdk/service/tokenmanagement.py +0 -182
- databricks/sdk/service/tokens.py +0 -137
- databricks/sdk/service/workspaceconf.py +0 -50
- databricks_sdk-0.0.7.dist-info/RECORD +0 -48
- /databricks/sdk/service/{endpoints.py → serving.py} +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -72,20 +72,6 @@ class ActivityType(Enum):
|
|
|
72
72
|
SYSTEM_TRANSITION = 'SYSTEM_TRANSITION'
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
@dataclass
|
|
76
|
-
class ApproveResponse:
|
|
77
|
-
activity: 'Activity' = None
|
|
78
|
-
|
|
79
|
-
def as_dict(self) -> dict:
|
|
80
|
-
body = {}
|
|
81
|
-
if self.activity: body['activity'] = self.activity.as_dict()
|
|
82
|
-
return body
|
|
83
|
-
|
|
84
|
-
@classmethod
|
|
85
|
-
def from_dict(cls, d: Dict[str, any]) -> 'ApproveResponse':
|
|
86
|
-
return cls(activity=_from_dict(d, 'activity', Activity))
|
|
87
|
-
|
|
88
|
-
|
|
89
75
|
@dataclass
|
|
90
76
|
class ApproveTransitionRequest:
|
|
91
77
|
name: str
|
|
@@ -112,6 +98,20 @@ class ApproveTransitionRequest:
|
|
|
112
98
|
version=d.get('version', None))
|
|
113
99
|
|
|
114
100
|
|
|
101
|
+
@dataclass
|
|
102
|
+
class ApproveTransitionRequestResponse:
|
|
103
|
+
activity: 'Activity' = None
|
|
104
|
+
|
|
105
|
+
def as_dict(self) -> dict:
|
|
106
|
+
body = {}
|
|
107
|
+
if self.activity: body['activity'] = self.activity.as_dict()
|
|
108
|
+
return body
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ApproveTransitionRequestResponse':
|
|
112
|
+
return cls(activity=_from_dict(d, 'activity', Activity))
|
|
113
|
+
|
|
114
|
+
|
|
115
115
|
class CommentActivityAction(Enum):
|
|
116
116
|
"""This describes an enum"""
|
|
117
117
|
|
|
@@ -126,6 +126,7 @@ class CommentObject:
|
|
|
126
126
|
available_actions: 'List[CommentActivityAction]' = None
|
|
127
127
|
comment: str = None
|
|
128
128
|
creation_timestamp: int = None
|
|
129
|
+
id: str = None
|
|
129
130
|
last_updated_timestamp: int = None
|
|
130
131
|
user_id: str = None
|
|
131
132
|
|
|
@@ -134,6 +135,7 @@ class CommentObject:
|
|
|
134
135
|
if self.available_actions: body['available_actions'] = [v for v in self.available_actions]
|
|
135
136
|
if self.comment: body['comment'] = self.comment
|
|
136
137
|
if self.creation_timestamp: body['creation_timestamp'] = self.creation_timestamp
|
|
138
|
+
if self.id: body['id'] = self.id
|
|
137
139
|
if self.last_updated_timestamp: body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
138
140
|
if self.user_id: body['user_id'] = self.user_id
|
|
139
141
|
return body
|
|
@@ -143,6 +145,7 @@ class CommentObject:
|
|
|
143
145
|
return cls(available_actions=d.get('available_actions', None),
|
|
144
146
|
comment=d.get('comment', None),
|
|
145
147
|
creation_timestamp=d.get('creation_timestamp', None),
|
|
148
|
+
id=d.get('id', None),
|
|
146
149
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
147
150
|
user_id=d.get('user_id', None))
|
|
148
151
|
|
|
@@ -165,6 +168,20 @@ class CreateComment:
|
|
|
165
168
|
return cls(comment=d.get('comment', None), name=d.get('name', None), version=d.get('version', None))
|
|
166
169
|
|
|
167
170
|
|
|
171
|
+
@dataclass
|
|
172
|
+
class CreateCommentResponse:
|
|
173
|
+
comment: 'CommentObject' = None
|
|
174
|
+
|
|
175
|
+
def as_dict(self) -> dict:
|
|
176
|
+
body = {}
|
|
177
|
+
if self.comment: body['comment'] = self.comment.as_dict()
|
|
178
|
+
return body
|
|
179
|
+
|
|
180
|
+
@classmethod
|
|
181
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateCommentResponse':
|
|
182
|
+
return cls(comment=_from_dict(d, 'comment', CommentObject))
|
|
183
|
+
|
|
184
|
+
|
|
168
185
|
@dataclass
|
|
169
186
|
class CreateExperiment:
|
|
170
187
|
name: str
|
|
@@ -200,80 +217,80 @@ class CreateExperimentResponse:
|
|
|
200
217
|
|
|
201
218
|
|
|
202
219
|
@dataclass
|
|
203
|
-
class
|
|
220
|
+
class CreateModelRequest:
|
|
204
221
|
name: str
|
|
205
|
-
source: str
|
|
206
222
|
description: str = None
|
|
207
|
-
|
|
208
|
-
run_link: str = None
|
|
209
|
-
tags: 'List[ModelVersionTag]' = None
|
|
223
|
+
tags: 'List[ModelTag]' = None
|
|
210
224
|
|
|
211
225
|
def as_dict(self) -> dict:
|
|
212
226
|
body = {}
|
|
213
227
|
if self.description: body['description'] = self.description
|
|
214
228
|
if self.name: body['name'] = self.name
|
|
215
|
-
if self.run_id: body['run_id'] = self.run_id
|
|
216
|
-
if self.run_link: body['run_link'] = self.run_link
|
|
217
|
-
if self.source: body['source'] = self.source
|
|
218
229
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
219
230
|
return body
|
|
220
231
|
|
|
221
232
|
@classmethod
|
|
222
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
233
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateModelRequest':
|
|
223
234
|
return cls(description=d.get('description', None),
|
|
224
235
|
name=d.get('name', None),
|
|
225
|
-
|
|
226
|
-
run_link=d.get('run_link', None),
|
|
227
|
-
source=d.get('source', None),
|
|
228
|
-
tags=_repeated(d, 'tags', ModelVersionTag))
|
|
236
|
+
tags=_repeated(d, 'tags', ModelTag))
|
|
229
237
|
|
|
230
238
|
|
|
231
239
|
@dataclass
|
|
232
|
-
class
|
|
233
|
-
|
|
240
|
+
class CreateModelResponse:
|
|
241
|
+
registered_model: 'Model' = None
|
|
234
242
|
|
|
235
243
|
def as_dict(self) -> dict:
|
|
236
244
|
body = {}
|
|
237
|
-
if self.
|
|
245
|
+
if self.registered_model: body['registered_model'] = self.registered_model.as_dict()
|
|
238
246
|
return body
|
|
239
247
|
|
|
240
248
|
@classmethod
|
|
241
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
242
|
-
return cls(
|
|
249
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateModelResponse':
|
|
250
|
+
return cls(registered_model=_from_dict(d, 'registered_model', Model))
|
|
243
251
|
|
|
244
252
|
|
|
245
253
|
@dataclass
|
|
246
|
-
class
|
|
254
|
+
class CreateModelVersionRequest:
|
|
247
255
|
name: str
|
|
256
|
+
source: str
|
|
248
257
|
description: str = None
|
|
249
|
-
|
|
258
|
+
run_id: str = None
|
|
259
|
+
run_link: str = None
|
|
260
|
+
tags: 'List[ModelVersionTag]' = None
|
|
250
261
|
|
|
251
262
|
def as_dict(self) -> dict:
|
|
252
263
|
body = {}
|
|
253
264
|
if self.description: body['description'] = self.description
|
|
254
265
|
if self.name: body['name'] = self.name
|
|
266
|
+
if self.run_id: body['run_id'] = self.run_id
|
|
267
|
+
if self.run_link: body['run_link'] = self.run_link
|
|
268
|
+
if self.source: body['source'] = self.source
|
|
255
269
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
256
270
|
return body
|
|
257
271
|
|
|
258
272
|
@classmethod
|
|
259
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
273
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateModelVersionRequest':
|
|
260
274
|
return cls(description=d.get('description', None),
|
|
261
275
|
name=d.get('name', None),
|
|
262
|
-
|
|
276
|
+
run_id=d.get('run_id', None),
|
|
277
|
+
run_link=d.get('run_link', None),
|
|
278
|
+
source=d.get('source', None),
|
|
279
|
+
tags=_repeated(d, 'tags', ModelVersionTag))
|
|
263
280
|
|
|
264
281
|
|
|
265
282
|
@dataclass
|
|
266
|
-
class
|
|
267
|
-
|
|
283
|
+
class CreateModelVersionResponse:
|
|
284
|
+
model_version: 'ModelVersion' = None
|
|
268
285
|
|
|
269
286
|
def as_dict(self) -> dict:
|
|
270
287
|
body = {}
|
|
271
|
-
if self.
|
|
288
|
+
if self.model_version: body['model_version'] = self.model_version.as_dict()
|
|
272
289
|
return body
|
|
273
290
|
|
|
274
291
|
@classmethod
|
|
275
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
276
|
-
return cls(
|
|
292
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateModelVersionResponse':
|
|
293
|
+
return cls(model_version=_from_dict(d, 'model_version', ModelVersion))
|
|
277
294
|
|
|
278
295
|
|
|
279
296
|
@dataclass
|
|
@@ -305,20 +322,6 @@ class CreateRegistryWebhook:
|
|
|
305
322
|
status=_enum(d, 'status', RegistryWebhookStatus))
|
|
306
323
|
|
|
307
324
|
|
|
308
|
-
@dataclass
|
|
309
|
-
class CreateResponse:
|
|
310
|
-
comment: 'CommentObject' = None
|
|
311
|
-
|
|
312
|
-
def as_dict(self) -> dict:
|
|
313
|
-
body = {}
|
|
314
|
-
if self.comment: body['comment'] = self.comment.as_dict()
|
|
315
|
-
return body
|
|
316
|
-
|
|
317
|
-
@classmethod
|
|
318
|
-
def from_dict(cls, d: Dict[str, any]) -> 'CreateResponse':
|
|
319
|
-
return cls(comment=_from_dict(d, 'comment', CommentObject))
|
|
320
|
-
|
|
321
|
-
|
|
322
325
|
@dataclass
|
|
323
326
|
class CreateRun:
|
|
324
327
|
experiment_id: str = None
|
|
@@ -380,52 +383,63 @@ class CreateTransitionRequest:
|
|
|
380
383
|
|
|
381
384
|
|
|
382
385
|
@dataclass
|
|
383
|
-
class
|
|
384
|
-
|
|
386
|
+
class CreateTransitionRequestResponse:
|
|
387
|
+
request: 'TransitionRequest' = None
|
|
385
388
|
|
|
386
389
|
def as_dict(self) -> dict:
|
|
387
390
|
body = {}
|
|
388
|
-
if self.
|
|
391
|
+
if self.request: body['request'] = self.request.as_dict()
|
|
389
392
|
return body
|
|
390
393
|
|
|
391
394
|
@classmethod
|
|
392
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
393
|
-
return cls(
|
|
395
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateTransitionRequestResponse':
|
|
396
|
+
return cls(request=_from_dict(d, 'request', TransitionRequest))
|
|
394
397
|
|
|
395
398
|
|
|
396
399
|
@dataclass
|
|
397
|
-
class
|
|
398
|
-
|
|
400
|
+
class CreateWebhookResponse:
|
|
401
|
+
webhook: 'RegistryWebhook' = None
|
|
399
402
|
|
|
400
|
-
|
|
403
|
+
def as_dict(self) -> dict:
|
|
404
|
+
body = {}
|
|
405
|
+
if self.webhook: body['webhook'] = self.webhook.as_dict()
|
|
406
|
+
return body
|
|
407
|
+
|
|
408
|
+
@classmethod
|
|
409
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateWebhookResponse':
|
|
410
|
+
return cls(webhook=_from_dict(d, 'webhook', RegistryWebhook))
|
|
401
411
|
|
|
402
412
|
|
|
403
413
|
@dataclass
|
|
404
|
-
class
|
|
405
|
-
"""Delete a
|
|
414
|
+
class DeleteCommentRequest:
|
|
415
|
+
"""Delete a comment"""
|
|
406
416
|
|
|
407
|
-
|
|
408
|
-
version: str
|
|
417
|
+
id: str
|
|
409
418
|
|
|
410
419
|
|
|
411
420
|
@dataclass
|
|
412
|
-
class
|
|
413
|
-
|
|
421
|
+
class DeleteExperiment:
|
|
422
|
+
experiment_id: str
|
|
414
423
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
424
|
+
def as_dict(self) -> dict:
|
|
425
|
+
body = {}
|
|
426
|
+
if self.experiment_id: body['experiment_id'] = self.experiment_id
|
|
427
|
+
return body
|
|
428
|
+
|
|
429
|
+
@classmethod
|
|
430
|
+
def from_dict(cls, d: Dict[str, any]) -> 'DeleteExperiment':
|
|
431
|
+
return cls(experiment_id=d.get('experiment_id', None))
|
|
418
432
|
|
|
419
433
|
|
|
420
434
|
@dataclass
|
|
421
|
-
class
|
|
435
|
+
class DeleteModelRequest:
|
|
422
436
|
"""Delete a model"""
|
|
423
437
|
|
|
424
438
|
name: str
|
|
425
439
|
|
|
426
440
|
|
|
427
441
|
@dataclass
|
|
428
|
-
class
|
|
442
|
+
class DeleteModelTagRequest:
|
|
429
443
|
"""Delete a model tag"""
|
|
430
444
|
|
|
431
445
|
name: str
|
|
@@ -433,10 +447,20 @@ class DeleteRegisteredModelTagRequest:
|
|
|
433
447
|
|
|
434
448
|
|
|
435
449
|
@dataclass
|
|
436
|
-
class
|
|
437
|
-
"""Delete a
|
|
450
|
+
class DeleteModelVersionRequest:
|
|
451
|
+
"""Delete a model version."""
|
|
438
452
|
|
|
439
|
-
|
|
453
|
+
name: str
|
|
454
|
+
version: str
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
@dataclass
|
|
458
|
+
class DeleteModelVersionTagRequest:
|
|
459
|
+
"""Delete a model version tag"""
|
|
460
|
+
|
|
461
|
+
name: str
|
|
462
|
+
version: str
|
|
463
|
+
key: str
|
|
440
464
|
|
|
441
465
|
|
|
442
466
|
@dataclass
|
|
@@ -480,6 +504,13 @@ class DeleteTransitionRequestRequest:
|
|
|
480
504
|
comment: str = None
|
|
481
505
|
|
|
482
506
|
|
|
507
|
+
@dataclass
|
|
508
|
+
class DeleteWebhookRequest:
|
|
509
|
+
"""Delete a webhook"""
|
|
510
|
+
|
|
511
|
+
id: str = None
|
|
512
|
+
|
|
513
|
+
|
|
483
514
|
@dataclass
|
|
484
515
|
class Experiment:
|
|
485
516
|
artifact_location: str = None
|
|
@@ -615,13 +646,6 @@ class GetLatestVersionsResponse:
|
|
|
615
646
|
return cls(model_versions=_repeated(d, 'model_versions', ModelVersion))
|
|
616
647
|
|
|
617
648
|
|
|
618
|
-
@dataclass
|
|
619
|
-
class GetMLflowDatabrickRequest:
|
|
620
|
-
"""Get model"""
|
|
621
|
-
|
|
622
|
-
name: str
|
|
623
|
-
|
|
624
|
-
|
|
625
649
|
@dataclass
|
|
626
650
|
class GetMetricHistoryResponse:
|
|
627
651
|
metrics: 'List[Metric]' = None
|
|
@@ -638,6 +662,27 @@ class GetMetricHistoryResponse:
|
|
|
638
662
|
return cls(metrics=_repeated(d, 'metrics', Metric), next_page_token=d.get('next_page_token', None))
|
|
639
663
|
|
|
640
664
|
|
|
665
|
+
@dataclass
|
|
666
|
+
class GetModelRequest:
|
|
667
|
+
"""Get model"""
|
|
668
|
+
|
|
669
|
+
name: str
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
@dataclass
|
|
673
|
+
class GetModelResponse:
|
|
674
|
+
registered_model: 'ModelDatabricks' = None
|
|
675
|
+
|
|
676
|
+
def as_dict(self) -> dict:
|
|
677
|
+
body = {}
|
|
678
|
+
if self.registered_model: body['registered_model'] = self.registered_model.as_dict()
|
|
679
|
+
return body
|
|
680
|
+
|
|
681
|
+
@classmethod
|
|
682
|
+
def from_dict(cls, d: Dict[str, any]) -> 'GetModelResponse':
|
|
683
|
+
return cls(registered_model=_from_dict(d, 'registered_model', ModelDatabricks))
|
|
684
|
+
|
|
685
|
+
|
|
641
686
|
@dataclass
|
|
642
687
|
class GetModelVersionDownloadUriRequest:
|
|
643
688
|
"""Get a model version URI"""
|
|
@@ -682,41 +727,6 @@ class GetModelVersionResponse:
|
|
|
682
727
|
return cls(model_version=_from_dict(d, 'model_version', ModelVersion))
|
|
683
728
|
|
|
684
729
|
|
|
685
|
-
@dataclass
|
|
686
|
-
class GetRegisteredModelRequest:
|
|
687
|
-
"""Get a model"""
|
|
688
|
-
|
|
689
|
-
name: str
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
@dataclass
|
|
693
|
-
class GetRegisteredModelResponse:
|
|
694
|
-
registered_model: 'RegisteredModel' = None
|
|
695
|
-
|
|
696
|
-
def as_dict(self) -> dict:
|
|
697
|
-
body = {}
|
|
698
|
-
if self.registered_model: body['registered_model'] = self.registered_model.as_dict()
|
|
699
|
-
return body
|
|
700
|
-
|
|
701
|
-
@classmethod
|
|
702
|
-
def from_dict(cls, d: Dict[str, any]) -> 'GetRegisteredModelResponse':
|
|
703
|
-
return cls(registered_model=_from_dict(d, 'registered_model', RegisteredModel))
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
@dataclass
|
|
707
|
-
class GetResponse:
|
|
708
|
-
registered_model: 'RegisteredModelDatabricks' = None
|
|
709
|
-
|
|
710
|
-
def as_dict(self) -> dict:
|
|
711
|
-
body = {}
|
|
712
|
-
if self.registered_model: body['registered_model'] = self.registered_model.as_dict()
|
|
713
|
-
return body
|
|
714
|
-
|
|
715
|
-
@classmethod
|
|
716
|
-
def from_dict(cls, d: Dict[str, any]) -> 'GetResponse':
|
|
717
|
-
return cls(registered_model=_from_dict(d, 'registered_model', RegisteredModelDatabricks))
|
|
718
|
-
|
|
719
|
-
|
|
720
730
|
@dataclass
|
|
721
731
|
class GetRunRequest:
|
|
722
732
|
"""Get a run"""
|
|
@@ -871,7 +881,7 @@ class ListExperimentsResponse:
|
|
|
871
881
|
|
|
872
882
|
|
|
873
883
|
@dataclass
|
|
874
|
-
class
|
|
884
|
+
class ListModelsRequest:
|
|
875
885
|
"""List models"""
|
|
876
886
|
|
|
877
887
|
max_results: int = None
|
|
@@ -879,9 +889,9 @@ class ListRegisteredModelsRequest:
|
|
|
879
889
|
|
|
880
890
|
|
|
881
891
|
@dataclass
|
|
882
|
-
class
|
|
892
|
+
class ListModelsResponse:
|
|
883
893
|
next_page_token: str = None
|
|
884
|
-
registered_models: 'List[
|
|
894
|
+
registered_models: 'List[Model]' = None
|
|
885
895
|
|
|
886
896
|
def as_dict(self) -> dict:
|
|
887
897
|
body = {}
|
|
@@ -890,9 +900,9 @@ class ListRegisteredModelsResponse:
|
|
|
890
900
|
return body
|
|
891
901
|
|
|
892
902
|
@classmethod
|
|
893
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
903
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ListModelsResponse':
|
|
894
904
|
return cls(next_page_token=d.get('next_page_token', None),
|
|
895
|
-
registered_models=_repeated(d, 'registered_models',
|
|
905
|
+
registered_models=_repeated(d, 'registered_models', Model))
|
|
896
906
|
|
|
897
907
|
|
|
898
908
|
@dataclass
|
|
@@ -913,16 +923,15 @@ class ListRegistryWebhooks:
|
|
|
913
923
|
|
|
914
924
|
|
|
915
925
|
@dataclass
|
|
916
|
-
class
|
|
917
|
-
"""List
|
|
926
|
+
class ListTransitionRequestsRequest:
|
|
927
|
+
"""List transition requests"""
|
|
918
928
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
page_token: str = None
|
|
929
|
+
name: str
|
|
930
|
+
version: str
|
|
922
931
|
|
|
923
932
|
|
|
924
933
|
@dataclass
|
|
925
|
-
class
|
|
934
|
+
class ListTransitionRequestsResponse:
|
|
926
935
|
requests: 'List[Activity]' = None
|
|
927
936
|
|
|
928
937
|
def as_dict(self) -> dict:
|
|
@@ -931,16 +940,17 @@ class ListResponse:
|
|
|
931
940
|
return body
|
|
932
941
|
|
|
933
942
|
@classmethod
|
|
934
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
943
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ListTransitionRequestsResponse':
|
|
935
944
|
return cls(requests=_repeated(d, 'requests', Activity))
|
|
936
945
|
|
|
937
946
|
|
|
938
947
|
@dataclass
|
|
939
|
-
class
|
|
940
|
-
"""List
|
|
948
|
+
class ListWebhooksRequest:
|
|
949
|
+
"""List registry webhooks"""
|
|
941
950
|
|
|
942
|
-
|
|
943
|
-
|
|
951
|
+
events: 'List[RegistryWebhookEvent]' = None
|
|
952
|
+
model_name: str = None
|
|
953
|
+
page_token: str = None
|
|
944
954
|
|
|
945
955
|
|
|
946
956
|
@dataclass
|
|
@@ -1058,134 +1068,77 @@ class Metric:
|
|
|
1058
1068
|
|
|
1059
1069
|
|
|
1060
1070
|
@dataclass
|
|
1061
|
-
class
|
|
1071
|
+
class Model:
|
|
1062
1072
|
creation_timestamp: int = None
|
|
1063
|
-
current_stage: str = None
|
|
1064
1073
|
description: str = None
|
|
1065
1074
|
last_updated_timestamp: int = None
|
|
1075
|
+
latest_versions: 'List[ModelVersion]' = None
|
|
1066
1076
|
name: str = None
|
|
1067
|
-
|
|
1068
|
-
run_link: str = None
|
|
1069
|
-
source: str = None
|
|
1070
|
-
status: 'ModelVersionStatus' = None
|
|
1071
|
-
status_message: str = None
|
|
1072
|
-
tags: 'List[ModelVersionTag]' = None
|
|
1077
|
+
tags: 'List[ModelTag]' = None
|
|
1073
1078
|
user_id: str = None
|
|
1074
|
-
version: str = None
|
|
1075
1079
|
|
|
1076
1080
|
def as_dict(self) -> dict:
|
|
1077
1081
|
body = {}
|
|
1078
1082
|
if self.creation_timestamp: body['creation_timestamp'] = self.creation_timestamp
|
|
1079
|
-
if self.current_stage: body['current_stage'] = self.current_stage
|
|
1080
1083
|
if self.description: body['description'] = self.description
|
|
1081
1084
|
if self.last_updated_timestamp: body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
1085
|
+
if self.latest_versions: body['latest_versions'] = [v.as_dict() for v in self.latest_versions]
|
|
1082
1086
|
if self.name: body['name'] = self.name
|
|
1083
|
-
if self.run_id: body['run_id'] = self.run_id
|
|
1084
|
-
if self.run_link: body['run_link'] = self.run_link
|
|
1085
|
-
if self.source: body['source'] = self.source
|
|
1086
|
-
if self.status: body['status'] = self.status.value
|
|
1087
|
-
if self.status_message: body['status_message'] = self.status_message
|
|
1088
1087
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
1089
1088
|
if self.user_id: body['user_id'] = self.user_id
|
|
1090
|
-
if self.version: body['version'] = self.version
|
|
1091
1089
|
return body
|
|
1092
1090
|
|
|
1093
1091
|
@classmethod
|
|
1094
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1092
|
+
def from_dict(cls, d: Dict[str, any]) -> 'Model':
|
|
1095
1093
|
return cls(creation_timestamp=d.get('creation_timestamp', None),
|
|
1096
|
-
current_stage=d.get('current_stage', None),
|
|
1097
1094
|
description=d.get('description', None),
|
|
1098
1095
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
1096
|
+
latest_versions=_repeated(d, 'latest_versions', ModelVersion),
|
|
1099
1097
|
name=d.get('name', None),
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
source=d.get('source', None),
|
|
1103
|
-
status=_enum(d, 'status', ModelVersionStatus),
|
|
1104
|
-
status_message=d.get('status_message', None),
|
|
1105
|
-
tags=_repeated(d, 'tags', ModelVersionTag),
|
|
1106
|
-
user_id=d.get('user_id', None),
|
|
1107
|
-
version=d.get('version', None))
|
|
1098
|
+
tags=_repeated(d, 'tags', ModelTag),
|
|
1099
|
+
user_id=d.get('user_id', None))
|
|
1108
1100
|
|
|
1109
1101
|
|
|
1110
1102
|
@dataclass
|
|
1111
|
-
class
|
|
1103
|
+
class ModelDatabricks:
|
|
1112
1104
|
creation_timestamp: int = None
|
|
1113
|
-
current_stage: 'Stage' = None
|
|
1114
1105
|
description: str = None
|
|
1106
|
+
id: str = None
|
|
1115
1107
|
last_updated_timestamp: int = None
|
|
1108
|
+
latest_versions: 'List[ModelVersion]' = None
|
|
1116
1109
|
name: str = None
|
|
1117
1110
|
permission_level: 'PermissionLevel' = None
|
|
1118
|
-
|
|
1119
|
-
run_link: str = None
|
|
1120
|
-
source: str = None
|
|
1121
|
-
status: 'Status' = None
|
|
1122
|
-
status_message: str = None
|
|
1123
|
-
tags: 'List[ModelVersionTag]' = None
|
|
1111
|
+
tags: 'List[ModelTag]' = None
|
|
1124
1112
|
user_id: str = None
|
|
1125
|
-
version: str = None
|
|
1126
1113
|
|
|
1127
1114
|
def as_dict(self) -> dict:
|
|
1128
1115
|
body = {}
|
|
1129
1116
|
if self.creation_timestamp: body['creation_timestamp'] = self.creation_timestamp
|
|
1130
|
-
if self.current_stage: body['current_stage'] = self.current_stage.value
|
|
1131
1117
|
if self.description: body['description'] = self.description
|
|
1118
|
+
if self.id: body['id'] = self.id
|
|
1132
1119
|
if self.last_updated_timestamp: body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
1120
|
+
if self.latest_versions: body['latest_versions'] = [v.as_dict() for v in self.latest_versions]
|
|
1133
1121
|
if self.name: body['name'] = self.name
|
|
1134
1122
|
if self.permission_level: body['permission_level'] = self.permission_level.value
|
|
1135
|
-
if self.run_id: body['run_id'] = self.run_id
|
|
1136
|
-
if self.run_link: body['run_link'] = self.run_link
|
|
1137
|
-
if self.source: body['source'] = self.source
|
|
1138
|
-
if self.status: body['status'] = self.status.value
|
|
1139
|
-
if self.status_message: body['status_message'] = self.status_message
|
|
1140
1123
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
1141
1124
|
if self.user_id: body['user_id'] = self.user_id
|
|
1142
|
-
if self.version: body['version'] = self.version
|
|
1143
1125
|
return body
|
|
1144
1126
|
|
|
1145
1127
|
@classmethod
|
|
1146
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1128
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ModelDatabricks':
|
|
1147
1129
|
return cls(creation_timestamp=d.get('creation_timestamp', None),
|
|
1148
|
-
current_stage=_enum(d, 'current_stage', Stage),
|
|
1149
1130
|
description=d.get('description', None),
|
|
1131
|
+
id=d.get('id', None),
|
|
1150
1132
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
1133
|
+
latest_versions=_repeated(d, 'latest_versions', ModelVersion),
|
|
1151
1134
|
name=d.get('name', None),
|
|
1152
1135
|
permission_level=_enum(d, 'permission_level', PermissionLevel),
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
source=d.get('source', None),
|
|
1156
|
-
status=_enum(d, 'status', Status),
|
|
1157
|
-
status_message=d.get('status_message', None),
|
|
1158
|
-
tags=_repeated(d, 'tags', ModelVersionTag),
|
|
1159
|
-
user_id=d.get('user_id', None),
|
|
1160
|
-
version=d.get('version', None))
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
class ModelVersionStatus(Enum):
|
|
1164
|
-
"""Current status of `model_version`"""
|
|
1165
|
-
|
|
1166
|
-
FAILED_REGISTRATION = 'FAILED_REGISTRATION'
|
|
1167
|
-
PENDING_REGISTRATION = 'PENDING_REGISTRATION'
|
|
1168
|
-
READY = 'READY'
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
@dataclass
|
|
1172
|
-
class ModelVersionTag:
|
|
1173
|
-
key: str = None
|
|
1174
|
-
value: str = None
|
|
1175
|
-
|
|
1176
|
-
def as_dict(self) -> dict:
|
|
1177
|
-
body = {}
|
|
1178
|
-
if self.key: body['key'] = self.key
|
|
1179
|
-
if self.value: body['value'] = self.value
|
|
1180
|
-
return body
|
|
1181
|
-
|
|
1182
|
-
@classmethod
|
|
1183
|
-
def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionTag':
|
|
1184
|
-
return cls(key=d.get('key', None), value=d.get('value', None))
|
|
1136
|
+
tags=_repeated(d, 'tags', ModelTag),
|
|
1137
|
+
user_id=d.get('user_id', None))
|
|
1185
1138
|
|
|
1186
1139
|
|
|
1187
1140
|
@dataclass
|
|
1188
|
-
class
|
|
1141
|
+
class ModelTag:
|
|
1189
1142
|
key: str = None
|
|
1190
1143
|
value: str = None
|
|
1191
1144
|
|
|
@@ -1196,93 +1149,139 @@ class Param:
|
|
|
1196
1149
|
return body
|
|
1197
1150
|
|
|
1198
1151
|
@classmethod
|
|
1199
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1152
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ModelTag':
|
|
1200
1153
|
return cls(key=d.get('key', None), value=d.get('value', None))
|
|
1201
1154
|
|
|
1202
1155
|
|
|
1203
|
-
class PermissionLevel(Enum):
|
|
1204
|
-
"""Permission level of the requesting user on the object. For what is allowed at each level, see
|
|
1205
|
-
[MLflow Model permissions](..)."""
|
|
1206
|
-
|
|
1207
|
-
CAN_EDIT = 'CAN_EDIT'
|
|
1208
|
-
CAN_MANAGE = 'CAN_MANAGE'
|
|
1209
|
-
CAN_MANAGE_PRODUCTION_VERSIONS = 'CAN_MANAGE_PRODUCTION_VERSIONS'
|
|
1210
|
-
CAN_MANAGE_STAGING_VERSIONS = 'CAN_MANAGE_STAGING_VERSIONS'
|
|
1211
|
-
CAN_READ = 'CAN_READ'
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
1156
|
@dataclass
|
|
1215
|
-
class
|
|
1157
|
+
class ModelVersion:
|
|
1216
1158
|
creation_timestamp: int = None
|
|
1159
|
+
current_stage: str = None
|
|
1217
1160
|
description: str = None
|
|
1218
1161
|
last_updated_timestamp: int = None
|
|
1219
|
-
latest_versions: 'List[ModelVersion]' = None
|
|
1220
1162
|
name: str = None
|
|
1221
|
-
|
|
1163
|
+
run_id: str = None
|
|
1164
|
+
run_link: str = None
|
|
1165
|
+
source: str = None
|
|
1166
|
+
status: 'ModelVersionStatus' = None
|
|
1167
|
+
status_message: str = None
|
|
1168
|
+
tags: 'List[ModelVersionTag]' = None
|
|
1222
1169
|
user_id: str = None
|
|
1170
|
+
version: str = None
|
|
1223
1171
|
|
|
1224
1172
|
def as_dict(self) -> dict:
|
|
1225
1173
|
body = {}
|
|
1226
1174
|
if self.creation_timestamp: body['creation_timestamp'] = self.creation_timestamp
|
|
1175
|
+
if self.current_stage: body['current_stage'] = self.current_stage
|
|
1227
1176
|
if self.description: body['description'] = self.description
|
|
1228
1177
|
if self.last_updated_timestamp: body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
1229
|
-
if self.latest_versions: body['latest_versions'] = [v.as_dict() for v in self.latest_versions]
|
|
1230
1178
|
if self.name: body['name'] = self.name
|
|
1179
|
+
if self.run_id: body['run_id'] = self.run_id
|
|
1180
|
+
if self.run_link: body['run_link'] = self.run_link
|
|
1181
|
+
if self.source: body['source'] = self.source
|
|
1182
|
+
if self.status: body['status'] = self.status.value
|
|
1183
|
+
if self.status_message: body['status_message'] = self.status_message
|
|
1231
1184
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
1232
1185
|
if self.user_id: body['user_id'] = self.user_id
|
|
1186
|
+
if self.version: body['version'] = self.version
|
|
1233
1187
|
return body
|
|
1234
1188
|
|
|
1235
1189
|
@classmethod
|
|
1236
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1190
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ModelVersion':
|
|
1237
1191
|
return cls(creation_timestamp=d.get('creation_timestamp', None),
|
|
1192
|
+
current_stage=d.get('current_stage', None),
|
|
1238
1193
|
description=d.get('description', None),
|
|
1239
1194
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
1240
|
-
latest_versions=_repeated(d, 'latest_versions', ModelVersion),
|
|
1241
1195
|
name=d.get('name', None),
|
|
1242
|
-
|
|
1243
|
-
|
|
1196
|
+
run_id=d.get('run_id', None),
|
|
1197
|
+
run_link=d.get('run_link', None),
|
|
1198
|
+
source=d.get('source', None),
|
|
1199
|
+
status=_enum(d, 'status', ModelVersionStatus),
|
|
1200
|
+
status_message=d.get('status_message', None),
|
|
1201
|
+
tags=_repeated(d, 'tags', ModelVersionTag),
|
|
1202
|
+
user_id=d.get('user_id', None),
|
|
1203
|
+
version=d.get('version', None))
|
|
1244
1204
|
|
|
1245
1205
|
|
|
1246
1206
|
@dataclass
|
|
1247
|
-
class
|
|
1207
|
+
class ModelVersionDatabricks:
|
|
1248
1208
|
creation_timestamp: int = None
|
|
1209
|
+
current_stage: 'Stage' = None
|
|
1249
1210
|
description: str = None
|
|
1250
|
-
id: str = None
|
|
1251
1211
|
last_updated_timestamp: int = None
|
|
1252
|
-
latest_versions: 'List[ModelVersion]' = None
|
|
1253
1212
|
name: str = None
|
|
1254
1213
|
permission_level: 'PermissionLevel' = None
|
|
1255
|
-
|
|
1214
|
+
run_id: str = None
|
|
1215
|
+
run_link: str = None
|
|
1216
|
+
source: str = None
|
|
1217
|
+
status: 'Status' = None
|
|
1218
|
+
status_message: str = None
|
|
1219
|
+
tags: 'List[ModelVersionTag]' = None
|
|
1256
1220
|
user_id: str = None
|
|
1221
|
+
version: str = None
|
|
1257
1222
|
|
|
1258
1223
|
def as_dict(self) -> dict:
|
|
1259
1224
|
body = {}
|
|
1260
1225
|
if self.creation_timestamp: body['creation_timestamp'] = self.creation_timestamp
|
|
1226
|
+
if self.current_stage: body['current_stage'] = self.current_stage.value
|
|
1261
1227
|
if self.description: body['description'] = self.description
|
|
1262
|
-
if self.id: body['id'] = self.id
|
|
1263
1228
|
if self.last_updated_timestamp: body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
1264
|
-
if self.latest_versions: body['latest_versions'] = [v.as_dict() for v in self.latest_versions]
|
|
1265
1229
|
if self.name: body['name'] = self.name
|
|
1266
1230
|
if self.permission_level: body['permission_level'] = self.permission_level.value
|
|
1231
|
+
if self.run_id: body['run_id'] = self.run_id
|
|
1232
|
+
if self.run_link: body['run_link'] = self.run_link
|
|
1233
|
+
if self.source: body['source'] = self.source
|
|
1234
|
+
if self.status: body['status'] = self.status.value
|
|
1235
|
+
if self.status_message: body['status_message'] = self.status_message
|
|
1267
1236
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
1268
1237
|
if self.user_id: body['user_id'] = self.user_id
|
|
1238
|
+
if self.version: body['version'] = self.version
|
|
1269
1239
|
return body
|
|
1270
1240
|
|
|
1271
1241
|
@classmethod
|
|
1272
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1242
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionDatabricks':
|
|
1273
1243
|
return cls(creation_timestamp=d.get('creation_timestamp', None),
|
|
1244
|
+
current_stage=_enum(d, 'current_stage', Stage),
|
|
1274
1245
|
description=d.get('description', None),
|
|
1275
|
-
id=d.get('id', None),
|
|
1276
1246
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
1277
|
-
latest_versions=_repeated(d, 'latest_versions', ModelVersion),
|
|
1278
1247
|
name=d.get('name', None),
|
|
1279
1248
|
permission_level=_enum(d, 'permission_level', PermissionLevel),
|
|
1280
|
-
|
|
1281
|
-
|
|
1249
|
+
run_id=d.get('run_id', None),
|
|
1250
|
+
run_link=d.get('run_link', None),
|
|
1251
|
+
source=d.get('source', None),
|
|
1252
|
+
status=_enum(d, 'status', Status),
|
|
1253
|
+
status_message=d.get('status_message', None),
|
|
1254
|
+
tags=_repeated(d, 'tags', ModelVersionTag),
|
|
1255
|
+
user_id=d.get('user_id', None),
|
|
1256
|
+
version=d.get('version', None))
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
class ModelVersionStatus(Enum):
|
|
1260
|
+
"""Current status of `model_version`"""
|
|
1261
|
+
|
|
1262
|
+
FAILED_REGISTRATION = 'FAILED_REGISTRATION'
|
|
1263
|
+
PENDING_REGISTRATION = 'PENDING_REGISTRATION'
|
|
1264
|
+
READY = 'READY'
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
@dataclass
|
|
1268
|
+
class ModelVersionTag:
|
|
1269
|
+
key: str = None
|
|
1270
|
+
value: str = None
|
|
1271
|
+
|
|
1272
|
+
def as_dict(self) -> dict:
|
|
1273
|
+
body = {}
|
|
1274
|
+
if self.key: body['key'] = self.key
|
|
1275
|
+
if self.value: body['value'] = self.value
|
|
1276
|
+
return body
|
|
1277
|
+
|
|
1278
|
+
@classmethod
|
|
1279
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionTag':
|
|
1280
|
+
return cls(key=d.get('key', None), value=d.get('value', None))
|
|
1282
1281
|
|
|
1283
1282
|
|
|
1284
1283
|
@dataclass
|
|
1285
|
-
class
|
|
1284
|
+
class Param:
|
|
1286
1285
|
key: str = None
|
|
1287
1286
|
value: str = None
|
|
1288
1287
|
|
|
@@ -1293,10 +1292,21 @@ class RegisteredModelTag:
|
|
|
1293
1292
|
return body
|
|
1294
1293
|
|
|
1295
1294
|
@classmethod
|
|
1296
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1295
|
+
def from_dict(cls, d: Dict[str, any]) -> 'Param':
|
|
1297
1296
|
return cls(key=d.get('key', None), value=d.get('value', None))
|
|
1298
1297
|
|
|
1299
1298
|
|
|
1299
|
+
class PermissionLevel(Enum):
|
|
1300
|
+
"""Permission level of the requesting user on the object. For what is allowed at each level, see
|
|
1301
|
+
[MLflow Model permissions](..)."""
|
|
1302
|
+
|
|
1303
|
+
CAN_EDIT = 'CAN_EDIT'
|
|
1304
|
+
CAN_MANAGE = 'CAN_MANAGE'
|
|
1305
|
+
CAN_MANAGE_PRODUCTION_VERSIONS = 'CAN_MANAGE_PRODUCTION_VERSIONS'
|
|
1306
|
+
CAN_MANAGE_STAGING_VERSIONS = 'CAN_MANAGE_STAGING_VERSIONS'
|
|
1307
|
+
CAN_READ = 'CAN_READ'
|
|
1308
|
+
|
|
1309
|
+
|
|
1300
1310
|
@dataclass
|
|
1301
1311
|
class RegistryWebhook:
|
|
1302
1312
|
creation_timestamp: int = None
|
|
@@ -1359,20 +1369,6 @@ class RegistryWebhookStatus(Enum):
|
|
|
1359
1369
|
TEST_MODE = 'TEST_MODE'
|
|
1360
1370
|
|
|
1361
1371
|
|
|
1362
|
-
@dataclass
|
|
1363
|
-
class RejectResponse:
|
|
1364
|
-
activity: 'Activity' = None
|
|
1365
|
-
|
|
1366
|
-
def as_dict(self) -> dict:
|
|
1367
|
-
body = {}
|
|
1368
|
-
if self.activity: body['activity'] = self.activity.as_dict()
|
|
1369
|
-
return body
|
|
1370
|
-
|
|
1371
|
-
@classmethod
|
|
1372
|
-
def from_dict(cls, d: Dict[str, any]) -> 'RejectResponse':
|
|
1373
|
-
return cls(activity=_from_dict(d, 'activity', Activity))
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
1372
|
@dataclass
|
|
1377
1373
|
class RejectTransitionRequest:
|
|
1378
1374
|
name: str
|
|
@@ -1397,7 +1393,21 @@ class RejectTransitionRequest:
|
|
|
1397
1393
|
|
|
1398
1394
|
|
|
1399
1395
|
@dataclass
|
|
1400
|
-
class
|
|
1396
|
+
class RejectTransitionRequestResponse:
|
|
1397
|
+
activity: 'Activity' = None
|
|
1398
|
+
|
|
1399
|
+
def as_dict(self) -> dict:
|
|
1400
|
+
body = {}
|
|
1401
|
+
if self.activity: body['activity'] = self.activity.as_dict()
|
|
1402
|
+
return body
|
|
1403
|
+
|
|
1404
|
+
@classmethod
|
|
1405
|
+
def from_dict(cls, d: Dict[str, any]) -> 'RejectTransitionRequestResponse':
|
|
1406
|
+
return cls(activity=_from_dict(d, 'activity', Activity))
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
@dataclass
|
|
1410
|
+
class RenameModelRequest:
|
|
1401
1411
|
name: str
|
|
1402
1412
|
new_name: str = None
|
|
1403
1413
|
|
|
@@ -1408,13 +1418,13 @@ class RenameRegisteredModelRequest:
|
|
|
1408
1418
|
return body
|
|
1409
1419
|
|
|
1410
1420
|
@classmethod
|
|
1411
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1421
|
+
def from_dict(cls, d: Dict[str, any]) -> 'RenameModelRequest':
|
|
1412
1422
|
return cls(name=d.get('name', None), new_name=d.get('new_name', None))
|
|
1413
1423
|
|
|
1414
1424
|
|
|
1415
1425
|
@dataclass
|
|
1416
|
-
class
|
|
1417
|
-
registered_model: '
|
|
1426
|
+
class RenameModelResponse:
|
|
1427
|
+
registered_model: 'Model' = None
|
|
1418
1428
|
|
|
1419
1429
|
def as_dict(self) -> dict:
|
|
1420
1430
|
body = {}
|
|
@@ -1422,8 +1432,8 @@ class RenameRegisteredModelResponse:
|
|
|
1422
1432
|
return body
|
|
1423
1433
|
|
|
1424
1434
|
@classmethod
|
|
1425
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1426
|
-
return cls(registered_model=_from_dict(d, 'registered_model',
|
|
1435
|
+
def from_dict(cls, d: Dict[str, any]) -> 'RenameModelResponse':
|
|
1436
|
+
return cls(registered_model=_from_dict(d, 'registered_model', Model))
|
|
1427
1437
|
|
|
1428
1438
|
|
|
1429
1439
|
@dataclass
|
|
@@ -1634,7 +1644,7 @@ class SearchModelVersionsResponse:
|
|
|
1634
1644
|
|
|
1635
1645
|
|
|
1636
1646
|
@dataclass
|
|
1637
|
-
class
|
|
1647
|
+
class SearchModelsRequest:
|
|
1638
1648
|
"""Search models"""
|
|
1639
1649
|
|
|
1640
1650
|
filter: str = None
|
|
@@ -1644,9 +1654,9 @@ class SearchRegisteredModelsRequest:
|
|
|
1644
1654
|
|
|
1645
1655
|
|
|
1646
1656
|
@dataclass
|
|
1647
|
-
class
|
|
1657
|
+
class SearchModelsResponse:
|
|
1648
1658
|
next_page_token: str = None
|
|
1649
|
-
registered_models: 'List[
|
|
1659
|
+
registered_models: 'List[Model]' = None
|
|
1650
1660
|
|
|
1651
1661
|
def as_dict(self) -> dict:
|
|
1652
1662
|
body = {}
|
|
@@ -1655,9 +1665,9 @@ class SearchRegisteredModelsResponse:
|
|
|
1655
1665
|
return body
|
|
1656
1666
|
|
|
1657
1667
|
@classmethod
|
|
1658
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1668
|
+
def from_dict(cls, d: Dict[str, any]) -> 'SearchModelsResponse':
|
|
1659
1669
|
return cls(next_page_token=d.get('next_page_token', None),
|
|
1660
|
-
registered_models=_repeated(d, 'registered_models',
|
|
1670
|
+
registered_models=_repeated(d, 'registered_models', Model))
|
|
1661
1671
|
|
|
1662
1672
|
|
|
1663
1673
|
@dataclass
|
|
@@ -1734,9 +1744,8 @@ class SetExperimentTag:
|
|
|
1734
1744
|
|
|
1735
1745
|
|
|
1736
1746
|
@dataclass
|
|
1737
|
-
class
|
|
1747
|
+
class SetModelTagRequest:
|
|
1738
1748
|
name: str
|
|
1739
|
-
version: str
|
|
1740
1749
|
key: str
|
|
1741
1750
|
value: str
|
|
1742
1751
|
|
|
@@ -1745,20 +1754,17 @@ class SetModelVersionTagRequest:
|
|
|
1745
1754
|
if self.key: body['key'] = self.key
|
|
1746
1755
|
if self.name: body['name'] = self.name
|
|
1747
1756
|
if self.value: body['value'] = self.value
|
|
1748
|
-
if self.version: body['version'] = self.version
|
|
1749
1757
|
return body
|
|
1750
1758
|
|
|
1751
1759
|
@classmethod
|
|
1752
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1753
|
-
return cls(key=d.get('key', None),
|
|
1754
|
-
name=d.get('name', None),
|
|
1755
|
-
value=d.get('value', None),
|
|
1756
|
-
version=d.get('version', None))
|
|
1760
|
+
def from_dict(cls, d: Dict[str, any]) -> 'SetModelTagRequest':
|
|
1761
|
+
return cls(key=d.get('key', None), name=d.get('name', None), value=d.get('value', None))
|
|
1757
1762
|
|
|
1758
1763
|
|
|
1759
1764
|
@dataclass
|
|
1760
|
-
class
|
|
1765
|
+
class SetModelVersionTagRequest:
|
|
1761
1766
|
name: str
|
|
1767
|
+
version: str
|
|
1762
1768
|
key: str
|
|
1763
1769
|
value: str
|
|
1764
1770
|
|
|
@@ -1767,11 +1773,15 @@ class SetRegisteredModelTagRequest:
|
|
|
1767
1773
|
if self.key: body['key'] = self.key
|
|
1768
1774
|
if self.name: body['name'] = self.name
|
|
1769
1775
|
if self.value: body['value'] = self.value
|
|
1776
|
+
if self.version: body['version'] = self.version
|
|
1770
1777
|
return body
|
|
1771
1778
|
|
|
1772
1779
|
@classmethod
|
|
1773
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
1774
|
-
return cls(key=d.get('key', None),
|
|
1780
|
+
def from_dict(cls, d: Dict[str, any]) -> 'SetModelVersionTagRequest':
|
|
1781
|
+
return cls(key=d.get('key', None),
|
|
1782
|
+
name=d.get('name', None),
|
|
1783
|
+
value=d.get('value', None),
|
|
1784
|
+
version=d.get('version', None))
|
|
1775
1785
|
|
|
1776
1786
|
|
|
1777
1787
|
@dataclass
|
|
@@ -1862,29 +1872,6 @@ class TestRegistryWebhookResponse:
|
|
|
1862
1872
|
return cls(webhook=_from_dict(d, 'webhook', TestRegistryWebhook))
|
|
1863
1873
|
|
|
1864
1874
|
|
|
1865
|
-
@dataclass
|
|
1866
|
-
class TransitionModelVersionStage:
|
|
1867
|
-
name: str
|
|
1868
|
-
version: str
|
|
1869
|
-
stage: str
|
|
1870
|
-
archive_existing_versions: bool
|
|
1871
|
-
|
|
1872
|
-
def as_dict(self) -> dict:
|
|
1873
|
-
body = {}
|
|
1874
|
-
if self.archive_existing_versions: body['archive_existing_versions'] = self.archive_existing_versions
|
|
1875
|
-
if self.name: body['name'] = self.name
|
|
1876
|
-
if self.stage: body['stage'] = self.stage
|
|
1877
|
-
if self.version: body['version'] = self.version
|
|
1878
|
-
return body
|
|
1879
|
-
|
|
1880
|
-
@classmethod
|
|
1881
|
-
def from_dict(cls, d: Dict[str, any]) -> 'TransitionModelVersionStage':
|
|
1882
|
-
return cls(archive_existing_versions=d.get('archive_existing_versions', None),
|
|
1883
|
-
name=d.get('name', None),
|
|
1884
|
-
stage=d.get('stage', None),
|
|
1885
|
-
version=d.get('version', None))
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
1875
|
@dataclass
|
|
1889
1876
|
class TransitionModelVersionStageDatabricks:
|
|
1890
1877
|
name: str
|
|
@@ -1911,20 +1898,6 @@ class TransitionModelVersionStageDatabricks:
|
|
|
1911
1898
|
version=d.get('version', None))
|
|
1912
1899
|
|
|
1913
1900
|
|
|
1914
|
-
@dataclass
|
|
1915
|
-
class TransitionModelVersionStageResponse:
|
|
1916
|
-
model_version: 'ModelVersion' = None
|
|
1917
|
-
|
|
1918
|
-
def as_dict(self) -> dict:
|
|
1919
|
-
body = {}
|
|
1920
|
-
if self.model_version: body['model_version'] = self.model_version.as_dict()
|
|
1921
|
-
return body
|
|
1922
|
-
|
|
1923
|
-
@classmethod
|
|
1924
|
-
def from_dict(cls, d: Dict[str, any]) -> 'TransitionModelVersionStageResponse':
|
|
1925
|
-
return cls(model_version=_from_dict(d, 'model_version', ModelVersion))
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
1901
|
@dataclass
|
|
1929
1902
|
class TransitionRequest:
|
|
1930
1903
|
"""Transition request details."""
|
|
@@ -1983,6 +1956,20 @@ class UpdateComment:
|
|
|
1983
1956
|
return cls(comment=d.get('comment', None), id=d.get('id', None))
|
|
1984
1957
|
|
|
1985
1958
|
|
|
1959
|
+
@dataclass
|
|
1960
|
+
class UpdateCommentResponse:
|
|
1961
|
+
comment: 'CommentObject' = None
|
|
1962
|
+
|
|
1963
|
+
def as_dict(self) -> dict:
|
|
1964
|
+
body = {}
|
|
1965
|
+
if self.comment: body['comment'] = self.comment.as_dict()
|
|
1966
|
+
return body
|
|
1967
|
+
|
|
1968
|
+
@classmethod
|
|
1969
|
+
def from_dict(cls, d: Dict[str, any]) -> 'UpdateCommentResponse':
|
|
1970
|
+
return cls(comment=_from_dict(d, 'comment', CommentObject))
|
|
1971
|
+
|
|
1972
|
+
|
|
1986
1973
|
@dataclass
|
|
1987
1974
|
class UpdateExperiment:
|
|
1988
1975
|
experiment_id: str
|
|
@@ -2000,39 +1987,39 @@ class UpdateExperiment:
|
|
|
2000
1987
|
|
|
2001
1988
|
|
|
2002
1989
|
@dataclass
|
|
2003
|
-
class
|
|
1990
|
+
class UpdateModelRequest:
|
|
2004
1991
|
name: str
|
|
2005
|
-
version: str
|
|
2006
1992
|
description: str = None
|
|
2007
1993
|
|
|
2008
1994
|
def as_dict(self) -> dict:
|
|
2009
1995
|
body = {}
|
|
2010
1996
|
if self.description: body['description'] = self.description
|
|
2011
1997
|
if self.name: body['name'] = self.name
|
|
2012
|
-
if self.version: body['version'] = self.version
|
|
2013
1998
|
return body
|
|
2014
1999
|
|
|
2015
2000
|
@classmethod
|
|
2016
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
2017
|
-
return cls(description=d.get('description', None),
|
|
2018
|
-
name=d.get('name', None),
|
|
2019
|
-
version=d.get('version', None))
|
|
2001
|
+
def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelRequest':
|
|
2002
|
+
return cls(description=d.get('description', None), name=d.get('name', None))
|
|
2020
2003
|
|
|
2021
2004
|
|
|
2022
2005
|
@dataclass
|
|
2023
|
-
class
|
|
2006
|
+
class UpdateModelVersionRequest:
|
|
2024
2007
|
name: str
|
|
2008
|
+
version: str
|
|
2025
2009
|
description: str = None
|
|
2026
2010
|
|
|
2027
2011
|
def as_dict(self) -> dict:
|
|
2028
2012
|
body = {}
|
|
2029
2013
|
if self.description: body['description'] = self.description
|
|
2030
2014
|
if self.name: body['name'] = self.name
|
|
2015
|
+
if self.version: body['version'] = self.version
|
|
2031
2016
|
return body
|
|
2032
2017
|
|
|
2033
2018
|
@classmethod
|
|
2034
|
-
def from_dict(cls, d: Dict[str, any]) -> '
|
|
2035
|
-
return cls(description=d.get('description', None),
|
|
2019
|
+
def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelVersionRequest':
|
|
2020
|
+
return cls(description=d.get('description', None),
|
|
2021
|
+
name=d.get('name', None),
|
|
2022
|
+
version=d.get('version', None))
|
|
2036
2023
|
|
|
2037
2024
|
|
|
2038
2025
|
@dataclass
|
|
@@ -2064,20 +2051,6 @@ class UpdateRegistryWebhook:
|
|
|
2064
2051
|
status=_enum(d, 'status', RegistryWebhookStatus))
|
|
2065
2052
|
|
|
2066
2053
|
|
|
2067
|
-
@dataclass
|
|
2068
|
-
class UpdateResponse:
|
|
2069
|
-
comment: 'CommentObject' = None
|
|
2070
|
-
|
|
2071
|
-
def as_dict(self) -> dict:
|
|
2072
|
-
body = {}
|
|
2073
|
-
if self.comment: body['comment'] = self.comment.as_dict()
|
|
2074
|
-
return body
|
|
2075
|
-
|
|
2076
|
-
@classmethod
|
|
2077
|
-
def from_dict(cls, d: Dict[str, any]) -> 'UpdateResponse':
|
|
2078
|
-
return cls(comment=_from_dict(d, 'comment', CommentObject))
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
2054
|
@dataclass
|
|
2082
2055
|
class UpdateRun:
|
|
2083
2056
|
end_time: int = None
|
|
@@ -2130,12 +2103,12 @@ class ExperimentsAPI:
|
|
|
2130
2103
|
def __init__(self, api_client):
|
|
2131
2104
|
self._api = api_client
|
|
2132
2105
|
|
|
2133
|
-
def
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2106
|
+
def create_experiment(self,
|
|
2107
|
+
name: str,
|
|
2108
|
+
*,
|
|
2109
|
+
artifact_location: str = None,
|
|
2110
|
+
tags: List[ExperimentTag] = None,
|
|
2111
|
+
**kwargs) -> CreateExperimentResponse:
|
|
2139
2112
|
"""Create experiment.
|
|
2140
2113
|
|
|
2141
2114
|
Creates an experiment with a name. Returns the ID of the newly created experiment. Validates that
|
|
@@ -2151,7 +2124,30 @@ class ExperimentsAPI:
|
|
|
2151
2124
|
json = self._api.do('POST', '/api/2.0/mlflow/experiments/create', body=body)
|
|
2152
2125
|
return CreateExperimentResponse.from_dict(json)
|
|
2153
2126
|
|
|
2154
|
-
def
|
|
2127
|
+
def create_run(self,
|
|
2128
|
+
*,
|
|
2129
|
+
experiment_id: str = None,
|
|
2130
|
+
start_time: int = None,
|
|
2131
|
+
tags: List[RunTag] = None,
|
|
2132
|
+
user_id: str = None,
|
|
2133
|
+
**kwargs) -> CreateRunResponse:
|
|
2134
|
+
"""Create a run.
|
|
2135
|
+
|
|
2136
|
+
Creates a new run within an experiment. A run is usually a single execution of a machine learning or
|
|
2137
|
+
data ETL pipeline. MLflow uses runs to track the `mlflowParam`, `mlflowMetric` and `mlflowRunTag`
|
|
2138
|
+
associated with a single execution."""
|
|
2139
|
+
request = kwargs.get('request', None)
|
|
2140
|
+
if not request: # request is not given through keyed args
|
|
2141
|
+
request = CreateRun(experiment_id=experiment_id,
|
|
2142
|
+
start_time=start_time,
|
|
2143
|
+
tags=tags,
|
|
2144
|
+
user_id=user_id)
|
|
2145
|
+
body = request.as_dict()
|
|
2146
|
+
|
|
2147
|
+
json = self._api.do('POST', '/api/2.0/mlflow/runs/create', body=body)
|
|
2148
|
+
return CreateRunResponse.from_dict(json)
|
|
2149
|
+
|
|
2150
|
+
def delete_experiment(self, experiment_id: str, **kwargs):
|
|
2155
2151
|
"""Delete an experiment.
|
|
2156
2152
|
|
|
2157
2153
|
Marks an experiment and associated metadata, runs, metrics, params, and tags for deletion. If the
|
|
@@ -2162,19 +2158,26 @@ class ExperimentsAPI:
|
|
|
2162
2158
|
body = request.as_dict()
|
|
2163
2159
|
self._api.do('POST', '/api/2.0/mlflow/experiments/delete', body=body)
|
|
2164
2160
|
|
|
2165
|
-
def
|
|
2166
|
-
"""
|
|
2161
|
+
def delete_run(self, run_id: str, **kwargs):
|
|
2162
|
+
"""Delete a run.
|
|
2167
2163
|
|
|
2168
|
-
|
|
2164
|
+
Marks a run for deletion."""
|
|
2169
2165
|
request = kwargs.get('request', None)
|
|
2170
2166
|
if not request: # request is not given through keyed args
|
|
2171
|
-
request =
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
if experiment_id: query['experiment_id'] = request.experiment_id
|
|
2167
|
+
request = DeleteRun(run_id=run_id)
|
|
2168
|
+
body = request.as_dict()
|
|
2169
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/delete', body=body)
|
|
2175
2170
|
|
|
2176
|
-
|
|
2177
|
-
|
|
2171
|
+
def delete_tag(self, run_id: str, key: str, **kwargs):
|
|
2172
|
+
"""Delete a tag.
|
|
2173
|
+
|
|
2174
|
+
Deletes a tag on a run. Tags are run metadata that can be updated during a run and after a run
|
|
2175
|
+
completes."""
|
|
2176
|
+
request = kwargs.get('request', None)
|
|
2177
|
+
if not request: # request is not given through keyed args
|
|
2178
|
+
request = DeleteTag(key=key, run_id=run_id)
|
|
2179
|
+
body = request.as_dict()
|
|
2180
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/delete-tag', body=body)
|
|
2178
2181
|
|
|
2179
2182
|
def get_by_name(self, experiment_name: str, **kwargs) -> GetExperimentByNameResponse:
|
|
2180
2183
|
"""Get metadata.
|
|
@@ -2196,12 +2199,104 @@ class ExperimentsAPI:
|
|
|
2196
2199
|
json = self._api.do('GET', '/api/2.0/mlflow/experiments/get-by-name', query=query)
|
|
2197
2200
|
return GetExperimentByNameResponse.from_dict(json)
|
|
2198
2201
|
|
|
2199
|
-
def
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2202
|
+
def get_experiment(self, experiment_id: str, **kwargs) -> Experiment:
|
|
2203
|
+
"""Get an experiment.
|
|
2204
|
+
|
|
2205
|
+
Gets metadata for an experiment. This method works on deleted experiments."""
|
|
2206
|
+
request = kwargs.get('request', None)
|
|
2207
|
+
if not request: # request is not given through keyed args
|
|
2208
|
+
request = GetExperimentRequest(experiment_id=experiment_id)
|
|
2209
|
+
|
|
2210
|
+
query = {}
|
|
2211
|
+
if experiment_id: query['experiment_id'] = request.experiment_id
|
|
2212
|
+
|
|
2213
|
+
json = self._api.do('GET', '/api/2.0/mlflow/experiments/get', query=query)
|
|
2214
|
+
return Experiment.from_dict(json)
|
|
2215
|
+
|
|
2216
|
+
def get_history(self,
|
|
2217
|
+
metric_key: str,
|
|
2218
|
+
*,
|
|
2219
|
+
max_results: int = None,
|
|
2220
|
+
page_token: str = None,
|
|
2221
|
+
run_id: str = None,
|
|
2222
|
+
run_uuid: str = None,
|
|
2223
|
+
**kwargs) -> GetMetricHistoryResponse:
|
|
2224
|
+
"""Get history of a given metric within a run.
|
|
2225
|
+
|
|
2226
|
+
Gets a list of all values for the specified metric for a given run."""
|
|
2227
|
+
request = kwargs.get('request', None)
|
|
2228
|
+
if not request: # request is not given through keyed args
|
|
2229
|
+
request = GetHistoryRequest(max_results=max_results,
|
|
2230
|
+
metric_key=metric_key,
|
|
2231
|
+
page_token=page_token,
|
|
2232
|
+
run_id=run_id,
|
|
2233
|
+
run_uuid=run_uuid)
|
|
2234
|
+
|
|
2235
|
+
query = {}
|
|
2236
|
+
if max_results: query['max_results'] = request.max_results
|
|
2237
|
+
if metric_key: query['metric_key'] = request.metric_key
|
|
2238
|
+
if page_token: query['page_token'] = request.page_token
|
|
2239
|
+
if run_id: query['run_id'] = request.run_id
|
|
2240
|
+
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2241
|
+
|
|
2242
|
+
json = self._api.do('GET', '/api/2.0/mlflow/metrics/get-history', query=query)
|
|
2243
|
+
return GetMetricHistoryResponse.from_dict(json)
|
|
2244
|
+
|
|
2245
|
+
def get_run(self, run_id: str, *, run_uuid: str = None, **kwargs) -> GetRunResponse:
|
|
2246
|
+
"""Get a run.
|
|
2247
|
+
|
|
2248
|
+
"Gets the metadata, metrics, params, and tags for a run. In the case where multiple metrics with the
|
|
2249
|
+
same key are logged for a run, return only the value with the latest timestamp.
|
|
2250
|
+
|
|
2251
|
+
If there are multiple values with the latest timestamp, return the maximum of these values."""
|
|
2252
|
+
request = kwargs.get('request', None)
|
|
2253
|
+
if not request: # request is not given through keyed args
|
|
2254
|
+
request = GetRunRequest(run_id=run_id, run_uuid=run_uuid)
|
|
2255
|
+
|
|
2256
|
+
query = {}
|
|
2257
|
+
if run_id: query['run_id'] = request.run_id
|
|
2258
|
+
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2259
|
+
|
|
2260
|
+
json = self._api.do('GET', '/api/2.0/mlflow/runs/get', query=query)
|
|
2261
|
+
return GetRunResponse.from_dict(json)
|
|
2262
|
+
|
|
2263
|
+
def list_artifacts(self,
|
|
2264
|
+
*,
|
|
2265
|
+
page_token: str = None,
|
|
2266
|
+
path: str = None,
|
|
2267
|
+
run_id: str = None,
|
|
2268
|
+
run_uuid: str = None,
|
|
2269
|
+
**kwargs) -> Iterator[FileInfo]:
|
|
2270
|
+
"""Get all artifacts.
|
|
2271
|
+
|
|
2272
|
+
List artifacts for a run. Takes an optional `artifact_path` prefix. If it is specified, the response
|
|
2273
|
+
contains only artifacts with the specified prefix.","""
|
|
2274
|
+
request = kwargs.get('request', None)
|
|
2275
|
+
if not request: # request is not given through keyed args
|
|
2276
|
+
request = ListArtifactsRequest(page_token=page_token, path=path, run_id=run_id, run_uuid=run_uuid)
|
|
2277
|
+
|
|
2278
|
+
query = {}
|
|
2279
|
+
if page_token: query['page_token'] = request.page_token
|
|
2280
|
+
if path: query['path'] = request.path
|
|
2281
|
+
if run_id: query['run_id'] = request.run_id
|
|
2282
|
+
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2283
|
+
|
|
2284
|
+
while True:
|
|
2285
|
+
json = self._api.do('GET', '/api/2.0/mlflow/artifacts/list', query=query)
|
|
2286
|
+
if 'files' not in json or not json['files']:
|
|
2287
|
+
return
|
|
2288
|
+
for v in json['files']:
|
|
2289
|
+
yield FileInfo.from_dict(v)
|
|
2290
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2291
|
+
return
|
|
2292
|
+
query['page_token'] = json['next_page_token']
|
|
2293
|
+
|
|
2294
|
+
def list_experiments(self,
|
|
2295
|
+
*,
|
|
2296
|
+
max_results: int = None,
|
|
2297
|
+
page_token: str = None,
|
|
2298
|
+
view_type: str = None,
|
|
2299
|
+
**kwargs) -> Iterator[Experiment]:
|
|
2205
2300
|
"""List experiments.
|
|
2206
2301
|
|
|
2207
2302
|
Gets a list of all experiments."""
|
|
@@ -2226,7 +2321,103 @@ class ExperimentsAPI:
|
|
|
2226
2321
|
return
|
|
2227
2322
|
query['page_token'] = json['next_page_token']
|
|
2228
2323
|
|
|
2229
|
-
def
|
|
2324
|
+
def log_batch(self,
|
|
2325
|
+
*,
|
|
2326
|
+
metrics: List[Metric] = None,
|
|
2327
|
+
params: List[Param] = None,
|
|
2328
|
+
run_id: str = None,
|
|
2329
|
+
tags: List[RunTag] = None,
|
|
2330
|
+
**kwargs):
|
|
2331
|
+
"""Log a batch.
|
|
2332
|
+
|
|
2333
|
+
Logs a batch of metrics, params, and tags for a run. If any data failed to be persisted, the server
|
|
2334
|
+
will respond with an error (non-200 status code).
|
|
2335
|
+
|
|
2336
|
+
In case of error (due to internal server error or an invalid request), partial data may be written.
|
|
2337
|
+
|
|
2338
|
+
You can write metrics, params, and tags in interleaving fashion, but within a given entity type are
|
|
2339
|
+
guaranteed to follow the order specified in the request body.
|
|
2340
|
+
|
|
2341
|
+
The overwrite behavior for metrics, params, and tags is as follows:
|
|
2342
|
+
|
|
2343
|
+
* Metrics: metric values are never overwritten. Logging a metric (key, value, timestamp) appends to
|
|
2344
|
+
the set of values for the metric with the provided key.
|
|
2345
|
+
|
|
2346
|
+
* Tags: tag values can be overwritten by successive writes to the same tag key. That is, if multiple
|
|
2347
|
+
tag values with the same key are provided in the same API request, the last-provided tag value is
|
|
2348
|
+
written. Logging the same tag (key, value) is permitted. Specifically, logging a tag is idempotent.
|
|
2349
|
+
|
|
2350
|
+
* Parameters: once written, param values cannot be changed (attempting to overwrite a param value will
|
|
2351
|
+
result in an error). However, logging the same param (key, value) is permitted. Specifically, logging
|
|
2352
|
+
a param is idempotent.
|
|
2353
|
+
|
|
2354
|
+
Request Limits ------------------------------- A single JSON-serialized API request may be up to 1 MB
|
|
2355
|
+
in size and contain:
|
|
2356
|
+
|
|
2357
|
+
* No more than 1000 metrics, params, and tags in total * Up to 1000 metrics - Up to 100 params * Up to
|
|
2358
|
+
100 tags
|
|
2359
|
+
|
|
2360
|
+
For example, a valid request might contain 900 metrics, 50 params, and 50 tags, but logging 900
|
|
2361
|
+
metrics, 50 params, and 51 tags is invalid.
|
|
2362
|
+
|
|
2363
|
+
The following limits also apply to metric, param, and tag keys and values:
|
|
2364
|
+
|
|
2365
|
+
* Metric keyes, param keys, and tag keys can be up to 250 characters in length * Parameter and tag
|
|
2366
|
+
values can be up to 250 characters in length"""
|
|
2367
|
+
request = kwargs.get('request', None)
|
|
2368
|
+
if not request: # request is not given through keyed args
|
|
2369
|
+
request = LogBatch(metrics=metrics, params=params, run_id=run_id, tags=tags)
|
|
2370
|
+
body = request.as_dict()
|
|
2371
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/log-batch', body=body)
|
|
2372
|
+
|
|
2373
|
+
def log_metric(self,
|
|
2374
|
+
key: str,
|
|
2375
|
+
value: float,
|
|
2376
|
+
timestamp: int,
|
|
2377
|
+
*,
|
|
2378
|
+
run_id: str = None,
|
|
2379
|
+
run_uuid: str = None,
|
|
2380
|
+
step: int = None,
|
|
2381
|
+
**kwargs):
|
|
2382
|
+
"""Log a metric.
|
|
2383
|
+
|
|
2384
|
+
Logs a metric for a run. A metric is a key-value pair (string key, float value) with an associated
|
|
2385
|
+
timestamp. Examples include the various metrics that represent ML model accuracy. A metric can be
|
|
2386
|
+
logged multiple times."""
|
|
2387
|
+
request = kwargs.get('request', None)
|
|
2388
|
+
if not request: # request is not given through keyed args
|
|
2389
|
+
request = LogMetric(key=key,
|
|
2390
|
+
run_id=run_id,
|
|
2391
|
+
run_uuid=run_uuid,
|
|
2392
|
+
step=step,
|
|
2393
|
+
timestamp=timestamp,
|
|
2394
|
+
value=value)
|
|
2395
|
+
body = request.as_dict()
|
|
2396
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/log-metric', body=body)
|
|
2397
|
+
|
|
2398
|
+
def log_model(self, *, model_json: str = None, run_id: str = None, **kwargs):
|
|
2399
|
+
"""Log a model.
|
|
2400
|
+
|
|
2401
|
+
**NOTE:** Experimental: This API may change or be removed in a future release without warning."""
|
|
2402
|
+
request = kwargs.get('request', None)
|
|
2403
|
+
if not request: # request is not given through keyed args
|
|
2404
|
+
request = LogModel(model_json=model_json, run_id=run_id)
|
|
2405
|
+
body = request.as_dict()
|
|
2406
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/log-model', body=body)
|
|
2407
|
+
|
|
2408
|
+
def log_param(self, key: str, value: str, *, run_id: str = None, run_uuid: str = None, **kwargs):
|
|
2409
|
+
"""Log a param.
|
|
2410
|
+
|
|
2411
|
+
Logs a param used for a run. A param is a key-value pair (string key, string value). Examples include
|
|
2412
|
+
hyperparameters used for ML model training and constant dates and values used in an ETL pipeline. A
|
|
2413
|
+
param can be logged only once for a run."""
|
|
2414
|
+
request = kwargs.get('request', None)
|
|
2415
|
+
if not request: # request is not given through keyed args
|
|
2416
|
+
request = LogParam(key=key, run_id=run_id, run_uuid=run_uuid, value=value)
|
|
2417
|
+
body = request.as_dict()
|
|
2418
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/log-parameter', body=body)
|
|
2419
|
+
|
|
2420
|
+
def restore_experiment(self, experiment_id: str, **kwargs):
|
|
2230
2421
|
"""Restores an experiment.
|
|
2231
2422
|
|
|
2232
2423
|
"Restore an experiment marked for deletion. This also restores associated metadata, runs, metrics,
|
|
@@ -2240,14 +2431,24 @@ class ExperimentsAPI:
|
|
|
2240
2431
|
body = request.as_dict()
|
|
2241
2432
|
self._api.do('POST', '/api/2.0/mlflow/experiments/restore', body=body)
|
|
2242
2433
|
|
|
2243
|
-
def
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2434
|
+
def restore_run(self, run_id: str, **kwargs):
|
|
2435
|
+
"""Restore a run.
|
|
2436
|
+
|
|
2437
|
+
Restores a deleted run."""
|
|
2438
|
+
request = kwargs.get('request', None)
|
|
2439
|
+
if not request: # request is not given through keyed args
|
|
2440
|
+
request = RestoreRun(run_id=run_id)
|
|
2441
|
+
body = request.as_dict()
|
|
2442
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/restore', body=body)
|
|
2443
|
+
|
|
2444
|
+
def search_experiments(self,
|
|
2445
|
+
*,
|
|
2446
|
+
filter: str = None,
|
|
2447
|
+
max_results: int = None,
|
|
2448
|
+
order_by: List[str] = None,
|
|
2449
|
+
page_token: str = None,
|
|
2450
|
+
view_type: SearchExperimentsViewType = None,
|
|
2451
|
+
**kwargs) -> Iterator[Experiment]:
|
|
2251
2452
|
"""Search experiments.
|
|
2252
2453
|
|
|
2253
2454
|
Searches for experiments that satisfy specified search criteria."""
|
|
@@ -2270,463 +2471,260 @@ class ExperimentsAPI:
|
|
|
2270
2471
|
return
|
|
2271
2472
|
body['page_token'] = json['next_page_token']
|
|
2272
2473
|
|
|
2273
|
-
def
|
|
2274
|
-
|
|
2474
|
+
def search_runs(self,
|
|
2475
|
+
*,
|
|
2476
|
+
experiment_ids: List[str] = None,
|
|
2477
|
+
filter: str = None,
|
|
2478
|
+
max_results: int = None,
|
|
2479
|
+
order_by: List[str] = None,
|
|
2480
|
+
page_token: str = None,
|
|
2481
|
+
run_view_type: SearchRunsRunViewType = None,
|
|
2482
|
+
**kwargs) -> Iterator[Run]:
|
|
2483
|
+
"""Search for runs.
|
|
2275
2484
|
|
|
2276
|
-
|
|
2485
|
+
Searches for runs that satisfy expressions.
|
|
2486
|
+
|
|
2487
|
+
Search expressions can use `mlflowMetric` and `mlflowParam` keys.","""
|
|
2277
2488
|
request = kwargs.get('request', None)
|
|
2278
2489
|
if not request: # request is not given through keyed args
|
|
2279
|
-
request =
|
|
2490
|
+
request = SearchRuns(experiment_ids=experiment_ids,
|
|
2491
|
+
filter=filter,
|
|
2492
|
+
max_results=max_results,
|
|
2493
|
+
order_by=order_by,
|
|
2494
|
+
page_token=page_token,
|
|
2495
|
+
run_view_type=run_view_type)
|
|
2280
2496
|
body = request.as_dict()
|
|
2281
|
-
self._api.do('POST', '/api/2.0/mlflow/experiments/set-experiment-tag', body=body)
|
|
2282
|
-
|
|
2283
|
-
def update(self, experiment_id: str, *, new_name: str = None, **kwargs):
|
|
2284
|
-
"""Update an experiment.
|
|
2285
|
-
|
|
2286
|
-
Updates experiment metadata."""
|
|
2287
|
-
request = kwargs.get('request', None)
|
|
2288
|
-
if not request: # request is not given through keyed args
|
|
2289
|
-
request = UpdateExperiment(experiment_id=experiment_id, new_name=new_name)
|
|
2290
|
-
body = request.as_dict()
|
|
2291
|
-
self._api.do('POST', '/api/2.0/mlflow/experiments/update', body=body)
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
class MLflowArtifactsAPI:
|
|
2295
|
-
|
|
2296
|
-
def __init__(self, api_client):
|
|
2297
|
-
self._api = api_client
|
|
2298
|
-
|
|
2299
|
-
def list(self,
|
|
2300
|
-
*,
|
|
2301
|
-
page_token: str = None,
|
|
2302
|
-
path: str = None,
|
|
2303
|
-
run_id: str = None,
|
|
2304
|
-
run_uuid: str = None,
|
|
2305
|
-
**kwargs) -> Iterator[FileInfo]:
|
|
2306
|
-
"""Get all artifacts.
|
|
2307
|
-
|
|
2308
|
-
List artifacts for a run. Takes an optional `artifact_path` prefix. If it is specified, the response
|
|
2309
|
-
contains only artifacts with the specified prefix.","""
|
|
2310
|
-
request = kwargs.get('request', None)
|
|
2311
|
-
if not request: # request is not given through keyed args
|
|
2312
|
-
request = ListArtifactsRequest(page_token=page_token, path=path, run_id=run_id, run_uuid=run_uuid)
|
|
2313
|
-
|
|
2314
|
-
query = {}
|
|
2315
|
-
if page_token: query['page_token'] = request.page_token
|
|
2316
|
-
if path: query['path'] = request.path
|
|
2317
|
-
if run_id: query['run_id'] = request.run_id
|
|
2318
|
-
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2319
2497
|
|
|
2320
2498
|
while True:
|
|
2321
|
-
json = self._api.do('
|
|
2322
|
-
if '
|
|
2499
|
+
json = self._api.do('POST', '/api/2.0/mlflow/runs/search', body=body)
|
|
2500
|
+
if 'runs' not in json or not json['runs']:
|
|
2323
2501
|
return
|
|
2324
|
-
for v in json['
|
|
2325
|
-
yield
|
|
2502
|
+
for v in json['runs']:
|
|
2503
|
+
yield Run.from_dict(v)
|
|
2326
2504
|
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2327
2505
|
return
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
class MLflowDatabricksAPI:
|
|
2332
|
-
"""These endpoints are modified versions of the MLflow API that accept additional input parameters or return
|
|
2333
|
-
additional information."""
|
|
2334
|
-
|
|
2335
|
-
def __init__(self, api_client):
|
|
2336
|
-
self._api = api_client
|
|
2337
|
-
|
|
2338
|
-
def get(self, name: str, **kwargs) -> GetResponse:
|
|
2339
|
-
"""Get model.
|
|
2340
|
-
|
|
2341
|
-
Get the details of a model. This is a Databricks Workspace version of the [MLflow endpoint] that also
|
|
2342
|
-
returns the model's Databricks Workspace ID and the permission level of the requesting user on the
|
|
2343
|
-
model.
|
|
2344
|
-
|
|
2345
|
-
[MLflow endpoint]: https://www.mlflow.org/docs/latest/rest-api.html#get-registeredmodel"""
|
|
2346
|
-
request = kwargs.get('request', None)
|
|
2347
|
-
if not request: # request is not given through keyed args
|
|
2348
|
-
request = GetMLflowDatabrickRequest(name=name)
|
|
2349
|
-
|
|
2350
|
-
query = {}
|
|
2351
|
-
if name: query['name'] = request.name
|
|
2352
|
-
|
|
2353
|
-
json = self._api.do('GET', '/api/2.0/mlflow/databricks/registered-models/get', query=query)
|
|
2354
|
-
return GetResponse.from_dict(json)
|
|
2506
|
+
body['page_token'] = json['next_page_token']
|
|
2355
2507
|
|
|
2356
|
-
def
|
|
2357
|
-
|
|
2358
|
-
version: str,
|
|
2359
|
-
stage: Stage,
|
|
2360
|
-
archive_existing_versions: bool,
|
|
2361
|
-
*,
|
|
2362
|
-
comment: str = None,
|
|
2363
|
-
**kwargs) -> TransitionStageResponse:
|
|
2364
|
-
"""Transition a stage.
|
|
2365
|
-
|
|
2366
|
-
Transition a model version's stage. This is a Databricks Workspace version of the [MLflow endpoint]
|
|
2367
|
-
that also accepts a comment associated with the transition to be recorded.",
|
|
2508
|
+
def set_experiment_tag(self, experiment_id: str, key: str, value: str, **kwargs):
|
|
2509
|
+
"""Set a tag.
|
|
2368
2510
|
|
|
2369
|
-
|
|
2511
|
+
Sets a tag on an experiment. Experiment tags are metadata that can be updated."""
|
|
2370
2512
|
request = kwargs.get('request', None)
|
|
2371
2513
|
if not request: # request is not given through keyed args
|
|
2372
|
-
request =
|
|
2373
|
-
archive_existing_versions=archive_existing_versions,
|
|
2374
|
-
comment=comment,
|
|
2375
|
-
name=name,
|
|
2376
|
-
stage=stage,
|
|
2377
|
-
version=version)
|
|
2514
|
+
request = SetExperimentTag(experiment_id=experiment_id, key=key, value=value)
|
|
2378
2515
|
body = request.as_dict()
|
|
2516
|
+
self._api.do('POST', '/api/2.0/mlflow/experiments/set-experiment-tag', body=body)
|
|
2379
2517
|
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
class MLflowMetricsAPI:
|
|
2385
|
-
|
|
2386
|
-
def __init__(self, api_client):
|
|
2387
|
-
self._api = api_client
|
|
2388
|
-
|
|
2389
|
-
def get_history(self,
|
|
2390
|
-
metric_key: str,
|
|
2391
|
-
*,
|
|
2392
|
-
max_results: int = None,
|
|
2393
|
-
page_token: str = None,
|
|
2394
|
-
run_id: str = None,
|
|
2395
|
-
run_uuid: str = None,
|
|
2396
|
-
**kwargs) -> GetMetricHistoryResponse:
|
|
2397
|
-
"""Get history of a given metric within a run.
|
|
2398
|
-
|
|
2399
|
-
Gets a list of all values for the specified metric for a given run."""
|
|
2400
|
-
request = kwargs.get('request', None)
|
|
2401
|
-
if not request: # request is not given through keyed args
|
|
2402
|
-
request = GetHistoryRequest(max_results=max_results,
|
|
2403
|
-
metric_key=metric_key,
|
|
2404
|
-
page_token=page_token,
|
|
2405
|
-
run_id=run_id,
|
|
2406
|
-
run_uuid=run_uuid)
|
|
2407
|
-
|
|
2408
|
-
query = {}
|
|
2409
|
-
if max_results: query['max_results'] = request.max_results
|
|
2410
|
-
if metric_key: query['metric_key'] = request.metric_key
|
|
2411
|
-
if page_token: query['page_token'] = request.page_token
|
|
2412
|
-
if run_id: query['run_id'] = request.run_id
|
|
2413
|
-
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2414
|
-
|
|
2415
|
-
json = self._api.do('GET', '/api/2.0/mlflow/metrics/get-history', query=query)
|
|
2416
|
-
return GetMetricHistoryResponse.from_dict(json)
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
class MLflowRunsAPI:
|
|
2420
|
-
|
|
2421
|
-
def __init__(self, api_client):
|
|
2422
|
-
self._api = api_client
|
|
2423
|
-
|
|
2424
|
-
def create(self,
|
|
2425
|
-
*,
|
|
2426
|
-
experiment_id: str = None,
|
|
2427
|
-
start_time: int = None,
|
|
2428
|
-
tags: List[RunTag] = None,
|
|
2429
|
-
user_id: str = None,
|
|
2430
|
-
**kwargs) -> CreateRunResponse:
|
|
2431
|
-
"""Create a run.
|
|
2518
|
+
def set_tag(self, key: str, value: str, *, run_id: str = None, run_uuid: str = None, **kwargs):
|
|
2519
|
+
"""Set a tag.
|
|
2432
2520
|
|
|
2433
|
-
|
|
2434
|
-
data ETL pipeline. MLflow uses runs to track the `mlflowParam`, `mlflowMetric` and `mlflowRunTag`
|
|
2435
|
-
associated with a single execution."""
|
|
2521
|
+
Sets a tag on a run. Tags are run metadata that can be updated during a run and after a run completes."""
|
|
2436
2522
|
request = kwargs.get('request', None)
|
|
2437
2523
|
if not request: # request is not given through keyed args
|
|
2438
|
-
request =
|
|
2439
|
-
start_time=start_time,
|
|
2440
|
-
tags=tags,
|
|
2441
|
-
user_id=user_id)
|
|
2524
|
+
request = SetTag(key=key, run_id=run_id, run_uuid=run_uuid, value=value)
|
|
2442
2525
|
body = request.as_dict()
|
|
2526
|
+
self._api.do('POST', '/api/2.0/mlflow/runs/set-tag', body=body)
|
|
2443
2527
|
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
def delete(self, run_id: str, **kwargs):
|
|
2448
|
-
"""Delete a run.
|
|
2528
|
+
def update_experiment(self, experiment_id: str, *, new_name: str = None, **kwargs):
|
|
2529
|
+
"""Update an experiment.
|
|
2449
2530
|
|
|
2450
|
-
|
|
2531
|
+
Updates experiment metadata."""
|
|
2451
2532
|
request = kwargs.get('request', None)
|
|
2452
2533
|
if not request: # request is not given through keyed args
|
|
2453
|
-
request =
|
|
2534
|
+
request = UpdateExperiment(experiment_id=experiment_id, new_name=new_name)
|
|
2454
2535
|
body = request.as_dict()
|
|
2455
|
-
self._api.do('POST', '/api/2.0/mlflow/
|
|
2536
|
+
self._api.do('POST', '/api/2.0/mlflow/experiments/update', body=body)
|
|
2456
2537
|
|
|
2457
|
-
def
|
|
2458
|
-
|
|
2538
|
+
def update_run(self,
|
|
2539
|
+
*,
|
|
2540
|
+
end_time: int = None,
|
|
2541
|
+
run_id: str = None,
|
|
2542
|
+
run_uuid: str = None,
|
|
2543
|
+
status: UpdateRunStatus = None,
|
|
2544
|
+
**kwargs) -> UpdateRunResponse:
|
|
2545
|
+
"""Update a run.
|
|
2459
2546
|
|
|
2460
|
-
|
|
2461
|
-
completes."""
|
|
2547
|
+
Updates run metadata."""
|
|
2462
2548
|
request = kwargs.get('request', None)
|
|
2463
2549
|
if not request: # request is not given through keyed args
|
|
2464
|
-
request =
|
|
2550
|
+
request = UpdateRun(end_time=end_time, run_id=run_id, run_uuid=run_uuid, status=status)
|
|
2465
2551
|
body = request.as_dict()
|
|
2466
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/delete-tag', body=body)
|
|
2467
2552
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
"Gets the metadata, metrics, params, and tags for a run. In the case where multiple metrics with the
|
|
2472
|
-
same key are logged for a run, return only the value with the latest timestamp.
|
|
2473
|
-
|
|
2474
|
-
If there are multiple values with the latest timestamp, return the maximum of these values."""
|
|
2475
|
-
request = kwargs.get('request', None)
|
|
2476
|
-
if not request: # request is not given through keyed args
|
|
2477
|
-
request = GetRunRequest(run_id=run_id, run_uuid=run_uuid)
|
|
2553
|
+
json = self._api.do('POST', '/api/2.0/mlflow/runs/update', body=body)
|
|
2554
|
+
return UpdateRunResponse.from_dict(json)
|
|
2478
2555
|
|
|
2479
|
-
query = {}
|
|
2480
|
-
if run_id: query['run_id'] = request.run_id
|
|
2481
|
-
if run_uuid: query['run_uuid'] = request.run_uuid
|
|
2482
2556
|
|
|
2483
|
-
|
|
2484
|
-
return GetRunResponse.from_dict(json)
|
|
2557
|
+
class ModelRegistryAPI:
|
|
2485
2558
|
|
|
2486
|
-
def
|
|
2487
|
-
|
|
2488
|
-
metrics: List[Metric] = None,
|
|
2489
|
-
params: List[Param] = None,
|
|
2490
|
-
run_id: str = None,
|
|
2491
|
-
tags: List[RunTag] = None,
|
|
2492
|
-
**kwargs):
|
|
2493
|
-
"""Log a batch.
|
|
2494
|
-
|
|
2495
|
-
Logs a batch of metrics, params, and tags for a run. If any data failed to be persisted, the server
|
|
2496
|
-
will respond with an error (non-200 status code).
|
|
2497
|
-
|
|
2498
|
-
In case of error (due to internal server error or an invalid request), partial data may be written.
|
|
2499
|
-
|
|
2500
|
-
You can write metrics, params, and tags in interleaving fashion, but within a given entity type are
|
|
2501
|
-
guaranteed to follow the order specified in the request body.
|
|
2502
|
-
|
|
2503
|
-
The overwrite behavior for metrics, params, and tags is as follows:
|
|
2504
|
-
|
|
2505
|
-
* Metrics: metric values are never overwritten. Logging a metric (key, value, timestamp) appends to
|
|
2506
|
-
the set of values for the metric with the provided key.
|
|
2507
|
-
|
|
2508
|
-
* Tags: tag values can be overwritten by successive writes to the same tag key. That is, if multiple
|
|
2509
|
-
tag values with the same key are provided in the same API request, the last-provided tag value is
|
|
2510
|
-
written. Logging the same tag (key, value) is permitted. Specifically, logging a tag is idempotent.
|
|
2511
|
-
|
|
2512
|
-
* Parameters: once written, param values cannot be changed (attempting to overwrite a param value will
|
|
2513
|
-
result in an error). However, logging the same param (key, value) is permitted. Specifically, logging
|
|
2514
|
-
a param is idempotent.
|
|
2515
|
-
|
|
2516
|
-
Request Limits ------------------------------- A single JSON-serialized API request may be up to 1 MB
|
|
2517
|
-
in size and contain:
|
|
2518
|
-
|
|
2519
|
-
* No more than 1000 metrics, params, and tags in total * Up to 1000 metrics - Up to 100 params * Up to
|
|
2520
|
-
100 tags
|
|
2521
|
-
|
|
2522
|
-
For example, a valid request might contain 900 metrics, 50 params, and 50 tags, but logging 900
|
|
2523
|
-
metrics, 50 params, and 51 tags is invalid.
|
|
2524
|
-
|
|
2525
|
-
The following limits also apply to metric, param, and tag keys and values:
|
|
2526
|
-
|
|
2527
|
-
* Metric keyes, param keys, and tag keys can be up to 250 characters in length * Parameter and tag
|
|
2528
|
-
values can be up to 250 characters in length"""
|
|
2529
|
-
request = kwargs.get('request', None)
|
|
2530
|
-
if not request: # request is not given through keyed args
|
|
2531
|
-
request = LogBatch(metrics=metrics, params=params, run_id=run_id, tags=tags)
|
|
2532
|
-
body = request.as_dict()
|
|
2533
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/log-batch', body=body)
|
|
2559
|
+
def __init__(self, api_client):
|
|
2560
|
+
self._api = api_client
|
|
2534
2561
|
|
|
2535
|
-
def
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
"""Log a metric.
|
|
2562
|
+
def approve_transition_request(self,
|
|
2563
|
+
name: str,
|
|
2564
|
+
version: str,
|
|
2565
|
+
stage: Stage,
|
|
2566
|
+
archive_existing_versions: bool,
|
|
2567
|
+
*,
|
|
2568
|
+
comment: str = None,
|
|
2569
|
+
**kwargs) -> ApproveTransitionRequestResponse:
|
|
2570
|
+
"""Approve transition request.
|
|
2545
2571
|
|
|
2546
|
-
|
|
2547
|
-
timestamp. Examples include the various metrics that represent ML model accuracy. A metric can be
|
|
2548
|
-
logged multiple times."""
|
|
2572
|
+
Approves a model version stage transition request."""
|
|
2549
2573
|
request = kwargs.get('request', None)
|
|
2550
2574
|
if not request: # request is not given through keyed args
|
|
2551
|
-
request =
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
value=value)
|
|
2575
|
+
request = ApproveTransitionRequest(archive_existing_versions=archive_existing_versions,
|
|
2576
|
+
comment=comment,
|
|
2577
|
+
name=name,
|
|
2578
|
+
stage=stage,
|
|
2579
|
+
version=version)
|
|
2557
2580
|
body = request.as_dict()
|
|
2558
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/log-metric', body=body)
|
|
2559
2581
|
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
**NOTE:** Experimental: This API may change or be removed in a future release without warning."""
|
|
2564
|
-
request = kwargs.get('request', None)
|
|
2565
|
-
if not request: # request is not given through keyed args
|
|
2566
|
-
request = LogModel(model_json=model_json, run_id=run_id)
|
|
2567
|
-
body = request.as_dict()
|
|
2568
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/log-model', body=body)
|
|
2582
|
+
json = self._api.do('POST', '/api/2.0/mlflow/transition-requests/approve', body=body)
|
|
2583
|
+
return ApproveTransitionRequestResponse.from_dict(json)
|
|
2569
2584
|
|
|
2570
|
-
def
|
|
2571
|
-
"""
|
|
2585
|
+
def create_comment(self, name: str, version: str, comment: str, **kwargs) -> CreateCommentResponse:
|
|
2586
|
+
"""Post a comment.
|
|
2572
2587
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
param can be logged only once for a run."""
|
|
2588
|
+
Posts a comment on a model version. A comment can be submitted either by a user or programmatically to
|
|
2589
|
+
display relevant information about the model. For example, test results or deployment errors."""
|
|
2576
2590
|
request = kwargs.get('request', None)
|
|
2577
2591
|
if not request: # request is not given through keyed args
|
|
2578
|
-
request =
|
|
2592
|
+
request = CreateComment(comment=comment, name=name, version=version)
|
|
2579
2593
|
body = request.as_dict()
|
|
2580
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/log-parameter', body=body)
|
|
2581
2594
|
|
|
2582
|
-
|
|
2583
|
-
|
|
2595
|
+
json = self._api.do('POST', '/api/2.0/mlflow/comments/create', body=body)
|
|
2596
|
+
return CreateCommentResponse.from_dict(json)
|
|
2597
|
+
|
|
2598
|
+
def create_model(self,
|
|
2599
|
+
name: str,
|
|
2600
|
+
*,
|
|
2601
|
+
description: str = None,
|
|
2602
|
+
tags: List[ModelTag] = None,
|
|
2603
|
+
**kwargs) -> CreateModelResponse:
|
|
2604
|
+
"""Create a model.
|
|
2584
2605
|
|
|
2585
|
-
|
|
2606
|
+
Creates a new registered model with the name specified in the request body.
|
|
2607
|
+
|
|
2608
|
+
Throws `RESOURCE_ALREADY_EXISTS` if a registered model with the given name exists."""
|
|
2586
2609
|
request = kwargs.get('request', None)
|
|
2587
2610
|
if not request: # request is not given through keyed args
|
|
2588
|
-
request =
|
|
2611
|
+
request = CreateModelRequest(description=description, name=name, tags=tags)
|
|
2589
2612
|
body = request.as_dict()
|
|
2590
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/restore', body=body)
|
|
2591
2613
|
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2614
|
+
json = self._api.do('POST', '/api/2.0/mlflow/registered-models/create', body=body)
|
|
2615
|
+
return CreateModelResponse.from_dict(json)
|
|
2616
|
+
|
|
2617
|
+
def create_model_version(self,
|
|
2618
|
+
name: str,
|
|
2619
|
+
source: str,
|
|
2620
|
+
*,
|
|
2621
|
+
description: str = None,
|
|
2622
|
+
run_id: str = None,
|
|
2623
|
+
run_link: str = None,
|
|
2624
|
+
tags: List[ModelVersionTag] = None,
|
|
2625
|
+
**kwargs) -> CreateModelVersionResponse:
|
|
2626
|
+
"""Create a model version.
|
|
2604
2627
|
|
|
2605
|
-
|
|
2628
|
+
Creates a model version."""
|
|
2606
2629
|
request = kwargs.get('request', None)
|
|
2607
2630
|
if not request: # request is not given through keyed args
|
|
2608
|
-
request =
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2631
|
+
request = CreateModelVersionRequest(description=description,
|
|
2632
|
+
name=name,
|
|
2633
|
+
run_id=run_id,
|
|
2634
|
+
run_link=run_link,
|
|
2635
|
+
source=source,
|
|
2636
|
+
tags=tags)
|
|
2614
2637
|
body = request.as_dict()
|
|
2615
2638
|
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
if 'runs' not in json or not json['runs']:
|
|
2619
|
-
return
|
|
2620
|
-
for v in json['runs']:
|
|
2621
|
-
yield Run.from_dict(v)
|
|
2622
|
-
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2623
|
-
return
|
|
2624
|
-
body['page_token'] = json['next_page_token']
|
|
2639
|
+
json = self._api.do('POST', '/api/2.0/mlflow/model-versions/create', body=body)
|
|
2640
|
+
return CreateModelVersionResponse.from_dict(json)
|
|
2625
2641
|
|
|
2626
|
-
def
|
|
2627
|
-
|
|
2642
|
+
def create_transition_request(self,
|
|
2643
|
+
name: str,
|
|
2644
|
+
version: str,
|
|
2645
|
+
stage: Stage,
|
|
2646
|
+
*,
|
|
2647
|
+
comment: str = None,
|
|
2648
|
+
**kwargs) -> CreateTransitionRequestResponse:
|
|
2649
|
+
"""Make a transition request.
|
|
2628
2650
|
|
|
2629
|
-
|
|
2651
|
+
Creates a model version stage transition request."""
|
|
2630
2652
|
request = kwargs.get('request', None)
|
|
2631
2653
|
if not request: # request is not given through keyed args
|
|
2632
|
-
request =
|
|
2654
|
+
request = CreateTransitionRequest(comment=comment, name=name, stage=stage, version=version)
|
|
2633
2655
|
body = request.as_dict()
|
|
2634
|
-
self._api.do('POST', '/api/2.0/mlflow/runs/set-tag', body=body)
|
|
2635
2656
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2657
|
+
json = self._api.do('POST', '/api/2.0/mlflow/transition-requests/create', body=body)
|
|
2658
|
+
return CreateTransitionRequestResponse.from_dict(json)
|
|
2659
|
+
|
|
2660
|
+
def create_webhook(self,
|
|
2661
|
+
events: List[RegistryWebhookEvent],
|
|
2662
|
+
*,
|
|
2663
|
+
description: str = None,
|
|
2664
|
+
http_url_spec: HttpUrlSpec = None,
|
|
2665
|
+
job_spec: JobSpec = None,
|
|
2666
|
+
model_name: str = None,
|
|
2667
|
+
status: RegistryWebhookStatus = None,
|
|
2668
|
+
**kwargs) -> CreateWebhookResponse:
|
|
2669
|
+
"""Create a webhook.
|
|
2644
2670
|
|
|
2645
|
-
|
|
2646
|
-
request = kwargs.get('request', None)
|
|
2647
|
-
if not request: # request is not given through keyed args
|
|
2648
|
-
request = UpdateRun(end_time=end_time, run_id=run_id, run_uuid=run_uuid, status=status)
|
|
2649
|
-
body = request.as_dict()
|
|
2650
|
-
|
|
2651
|
-
json = self._api.do('POST', '/api/2.0/mlflow/runs/update', body=body)
|
|
2652
|
-
return UpdateRunResponse.from_dict(json)
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
class ModelVersionCommentsAPI:
|
|
2656
|
-
|
|
2657
|
-
def __init__(self, api_client):
|
|
2658
|
-
self._api = api_client
|
|
2659
|
-
|
|
2660
|
-
def create(self, name: str, version: str, comment: str, **kwargs) -> CreateResponse:
|
|
2661
|
-
"""Post a comment.
|
|
2671
|
+
**NOTE**: This endpoint is in Public Preview.
|
|
2662
2672
|
|
|
2663
|
-
|
|
2664
|
-
display relevant information about the model. For example, test results or deployment errors."""
|
|
2673
|
+
Creates a registry webhook."""
|
|
2665
2674
|
request = kwargs.get('request', None)
|
|
2666
2675
|
if not request: # request is not given through keyed args
|
|
2667
|
-
request =
|
|
2676
|
+
request = CreateRegistryWebhook(description=description,
|
|
2677
|
+
events=events,
|
|
2678
|
+
http_url_spec=http_url_spec,
|
|
2679
|
+
job_spec=job_spec,
|
|
2680
|
+
model_name=model_name,
|
|
2681
|
+
status=status)
|
|
2668
2682
|
body = request.as_dict()
|
|
2669
2683
|
|
|
2670
|
-
json = self._api.do('POST', '/api/2.0/mlflow/
|
|
2671
|
-
return
|
|
2684
|
+
json = self._api.do('POST', '/api/2.0/mlflow/registry-webhooks/create', body=body)
|
|
2685
|
+
return CreateWebhookResponse.from_dict(json)
|
|
2672
2686
|
|
|
2673
|
-
def
|
|
2687
|
+
def delete_comment(self, id: str, **kwargs):
|
|
2674
2688
|
"""Delete a comment.
|
|
2675
2689
|
|
|
2676
2690
|
Deletes a comment on a model version."""
|
|
2677
2691
|
request = kwargs.get('request', None)
|
|
2678
2692
|
if not request: # request is not given through keyed args
|
|
2679
|
-
request =
|
|
2693
|
+
request = DeleteCommentRequest(id=id)
|
|
2680
2694
|
|
|
2681
2695
|
query = {}
|
|
2682
2696
|
if id: query['id'] = request.id
|
|
2683
2697
|
|
|
2684
2698
|
self._api.do('DELETE', '/api/2.0/mlflow/comments/delete', query=query)
|
|
2685
2699
|
|
|
2686
|
-
def
|
|
2687
|
-
"""
|
|
2700
|
+
def delete_model(self, name: str, **kwargs):
|
|
2701
|
+
"""Delete a model.
|
|
2688
2702
|
|
|
2689
|
-
|
|
2703
|
+
Deletes a registered model."""
|
|
2690
2704
|
request = kwargs.get('request', None)
|
|
2691
2705
|
if not request: # request is not given through keyed args
|
|
2692
|
-
request =
|
|
2693
|
-
body = request.as_dict()
|
|
2694
|
-
|
|
2695
|
-
json = self._api.do('POST', '/api/2.0/mlflow/comments/update', body=body)
|
|
2696
|
-
return UpdateResponse.from_dict(json)
|
|
2706
|
+
request = DeleteModelRequest(name=name)
|
|
2697
2707
|
|
|
2708
|
+
query = {}
|
|
2709
|
+
if name: query['name'] = request.name
|
|
2698
2710
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
def __init__(self, api_client):
|
|
2702
|
-
self._api = api_client
|
|
2711
|
+
self._api.do('DELETE', '/api/2.0/mlflow/registered-models/delete', query=query)
|
|
2703
2712
|
|
|
2704
|
-
def
|
|
2705
|
-
|
|
2706
|
-
source: str,
|
|
2707
|
-
*,
|
|
2708
|
-
description: str = None,
|
|
2709
|
-
run_id: str = None,
|
|
2710
|
-
run_link: str = None,
|
|
2711
|
-
tags: List[ModelVersionTag] = None,
|
|
2712
|
-
**kwargs) -> CreateModelVersionResponse:
|
|
2713
|
-
"""Create a model version.
|
|
2713
|
+
def delete_model_tag(self, name: str, key: str, **kwargs):
|
|
2714
|
+
"""Delete a model tag.
|
|
2714
2715
|
|
|
2715
|
-
|
|
2716
|
+
Deletes the tag for a registered model."""
|
|
2716
2717
|
request = kwargs.get('request', None)
|
|
2717
2718
|
if not request: # request is not given through keyed args
|
|
2718
|
-
request =
|
|
2719
|
-
name=name,
|
|
2720
|
-
run_id=run_id,
|
|
2721
|
-
run_link=run_link,
|
|
2722
|
-
source=source,
|
|
2723
|
-
tags=tags)
|
|
2724
|
-
body = request.as_dict()
|
|
2719
|
+
request = DeleteModelTagRequest(key=key, name=name)
|
|
2725
2720
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2721
|
+
query = {}
|
|
2722
|
+
if key: query['key'] = request.key
|
|
2723
|
+
if name: query['name'] = request.name
|
|
2724
|
+
|
|
2725
|
+
self._api.do('DELETE', '/api/2.0/mlflow/registered-models/delete-tag', query=query)
|
|
2728
2726
|
|
|
2729
|
-
def
|
|
2727
|
+
def delete_model_version(self, name: str, version: str, **kwargs):
|
|
2730
2728
|
"""Delete a model version.
|
|
2731
2729
|
|
|
2732
2730
|
Deletes a model version."""
|
|
@@ -2740,7 +2738,7 @@ class ModelVersionsAPI:
|
|
|
2740
2738
|
|
|
2741
2739
|
self._api.do('DELETE', '/api/2.0/mlflow/model-versions/delete', query=query)
|
|
2742
2740
|
|
|
2743
|
-
def
|
|
2741
|
+
def delete_model_version_tag(self, name: str, version: str, key: str, **kwargs):
|
|
2744
2742
|
"""Delete a model version tag.
|
|
2745
2743
|
|
|
2746
2744
|
Deletes a model version tag."""
|
|
@@ -2755,190 +2753,117 @@ class ModelVersionsAPI:
|
|
|
2755
2753
|
|
|
2756
2754
|
self._api.do('DELETE', '/api/2.0/mlflow/model-versions/delete-tag', query=query)
|
|
2757
2755
|
|
|
2758
|
-
def
|
|
2759
|
-
|
|
2756
|
+
def delete_transition_request(self,
|
|
2757
|
+
name: str,
|
|
2758
|
+
version: str,
|
|
2759
|
+
stage: str,
|
|
2760
|
+
creator: str,
|
|
2761
|
+
*,
|
|
2762
|
+
comment: str = None,
|
|
2763
|
+
**kwargs):
|
|
2764
|
+
"""Delete a ransition request.
|
|
2760
2765
|
|
|
2761
|
-
|
|
2766
|
+
Cancels a model version stage transition request."""
|
|
2762
2767
|
request = kwargs.get('request', None)
|
|
2763
2768
|
if not request: # request is not given through keyed args
|
|
2764
|
-
request =
|
|
2769
|
+
request = DeleteTransitionRequestRequest(comment=comment,
|
|
2770
|
+
creator=creator,
|
|
2771
|
+
name=name,
|
|
2772
|
+
stage=stage,
|
|
2773
|
+
version=version)
|
|
2765
2774
|
|
|
2766
2775
|
query = {}
|
|
2776
|
+
if comment: query['comment'] = request.comment
|
|
2777
|
+
if creator: query['creator'] = request.creator
|
|
2767
2778
|
if name: query['name'] = request.name
|
|
2779
|
+
if stage: query['stage'] = request.stage
|
|
2768
2780
|
if version: query['version'] = request.version
|
|
2769
2781
|
|
|
2770
|
-
|
|
2771
|
-
return GetModelVersionResponse.from_dict(json)
|
|
2782
|
+
self._api.do('DELETE', '/api/2.0/mlflow/transition-requests/delete', query=query)
|
|
2772
2783
|
|
|
2773
|
-
def
|
|
2774
|
-
"""
|
|
2784
|
+
def delete_webhook(self, *, id: str = None, **kwargs):
|
|
2785
|
+
"""Delete a webhook.
|
|
2775
2786
|
|
|
2776
|
-
|
|
2777
|
-
request = kwargs.get('request', None)
|
|
2778
|
-
if not request: # request is not given through keyed args
|
|
2779
|
-
request = GetModelVersionDownloadUriRequest(name=name, version=version)
|
|
2780
|
-
|
|
2781
|
-
query = {}
|
|
2782
|
-
if name: query['name'] = request.name
|
|
2783
|
-
if version: query['version'] = request.version
|
|
2784
|
-
|
|
2785
|
-
json = self._api.do('GET', '/api/2.0/mlflow/model-versions/get-download-uri', query=query)
|
|
2786
|
-
return GetModelVersionDownloadUriResponse.from_dict(json)
|
|
2787
|
-
|
|
2788
|
-
def search(self,
|
|
2789
|
-
*,
|
|
2790
|
-
filter: str = None,
|
|
2791
|
-
max_results: int = None,
|
|
2792
|
-
order_by: List[str] = None,
|
|
2793
|
-
page_token: str = None,
|
|
2794
|
-
**kwargs) -> Iterator[ModelVersion]:
|
|
2795
|
-
"""Searches model versions.
|
|
2787
|
+
**NOTE:** This endpoint is in Public Preview.
|
|
2796
2788
|
|
|
2797
|
-
|
|
2789
|
+
Deletes a registry webhook."""
|
|
2798
2790
|
request = kwargs.get('request', None)
|
|
2799
2791
|
if not request: # request is not given through keyed args
|
|
2800
|
-
request =
|
|
2801
|
-
max_results=max_results,
|
|
2802
|
-
order_by=order_by,
|
|
2803
|
-
page_token=page_token)
|
|
2792
|
+
request = DeleteWebhookRequest(id=id)
|
|
2804
2793
|
|
|
2805
2794
|
query = {}
|
|
2806
|
-
if
|
|
2807
|
-
if max_results: query['max_results'] = request.max_results
|
|
2808
|
-
if order_by: query['order_by'] = [v for v in request.order_by]
|
|
2809
|
-
if page_token: query['page_token'] = request.page_token
|
|
2810
|
-
|
|
2811
|
-
while True:
|
|
2812
|
-
json = self._api.do('GET', '/api/2.0/mlflow/model-versions/search', query=query)
|
|
2813
|
-
if 'model_versions' not in json or not json['model_versions']:
|
|
2814
|
-
return
|
|
2815
|
-
for v in json['model_versions']:
|
|
2816
|
-
yield ModelVersion.from_dict(v)
|
|
2817
|
-
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2818
|
-
return
|
|
2819
|
-
query['page_token'] = json['next_page_token']
|
|
2820
|
-
|
|
2821
|
-
def set_tag(self, name: str, version: str, key: str, value: str, **kwargs):
|
|
2822
|
-
"""Set a version tag.
|
|
2823
|
-
|
|
2824
|
-
Sets a model version tag."""
|
|
2825
|
-
request = kwargs.get('request', None)
|
|
2826
|
-
if not request: # request is not given through keyed args
|
|
2827
|
-
request = SetModelVersionTagRequest(key=key, name=name, value=value, version=version)
|
|
2828
|
-
body = request.as_dict()
|
|
2829
|
-
self._api.do('POST', '/api/2.0/mlflow/model-versions/set-tag', body=body)
|
|
2830
|
-
|
|
2831
|
-
def transition_stage(self, name: str, version: str, stage: str, archive_existing_versions: bool,
|
|
2832
|
-
**kwargs) -> TransitionModelVersionStageResponse:
|
|
2833
|
-
"""Transition a stage.
|
|
2834
|
-
|
|
2835
|
-
Transition to the next model stage."""
|
|
2836
|
-
request = kwargs.get('request', None)
|
|
2837
|
-
if not request: # request is not given through keyed args
|
|
2838
|
-
request = TransitionModelVersionStage(archive_existing_versions=archive_existing_versions,
|
|
2839
|
-
name=name,
|
|
2840
|
-
stage=stage,
|
|
2841
|
-
version=version)
|
|
2842
|
-
body = request.as_dict()
|
|
2843
|
-
|
|
2844
|
-
json = self._api.do('POST', '/api/2.0/mlflow/model-versions/transition-stage', body=body)
|
|
2845
|
-
return TransitionModelVersionStageResponse.from_dict(json)
|
|
2846
|
-
|
|
2847
|
-
def update(self, name: str, version: str, *, description: str = None, **kwargs):
|
|
2848
|
-
"""Update model version.
|
|
2849
|
-
|
|
2850
|
-
Updates the model version."""
|
|
2851
|
-
request = kwargs.get('request', None)
|
|
2852
|
-
if not request: # request is not given through keyed args
|
|
2853
|
-
request = UpdateModelVersionRequest(description=description, name=name, version=version)
|
|
2854
|
-
body = request.as_dict()
|
|
2855
|
-
self._api.do('PATCH', '/api/2.0/mlflow/model-versions/update', body=body)
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
class RegisteredModelsAPI:
|
|
2795
|
+
if id: query['id'] = request.id
|
|
2859
2796
|
|
|
2860
|
-
|
|
2861
|
-
self._api = api_client
|
|
2797
|
+
self._api.do('DELETE', '/api/2.0/mlflow/registry-webhooks/delete', query=query)
|
|
2862
2798
|
|
|
2863
|
-
def
|
|
2864
|
-
|
|
2865
|
-
*,
|
|
2866
|
-
description: str = None,
|
|
2867
|
-
tags: List[RegisteredModelTag] = None,
|
|
2868
|
-
**kwargs) -> CreateRegisteredModelResponse:
|
|
2869
|
-
"""Create a model.
|
|
2870
|
-
|
|
2871
|
-
Creates a new registered model with the name specified in the request body.
|
|
2799
|
+
def get_latest_versions(self, name: str, *, stages: List[str] = None, **kwargs) -> Iterator[ModelVersion]:
|
|
2800
|
+
"""Get the latest version.
|
|
2872
2801
|
|
|
2873
|
-
|
|
2802
|
+
Gets the latest version of a registered model."""
|
|
2874
2803
|
request = kwargs.get('request', None)
|
|
2875
2804
|
if not request: # request is not given through keyed args
|
|
2876
|
-
request =
|
|
2805
|
+
request = GetLatestVersionsRequest(name=name, stages=stages)
|
|
2877
2806
|
body = request.as_dict()
|
|
2878
2807
|
|
|
2879
|
-
json = self._api.do('POST', '/api/2.0/mlflow/registered-models/
|
|
2880
|
-
return
|
|
2808
|
+
json = self._api.do('POST', '/api/2.0/mlflow/registered-models/get-latest-versions', body=body)
|
|
2809
|
+
return [ModelVersion.from_dict(v) for v in json.get('model_versions', [])]
|
|
2881
2810
|
|
|
2882
|
-
def
|
|
2883
|
-
"""
|
|
2811
|
+
def get_model(self, name: str, **kwargs) -> GetModelResponse:
|
|
2812
|
+
"""Get model.
|
|
2884
2813
|
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
request = DeleteRegisteredModelRequest(name=name)
|
|
2889
|
-
|
|
2890
|
-
query = {}
|
|
2891
|
-
if name: query['name'] = request.name
|
|
2892
|
-
|
|
2893
|
-
self._api.do('DELETE', '/api/2.0/mlflow/registered-models/delete', query=query)
|
|
2894
|
-
|
|
2895
|
-
def delete_tag(self, name: str, key: str, **kwargs):
|
|
2896
|
-
"""Delete a model tag.
|
|
2814
|
+
Get the details of a model. This is a Databricks Workspace version of the [MLflow endpoint] that also
|
|
2815
|
+
returns the model's Databricks Workspace ID and the permission level of the requesting user on the
|
|
2816
|
+
model.
|
|
2897
2817
|
|
|
2898
|
-
|
|
2818
|
+
[MLflow endpoint]: https://www.mlflow.org/docs/latest/rest-api.html#get-registeredmodel"""
|
|
2899
2819
|
request = kwargs.get('request', None)
|
|
2900
2820
|
if not request: # request is not given through keyed args
|
|
2901
|
-
request =
|
|
2821
|
+
request = GetModelRequest(name=name)
|
|
2902
2822
|
|
|
2903
2823
|
query = {}
|
|
2904
|
-
if key: query['key'] = request.key
|
|
2905
2824
|
if name: query['name'] = request.name
|
|
2906
2825
|
|
|
2907
|
-
self._api.do('
|
|
2826
|
+
json = self._api.do('GET', '/api/2.0/mlflow/databricks/registered-models/get', query=query)
|
|
2827
|
+
return GetModelResponse.from_dict(json)
|
|
2908
2828
|
|
|
2909
|
-
def
|
|
2910
|
-
"""Get a model.
|
|
2829
|
+
def get_model_version(self, name: str, version: str, **kwargs) -> GetModelVersionResponse:
|
|
2830
|
+
"""Get a model version.
|
|
2911
2831
|
|
|
2912
|
-
|
|
2832
|
+
Get a model version."""
|
|
2913
2833
|
request = kwargs.get('request', None)
|
|
2914
2834
|
if not request: # request is not given through keyed args
|
|
2915
|
-
request =
|
|
2835
|
+
request = GetModelVersionRequest(name=name, version=version)
|
|
2916
2836
|
|
|
2917
2837
|
query = {}
|
|
2918
2838
|
if name: query['name'] = request.name
|
|
2839
|
+
if version: query['version'] = request.version
|
|
2919
2840
|
|
|
2920
|
-
json = self._api.do('GET', '/api/2.0/mlflow/
|
|
2921
|
-
return
|
|
2841
|
+
json = self._api.do('GET', '/api/2.0/mlflow/model-versions/get', query=query)
|
|
2842
|
+
return GetModelVersionResponse.from_dict(json)
|
|
2922
2843
|
|
|
2923
|
-
def
|
|
2924
|
-
|
|
2844
|
+
def get_model_version_download_uri(self, name: str, version: str,
|
|
2845
|
+
**kwargs) -> GetModelVersionDownloadUriResponse:
|
|
2846
|
+
"""Get a model version URI.
|
|
2925
2847
|
|
|
2926
|
-
Gets
|
|
2848
|
+
Gets a URI to download the model version."""
|
|
2927
2849
|
request = kwargs.get('request', None)
|
|
2928
2850
|
if not request: # request is not given through keyed args
|
|
2929
|
-
request =
|
|
2930
|
-
body = request.as_dict()
|
|
2851
|
+
request = GetModelVersionDownloadUriRequest(name=name, version=version)
|
|
2931
2852
|
|
|
2932
|
-
|
|
2933
|
-
|
|
2853
|
+
query = {}
|
|
2854
|
+
if name: query['name'] = request.name
|
|
2855
|
+
if version: query['version'] = request.version
|
|
2856
|
+
|
|
2857
|
+
json = self._api.do('GET', '/api/2.0/mlflow/model-versions/get-download-uri', query=query)
|
|
2858
|
+
return GetModelVersionDownloadUriResponse.from_dict(json)
|
|
2934
2859
|
|
|
2935
|
-
def
|
|
2860
|
+
def list_models(self, *, max_results: int = None, page_token: str = None, **kwargs) -> Iterator[Model]:
|
|
2936
2861
|
"""List models.
|
|
2937
2862
|
|
|
2938
2863
|
Lists all available registered models, up to the limit specified in __max_results__."""
|
|
2939
2864
|
request = kwargs.get('request', None)
|
|
2940
2865
|
if not request: # request is not given through keyed args
|
|
2941
|
-
request =
|
|
2866
|
+
request = ListModelsRequest(max_results=max_results, page_token=page_token)
|
|
2942
2867
|
|
|
2943
2868
|
query = {}
|
|
2944
2869
|
if max_results: query['max_results'] = request.max_results
|
|
@@ -2949,155 +2874,177 @@ class RegisteredModelsAPI:
|
|
|
2949
2874
|
if 'registered_models' not in json or not json['registered_models']:
|
|
2950
2875
|
return
|
|
2951
2876
|
for v in json['registered_models']:
|
|
2952
|
-
yield
|
|
2877
|
+
yield Model.from_dict(v)
|
|
2953
2878
|
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2954
2879
|
return
|
|
2955
2880
|
query['page_token'] = json['next_page_token']
|
|
2956
2881
|
|
|
2957
|
-
def
|
|
2958
|
-
"""
|
|
2882
|
+
def list_transition_requests(self, name: str, version: str, **kwargs) -> Iterator[Activity]:
|
|
2883
|
+
"""List transition requests.
|
|
2959
2884
|
|
|
2960
|
-
|
|
2885
|
+
Gets a list of all open stage transition requests for the model version."""
|
|
2961
2886
|
request = kwargs.get('request', None)
|
|
2962
2887
|
if not request: # request is not given through keyed args
|
|
2963
|
-
request =
|
|
2964
|
-
body = request.as_dict()
|
|
2888
|
+
request = ListTransitionRequestsRequest(name=name, version=version)
|
|
2965
2889
|
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2890
|
+
query = {}
|
|
2891
|
+
if name: query['name'] = request.name
|
|
2892
|
+
if version: query['version'] = request.version
|
|
2893
|
+
|
|
2894
|
+
json = self._api.do('GET', '/api/2.0/mlflow/transition-requests/list', query=query)
|
|
2895
|
+
return [Activity.from_dict(v) for v in json.get('requests', [])]
|
|
2896
|
+
|
|
2897
|
+
def list_webhooks(self,
|
|
2898
|
+
*,
|
|
2899
|
+
events: List[RegistryWebhookEvent] = None,
|
|
2900
|
+
model_name: str = None,
|
|
2901
|
+
page_token: str = None,
|
|
2902
|
+
**kwargs) -> Iterator[RegistryWebhook]:
|
|
2903
|
+
"""List registry webhooks.
|
|
2977
2904
|
|
|
2978
|
-
|
|
2905
|
+
**NOTE:** This endpoint is in Public Preview.
|
|
2906
|
+
|
|
2907
|
+
Lists all registry webhooks."""
|
|
2979
2908
|
request = kwargs.get('request', None)
|
|
2980
2909
|
if not request: # request is not given through keyed args
|
|
2981
|
-
request =
|
|
2982
|
-
max_results=max_results,
|
|
2983
|
-
order_by=order_by,
|
|
2984
|
-
page_token=page_token)
|
|
2910
|
+
request = ListWebhooksRequest(events=events, model_name=model_name, page_token=page_token)
|
|
2985
2911
|
|
|
2986
2912
|
query = {}
|
|
2987
|
-
if
|
|
2988
|
-
if
|
|
2989
|
-
if order_by: query['order_by'] = [v for v in request.order_by]
|
|
2913
|
+
if events: query['events'] = [v for v in request.events]
|
|
2914
|
+
if model_name: query['model_name'] = request.model_name
|
|
2990
2915
|
if page_token: query['page_token'] = request.page_token
|
|
2991
2916
|
|
|
2992
2917
|
while True:
|
|
2993
|
-
json = self._api.do('GET', '/api/2.0/mlflow/
|
|
2994
|
-
if '
|
|
2918
|
+
json = self._api.do('GET', '/api/2.0/mlflow/registry-webhooks/list', query=query)
|
|
2919
|
+
if 'webhooks' not in json or not json['webhooks']:
|
|
2995
2920
|
return
|
|
2996
|
-
for v in json['
|
|
2997
|
-
yield
|
|
2921
|
+
for v in json['webhooks']:
|
|
2922
|
+
yield RegistryWebhook.from_dict(v)
|
|
2998
2923
|
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2999
2924
|
return
|
|
3000
2925
|
query['page_token'] = json['next_page_token']
|
|
3001
2926
|
|
|
3002
|
-
def
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
self._api.do('POST', '/api/2.0/mlflow/registered-models/set-tag', body=body)
|
|
3011
|
-
|
|
3012
|
-
def update(self, name: str, *, description: str = None, **kwargs):
|
|
3013
|
-
"""Update model.
|
|
2927
|
+
def reject_transition_request(self,
|
|
2928
|
+
name: str,
|
|
2929
|
+
version: str,
|
|
2930
|
+
stage: Stage,
|
|
2931
|
+
*,
|
|
2932
|
+
comment: str = None,
|
|
2933
|
+
**kwargs) -> RejectTransitionRequestResponse:
|
|
2934
|
+
"""Reject a transition request.
|
|
3014
2935
|
|
|
3015
|
-
|
|
2936
|
+
Rejects a model version stage transition request."""
|
|
3016
2937
|
request = kwargs.get('request', None)
|
|
3017
2938
|
if not request: # request is not given through keyed args
|
|
3018
|
-
request =
|
|
2939
|
+
request = RejectTransitionRequest(comment=comment, name=name, stage=stage, version=version)
|
|
3019
2940
|
body = request.as_dict()
|
|
3020
|
-
self._api.do('PATCH', '/api/2.0/mlflow/registered-models/update', body=body)
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
class RegistryWebhooksAPI:
|
|
3024
2941
|
|
|
3025
|
-
|
|
3026
|
-
|
|
2942
|
+
json = self._api.do('POST', '/api/2.0/mlflow/transition-requests/reject', body=body)
|
|
2943
|
+
return RejectTransitionRequestResponse.from_dict(json)
|
|
3027
2944
|
|
|
3028
|
-
def
|
|
3029
|
-
|
|
3030
|
-
*,
|
|
3031
|
-
description: str = None,
|
|
3032
|
-
http_url_spec: HttpUrlSpec = None,
|
|
3033
|
-
job_spec: JobSpec = None,
|
|
3034
|
-
model_name: str = None,
|
|
3035
|
-
status: RegistryWebhookStatus = None,
|
|
3036
|
-
**kwargs) -> CreateResponse:
|
|
3037
|
-
"""Create a webhook.
|
|
3038
|
-
|
|
3039
|
-
**NOTE**: This endpoint is in Public Preview.
|
|
2945
|
+
def rename_model(self, name: str, *, new_name: str = None, **kwargs) -> RenameModelResponse:
|
|
2946
|
+
"""Rename a model.
|
|
3040
2947
|
|
|
3041
|
-
|
|
2948
|
+
Renames a registered model."""
|
|
3042
2949
|
request = kwargs.get('request', None)
|
|
3043
2950
|
if not request: # request is not given through keyed args
|
|
3044
|
-
request =
|
|
3045
|
-
events=events,
|
|
3046
|
-
http_url_spec=http_url_spec,
|
|
3047
|
-
job_spec=job_spec,
|
|
3048
|
-
model_name=model_name,
|
|
3049
|
-
status=status)
|
|
2951
|
+
request = RenameModelRequest(name=name, new_name=new_name)
|
|
3050
2952
|
body = request.as_dict()
|
|
3051
2953
|
|
|
3052
|
-
json = self._api.do('POST', '/api/2.0/mlflow/
|
|
3053
|
-
return
|
|
3054
|
-
|
|
3055
|
-
def
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
2954
|
+
json = self._api.do('POST', '/api/2.0/mlflow/registered-models/rename', body=body)
|
|
2955
|
+
return RenameModelResponse.from_dict(json)
|
|
2956
|
+
|
|
2957
|
+
def search_model_versions(self,
|
|
2958
|
+
*,
|
|
2959
|
+
filter: str = None,
|
|
2960
|
+
max_results: int = None,
|
|
2961
|
+
order_by: List[str] = None,
|
|
2962
|
+
page_token: str = None,
|
|
2963
|
+
**kwargs) -> Iterator[ModelVersion]:
|
|
2964
|
+
"""Searches model versions.
|
|
3059
2965
|
|
|
3060
|
-
|
|
2966
|
+
Searches for specific model versions based on the supplied __filter__."""
|
|
3061
2967
|
request = kwargs.get('request', None)
|
|
3062
2968
|
if not request: # request is not given through keyed args
|
|
3063
|
-
request =
|
|
2969
|
+
request = SearchModelVersionsRequest(filter=filter,
|
|
2970
|
+
max_results=max_results,
|
|
2971
|
+
order_by=order_by,
|
|
2972
|
+
page_token=page_token)
|
|
3064
2973
|
|
|
3065
2974
|
query = {}
|
|
3066
|
-
if
|
|
2975
|
+
if filter: query['filter'] = request.filter
|
|
2976
|
+
if max_results: query['max_results'] = request.max_results
|
|
2977
|
+
if order_by: query['order_by'] = [v for v in request.order_by]
|
|
2978
|
+
if page_token: query['page_token'] = request.page_token
|
|
3067
2979
|
|
|
3068
|
-
|
|
2980
|
+
while True:
|
|
2981
|
+
json = self._api.do('GET', '/api/2.0/mlflow/model-versions/search', query=query)
|
|
2982
|
+
if 'model_versions' not in json or not json['model_versions']:
|
|
2983
|
+
return
|
|
2984
|
+
for v in json['model_versions']:
|
|
2985
|
+
yield ModelVersion.from_dict(v)
|
|
2986
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2987
|
+
return
|
|
2988
|
+
query['page_token'] = json['next_page_token']
|
|
3069
2989
|
|
|
3070
|
-
def
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
**NOTE:** This endpoint is in Public Preview.
|
|
2990
|
+
def search_models(self,
|
|
2991
|
+
*,
|
|
2992
|
+
filter: str = None,
|
|
2993
|
+
max_results: int = None,
|
|
2994
|
+
order_by: List[str] = None,
|
|
2995
|
+
page_token: str = None,
|
|
2996
|
+
**kwargs) -> Iterator[Model]:
|
|
2997
|
+
"""Search models.
|
|
3079
2998
|
|
|
3080
|
-
|
|
2999
|
+
Search for registered models based on the specified __filter__."""
|
|
3081
3000
|
request = kwargs.get('request', None)
|
|
3082
3001
|
if not request: # request is not given through keyed args
|
|
3083
|
-
request =
|
|
3002
|
+
request = SearchModelsRequest(filter=filter,
|
|
3003
|
+
max_results=max_results,
|
|
3004
|
+
order_by=order_by,
|
|
3005
|
+
page_token=page_token)
|
|
3084
3006
|
|
|
3085
3007
|
query = {}
|
|
3086
|
-
if
|
|
3087
|
-
if
|
|
3008
|
+
if filter: query['filter'] = request.filter
|
|
3009
|
+
if max_results: query['max_results'] = request.max_results
|
|
3010
|
+
if order_by: query['order_by'] = [v for v in request.order_by]
|
|
3088
3011
|
if page_token: query['page_token'] = request.page_token
|
|
3089
3012
|
|
|
3090
3013
|
while True:
|
|
3091
|
-
json = self._api.do('GET', '/api/2.0/mlflow/
|
|
3092
|
-
if '
|
|
3014
|
+
json = self._api.do('GET', '/api/2.0/mlflow/registered-models/search', query=query)
|
|
3015
|
+
if 'registered_models' not in json or not json['registered_models']:
|
|
3093
3016
|
return
|
|
3094
|
-
for v in json['
|
|
3095
|
-
yield
|
|
3017
|
+
for v in json['registered_models']:
|
|
3018
|
+
yield Model.from_dict(v)
|
|
3096
3019
|
if 'next_page_token' not in json or not json['next_page_token']:
|
|
3097
3020
|
return
|
|
3098
3021
|
query['page_token'] = json['next_page_token']
|
|
3099
3022
|
|
|
3100
|
-
def
|
|
3023
|
+
def set_model_tag(self, name: str, key: str, value: str, **kwargs):
|
|
3024
|
+
"""Set a tag.
|
|
3025
|
+
|
|
3026
|
+
Sets a tag on a registered model."""
|
|
3027
|
+
request = kwargs.get('request', None)
|
|
3028
|
+
if not request: # request is not given through keyed args
|
|
3029
|
+
request = SetModelTagRequest(key=key, name=name, value=value)
|
|
3030
|
+
body = request.as_dict()
|
|
3031
|
+
self._api.do('POST', '/api/2.0/mlflow/registered-models/set-tag', body=body)
|
|
3032
|
+
|
|
3033
|
+
def set_model_version_tag(self, name: str, version: str, key: str, value: str, **kwargs):
|
|
3034
|
+
"""Set a version tag.
|
|
3035
|
+
|
|
3036
|
+
Sets a model version tag."""
|
|
3037
|
+
request = kwargs.get('request', None)
|
|
3038
|
+
if not request: # request is not given through keyed args
|
|
3039
|
+
request = SetModelVersionTagRequest(key=key, name=name, value=value, version=version)
|
|
3040
|
+
body = request.as_dict()
|
|
3041
|
+
self._api.do('POST', '/api/2.0/mlflow/model-versions/set-tag', body=body)
|
|
3042
|
+
|
|
3043
|
+
def test_registry_webhook(self,
|
|
3044
|
+
id: str,
|
|
3045
|
+
*,
|
|
3046
|
+
event: RegistryWebhookEvent = None,
|
|
3047
|
+
**kwargs) -> TestRegistryWebhookResponse:
|
|
3101
3048
|
"""Test a webhook.
|
|
3102
3049
|
|
|
3103
3050
|
**NOTE:** This endpoint is in Public Preview.
|
|
@@ -3111,128 +3058,86 @@ class RegistryWebhooksAPI:
|
|
|
3111
3058
|
json = self._api.do('POST', '/api/2.0/mlflow/registry-webhooks/test', body=body)
|
|
3112
3059
|
return TestRegistryWebhookResponse.from_dict(json)
|
|
3113
3060
|
|
|
3114
|
-
def
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
"""Update a webhook.
|
|
3061
|
+
def transition_stage(self,
|
|
3062
|
+
name: str,
|
|
3063
|
+
version: str,
|
|
3064
|
+
stage: Stage,
|
|
3065
|
+
archive_existing_versions: bool,
|
|
3066
|
+
*,
|
|
3067
|
+
comment: str = None,
|
|
3068
|
+
**kwargs) -> TransitionStageResponse:
|
|
3069
|
+
"""Transition a stage.
|
|
3124
3070
|
|
|
3125
|
-
|
|
3071
|
+
Transition a model version's stage. This is a Databricks Workspace version of the [MLflow endpoint]
|
|
3072
|
+
that also accepts a comment associated with the transition to be recorded.",
|
|
3126
3073
|
|
|
3127
|
-
|
|
3074
|
+
[MLflow endpoint]: https://www.mlflow.org/docs/latest/rest-api.html#transition-modelversion-stage"""
|
|
3128
3075
|
request = kwargs.get('request', None)
|
|
3129
3076
|
if not request: # request is not given through keyed args
|
|
3130
|
-
request =
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3077
|
+
request = TransitionModelVersionStageDatabricks(
|
|
3078
|
+
archive_existing_versions=archive_existing_versions,
|
|
3079
|
+
comment=comment,
|
|
3080
|
+
name=name,
|
|
3081
|
+
stage=stage,
|
|
3082
|
+
version=version)
|
|
3136
3083
|
body = request.as_dict()
|
|
3137
|
-
self._api.do('PATCH', '/api/2.0/mlflow/registry-webhooks/update', body=body)
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
class TransitionRequestsAPI:
|
|
3141
3084
|
|
|
3142
|
-
|
|
3143
|
-
|
|
3085
|
+
json = self._api.do('POST', '/api/2.0/mlflow/databricks/model-versions/transition-stage', body=body)
|
|
3086
|
+
return TransitionStageResponse.from_dict(json)
|
|
3144
3087
|
|
|
3145
|
-
def
|
|
3146
|
-
|
|
3147
|
-
version: str,
|
|
3148
|
-
stage: Stage,
|
|
3149
|
-
archive_existing_versions: bool,
|
|
3150
|
-
*,
|
|
3151
|
-
comment: str = None,
|
|
3152
|
-
**kwargs) -> ApproveResponse:
|
|
3153
|
-
"""Approve transition requests.
|
|
3088
|
+
def update_comment(self, id: str, comment: str, **kwargs) -> UpdateCommentResponse:
|
|
3089
|
+
"""Update a comment.
|
|
3154
3090
|
|
|
3155
|
-
|
|
3091
|
+
Post an edit to a comment on a model version."""
|
|
3156
3092
|
request = kwargs.get('request', None)
|
|
3157
3093
|
if not request: # request is not given through keyed args
|
|
3158
|
-
request =
|
|
3159
|
-
comment=comment,
|
|
3160
|
-
name=name,
|
|
3161
|
-
stage=stage,
|
|
3162
|
-
version=version)
|
|
3094
|
+
request = UpdateComment(comment=comment, id=id)
|
|
3163
3095
|
body = request.as_dict()
|
|
3164
3096
|
|
|
3165
|
-
json = self._api.do('
|
|
3166
|
-
return
|
|
3167
|
-
|
|
3168
|
-
def
|
|
3169
|
-
|
|
3170
|
-
version: str,
|
|
3171
|
-
stage: Stage,
|
|
3172
|
-
*,
|
|
3173
|
-
comment: str = None,
|
|
3174
|
-
**kwargs) -> CreateResponse:
|
|
3175
|
-
"""Make a transition request.
|
|
3097
|
+
json = self._api.do('PATCH', '/api/2.0/mlflow/comments/update', body=body)
|
|
3098
|
+
return UpdateCommentResponse.from_dict(json)
|
|
3099
|
+
|
|
3100
|
+
def update_model(self, name: str, *, description: str = None, **kwargs):
|
|
3101
|
+
"""Update model.
|
|
3176
3102
|
|
|
3177
|
-
|
|
3103
|
+
Updates a registered model."""
|
|
3178
3104
|
request = kwargs.get('request', None)
|
|
3179
3105
|
if not request: # request is not given through keyed args
|
|
3180
|
-
request =
|
|
3106
|
+
request = UpdateModelRequest(description=description, name=name)
|
|
3181
3107
|
body = request.as_dict()
|
|
3108
|
+
self._api.do('PATCH', '/api/2.0/mlflow/registered-models/update', body=body)
|
|
3182
3109
|
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
def delete(self, name: str, version: str, stage: str, creator: str, *, comment: str = None, **kwargs):
|
|
3187
|
-
"""Delete a ransition request.
|
|
3110
|
+
def update_model_version(self, name: str, version: str, *, description: str = None, **kwargs):
|
|
3111
|
+
"""Update model version.
|
|
3188
3112
|
|
|
3189
|
-
|
|
3113
|
+
Updates the model version."""
|
|
3190
3114
|
request = kwargs.get('request', None)
|
|
3191
3115
|
if not request: # request is not given through keyed args
|
|
3192
|
-
request =
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
stage=stage,
|
|
3196
|
-
version=version)
|
|
3197
|
-
|
|
3198
|
-
query = {}
|
|
3199
|
-
if comment: query['comment'] = request.comment
|
|
3200
|
-
if creator: query['creator'] = request.creator
|
|
3201
|
-
if name: query['name'] = request.name
|
|
3202
|
-
if stage: query['stage'] = request.stage
|
|
3203
|
-
if version: query['version'] = request.version
|
|
3204
|
-
|
|
3205
|
-
self._api.do('DELETE', '/api/2.0/mlflow/transition-requests/delete', query=query)
|
|
3116
|
+
request = UpdateModelVersionRequest(description=description, name=name, version=version)
|
|
3117
|
+
body = request.as_dict()
|
|
3118
|
+
self._api.do('PATCH', '/api/2.0/mlflow/model-versions/update', body=body)
|
|
3206
3119
|
|
|
3207
|
-
def
|
|
3208
|
-
|
|
3120
|
+
def update_webhook(self,
|
|
3121
|
+
id: str,
|
|
3122
|
+
*,
|
|
3123
|
+
description: str = None,
|
|
3124
|
+
events: List[RegistryWebhookEvent] = None,
|
|
3125
|
+
http_url_spec: HttpUrlSpec = None,
|
|
3126
|
+
job_spec: JobSpec = None,
|
|
3127
|
+
status: RegistryWebhookStatus = None,
|
|
3128
|
+
**kwargs):
|
|
3129
|
+
"""Update a webhook.
|
|
3209
3130
|
|
|
3210
|
-
|
|
3211
|
-
request = kwargs.get('request', None)
|
|
3212
|
-
if not request: # request is not given through keyed args
|
|
3213
|
-
request = ListTransitionRequestsRequest(name=name, version=version)
|
|
3214
|
-
|
|
3215
|
-
query = {}
|
|
3216
|
-
if name: query['name'] = request.name
|
|
3217
|
-
if version: query['version'] = request.version
|
|
3218
|
-
|
|
3219
|
-
json = self._api.do('GET', '/api/2.0/mlflow/transition-requests/list', query=query)
|
|
3220
|
-
return [Activity.from_dict(v) for v in json.get('requests', [])]
|
|
3221
|
-
|
|
3222
|
-
def reject(self,
|
|
3223
|
-
name: str,
|
|
3224
|
-
version: str,
|
|
3225
|
-
stage: Stage,
|
|
3226
|
-
*,
|
|
3227
|
-
comment: str = None,
|
|
3228
|
-
**kwargs) -> RejectResponse:
|
|
3229
|
-
"""Reject a transition request.
|
|
3131
|
+
**NOTE:** This endpoint is in Public Preview.
|
|
3230
3132
|
|
|
3231
|
-
|
|
3133
|
+
Updates a registry webhook."""
|
|
3232
3134
|
request = kwargs.get('request', None)
|
|
3233
3135
|
if not request: # request is not given through keyed args
|
|
3234
|
-
request =
|
|
3136
|
+
request = UpdateRegistryWebhook(description=description,
|
|
3137
|
+
events=events,
|
|
3138
|
+
http_url_spec=http_url_spec,
|
|
3139
|
+
id=id,
|
|
3140
|
+
job_spec=job_spec,
|
|
3141
|
+
status=status)
|
|
3235
3142
|
body = request.as_dict()
|
|
3236
|
-
|
|
3237
|
-
json = self._api.do('POST', '/api/2.0/mlflow/transition-requests/reject', body=body)
|
|
3238
|
-
return RejectResponse.from_dict(json)
|
|
3143
|
+
self._api.do('PATCH', '/api/2.0/mlflow/registry-webhooks/update', body=body)
|