@databricks/sdk-modelregistry 0.0.0-dev → 0.1.0-dev.1
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.
- package/LICENSE +203 -0
- package/dist/v1/client.d.ts +109 -0
- package/dist/v1/client.d.ts.map +1 -0
- package/dist/v1/client.js +1060 -0
- package/dist/v1/client.js.map +1 -0
- package/dist/v1/index.d.ts +4 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +4 -0
- package/dist/v1/index.js.map +1 -0
- package/dist/v1/model.d.ts +1096 -0
- package/dist/v1/model.d.ts.map +1 -0
- package/dist/v1/model.js +950 -0
- package/dist/v1/model.js.map +1 -0
- package/dist/v1/transport.d.ts +5 -0
- package/dist/v1/transport.d.ts.map +1 -0
- package/dist/v1/transport.js +57 -0
- package/dist/v1/transport.js.map +1 -0
- package/dist/v1/utils.d.ts +22 -0
- package/dist/v1/utils.d.ts.map +1 -0
- package/dist/v1/utils.js +113 -0
- package/dist/v1/utils.js.map +1 -0
- package/package.json +38 -4
- package/src/v1/client.ts +1436 -0
- package/src/v1/index.ts +94 -0
- package/src/v1/model.ts +2049 -0
- package/src/v1/transport.ts +73 -0
- package/src/v1/utils.ts +156 -0
- package/README.md +0 -1
- package/index.js +0 -1
package/src/v1/client.ts
ADDED
|
@@ -0,0 +1,1436 @@
|
|
|
1
|
+
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
+
import type {Call} from '@databricks/sdk-core/api';
|
|
5
|
+
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
6
|
+
import type {Logger} from '@databricks/sdk-core/logger';
|
|
7
|
+
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
8
|
+
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
9
|
+
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
10
|
+
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
11
|
+
import {newHttpClient} from './transport';
|
|
12
|
+
import {
|
|
13
|
+
buildHttpRequest,
|
|
14
|
+
executeCall,
|
|
15
|
+
executeHttpCall,
|
|
16
|
+
marshalRequest,
|
|
17
|
+
parseResponse,
|
|
18
|
+
} from './utils';
|
|
19
|
+
import pkgJson from '../../package.json' with {type: 'json'};
|
|
20
|
+
import type {
|
|
21
|
+
ApproveTransitionRequest,
|
|
22
|
+
ApproveTransitionRequest_Response,
|
|
23
|
+
CreateCommentRequest,
|
|
24
|
+
CreateCommentRequest_Response,
|
|
25
|
+
CreateModelVersionRequest,
|
|
26
|
+
CreateModelVersionRequest_Response,
|
|
27
|
+
CreateRegisteredModelRequest,
|
|
28
|
+
CreateRegisteredModelRequest_Response,
|
|
29
|
+
CreateRegistryWebhookRequest,
|
|
30
|
+
CreateRegistryWebhookRequest_Response,
|
|
31
|
+
CreateTransitionRequest,
|
|
32
|
+
CreateTransitionRequest_Response,
|
|
33
|
+
DeleteCommentRequest,
|
|
34
|
+
DeleteCommentRequest_Response,
|
|
35
|
+
DeleteModelVersionRequest,
|
|
36
|
+
DeleteModelVersionRequest_Response,
|
|
37
|
+
DeleteModelVersionTagRequest,
|
|
38
|
+
DeleteModelVersionTagRequest_Response,
|
|
39
|
+
DeleteRegisteredModelRequest,
|
|
40
|
+
DeleteRegisteredModelRequest_Response,
|
|
41
|
+
DeleteRegisteredModelTagRequest,
|
|
42
|
+
DeleteRegisteredModelTagRequest_Response,
|
|
43
|
+
DeleteRegistryWebhookRequest,
|
|
44
|
+
DeleteRegistryWebhookRequest_Response,
|
|
45
|
+
DeleteTransitionRequest,
|
|
46
|
+
DeleteTransitionRequest_Response,
|
|
47
|
+
GetLatestVersionsRequest,
|
|
48
|
+
GetLatestVersionsRequest_Response,
|
|
49
|
+
GetModelVersionDownloadUriRequest,
|
|
50
|
+
GetModelVersionDownloadUriRequest_Response,
|
|
51
|
+
GetModelVersionRequest,
|
|
52
|
+
GetModelVersionRequest_Response,
|
|
53
|
+
GetRegisteredModelDatabricksRequest,
|
|
54
|
+
GetRegisteredModelDatabricksRequest_Response,
|
|
55
|
+
ListRegisteredModelsRequest,
|
|
56
|
+
ListRegisteredModelsRequest_Response,
|
|
57
|
+
ListRegistryWebhooksRequest,
|
|
58
|
+
ListRegistryWebhooksRequest_Response,
|
|
59
|
+
ListTransitionRequest,
|
|
60
|
+
ListTransitionRequest_Response,
|
|
61
|
+
ModelVersion,
|
|
62
|
+
RegisteredModel,
|
|
63
|
+
RegistryWebhook,
|
|
64
|
+
RejectTransitionRequest,
|
|
65
|
+
RejectTransitionRequest_Response,
|
|
66
|
+
RenameRegisteredModelRequest,
|
|
67
|
+
RenameRegisteredModelRequest_Response,
|
|
68
|
+
SearchModelVersionsRequest,
|
|
69
|
+
SearchModelVersionsRequest_Response,
|
|
70
|
+
SearchRegisteredModelsRequest,
|
|
71
|
+
SearchRegisteredModelsRequest_Response,
|
|
72
|
+
SetModelVersionTagRequest,
|
|
73
|
+
SetModelVersionTagRequest_Response,
|
|
74
|
+
SetRegisteredModelTagRequest,
|
|
75
|
+
SetRegisteredModelTagRequest_Response,
|
|
76
|
+
TestRegistryWebhookRequest,
|
|
77
|
+
TestRegistryWebhookRequest_Response,
|
|
78
|
+
TransitionModelVersionStageDatabricksRequest,
|
|
79
|
+
TransitionModelVersionStageDatabricksRequest_Response,
|
|
80
|
+
UpdateCommentRequest,
|
|
81
|
+
UpdateCommentRequest_Response,
|
|
82
|
+
UpdateModelVersionRequest,
|
|
83
|
+
UpdateModelVersionRequest_Response,
|
|
84
|
+
UpdateRegisteredModelRequest,
|
|
85
|
+
UpdateRegisteredModelRequest_Response,
|
|
86
|
+
UpdateRegistryWebhookRequest,
|
|
87
|
+
UpdateRegistryWebhookRequest_Response,
|
|
88
|
+
} from './model';
|
|
89
|
+
import {
|
|
90
|
+
marshalApproveTransitionRequestSchema,
|
|
91
|
+
marshalCreateCommentRequestSchema,
|
|
92
|
+
marshalCreateModelVersionRequestSchema,
|
|
93
|
+
marshalCreateRegisteredModelRequestSchema,
|
|
94
|
+
marshalCreateRegistryWebhookRequestSchema,
|
|
95
|
+
marshalCreateTransitionRequestSchema,
|
|
96
|
+
marshalGetLatestVersionsRequestSchema,
|
|
97
|
+
marshalRejectTransitionRequestSchema,
|
|
98
|
+
marshalRenameRegisteredModelRequestSchema,
|
|
99
|
+
marshalSetModelVersionTagRequestSchema,
|
|
100
|
+
marshalSetRegisteredModelTagRequestSchema,
|
|
101
|
+
marshalTestRegistryWebhookRequestSchema,
|
|
102
|
+
marshalTransitionModelVersionStageDatabricksRequestSchema,
|
|
103
|
+
marshalUpdateCommentRequestSchema,
|
|
104
|
+
marshalUpdateModelVersionRequestSchema,
|
|
105
|
+
marshalUpdateRegisteredModelRequestSchema,
|
|
106
|
+
marshalUpdateRegistryWebhookRequestSchema,
|
|
107
|
+
unmarshalApproveTransitionRequest_ResponseSchema,
|
|
108
|
+
unmarshalCreateCommentRequest_ResponseSchema,
|
|
109
|
+
unmarshalCreateModelVersionRequest_ResponseSchema,
|
|
110
|
+
unmarshalCreateRegisteredModelRequest_ResponseSchema,
|
|
111
|
+
unmarshalCreateRegistryWebhookRequest_ResponseSchema,
|
|
112
|
+
unmarshalCreateTransitionRequest_ResponseSchema,
|
|
113
|
+
unmarshalDeleteCommentRequest_ResponseSchema,
|
|
114
|
+
unmarshalDeleteModelVersionRequest_ResponseSchema,
|
|
115
|
+
unmarshalDeleteModelVersionTagRequest_ResponseSchema,
|
|
116
|
+
unmarshalDeleteRegisteredModelRequest_ResponseSchema,
|
|
117
|
+
unmarshalDeleteRegisteredModelTagRequest_ResponseSchema,
|
|
118
|
+
unmarshalDeleteRegistryWebhookRequest_ResponseSchema,
|
|
119
|
+
unmarshalDeleteTransitionRequest_ResponseSchema,
|
|
120
|
+
unmarshalGetLatestVersionsRequest_ResponseSchema,
|
|
121
|
+
unmarshalGetModelVersionDownloadUriRequest_ResponseSchema,
|
|
122
|
+
unmarshalGetModelVersionRequest_ResponseSchema,
|
|
123
|
+
unmarshalGetRegisteredModelDatabricksRequest_ResponseSchema,
|
|
124
|
+
unmarshalListRegisteredModelsRequest_ResponseSchema,
|
|
125
|
+
unmarshalListRegistryWebhooksRequest_ResponseSchema,
|
|
126
|
+
unmarshalListTransitionRequest_ResponseSchema,
|
|
127
|
+
unmarshalRejectTransitionRequest_ResponseSchema,
|
|
128
|
+
unmarshalRenameRegisteredModelRequest_ResponseSchema,
|
|
129
|
+
unmarshalSearchModelVersionsRequest_ResponseSchema,
|
|
130
|
+
unmarshalSearchRegisteredModelsRequest_ResponseSchema,
|
|
131
|
+
unmarshalSetModelVersionTagRequest_ResponseSchema,
|
|
132
|
+
unmarshalSetRegisteredModelTagRequest_ResponseSchema,
|
|
133
|
+
unmarshalTestRegistryWebhookRequest_ResponseSchema,
|
|
134
|
+
unmarshalTransitionModelVersionStageDatabricksRequest_ResponseSchema,
|
|
135
|
+
unmarshalUpdateCommentRequest_ResponseSchema,
|
|
136
|
+
unmarshalUpdateModelVersionRequest_ResponseSchema,
|
|
137
|
+
unmarshalUpdateRegisteredModelRequest_ResponseSchema,
|
|
138
|
+
unmarshalUpdateRegistryWebhookRequest_ResponseSchema,
|
|
139
|
+
} from './model';
|
|
140
|
+
|
|
141
|
+
// Package identity segment for this client to be used in the User-Agent header.
|
|
142
|
+
const PACKAGE_SEGMENT = {
|
|
143
|
+
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
144
|
+
value: pkgJson.version,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export class ModelregistryClient {
|
|
148
|
+
private readonly host: string;
|
|
149
|
+
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
150
|
+
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
151
|
+
// request.
|
|
152
|
+
private readonly workspaceId: string | undefined;
|
|
153
|
+
private readonly httpClient: HttpClient;
|
|
154
|
+
private readonly logger: Logger;
|
|
155
|
+
// User-Agent header value. Composed once at construction from
|
|
156
|
+
// createDefault() merged with this package's identity and the active
|
|
157
|
+
// credential's name.
|
|
158
|
+
private readonly userAgent: string;
|
|
159
|
+
|
|
160
|
+
constructor(options: ClientOptions) {
|
|
161
|
+
if (options.host === undefined) {
|
|
162
|
+
throw new Error('Host is required.');
|
|
163
|
+
}
|
|
164
|
+
this.host = options.host.replace(/\/$/, '');
|
|
165
|
+
this.workspaceId = options.workspaceId;
|
|
166
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
167
|
+
const info = createDefault()
|
|
168
|
+
.with(PACKAGE_SEGMENT)
|
|
169
|
+
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
170
|
+
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
171
|
+
this.userAgent = info.toString();
|
|
172
|
+
this.httpClient = newHttpClient(options);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Approves a model version stage transition request. */
|
|
176
|
+
async approveTransitionRequest(
|
|
177
|
+
req: ApproveTransitionRequest,
|
|
178
|
+
options?: CallOptions
|
|
179
|
+
): Promise<ApproveTransitionRequest_Response> {
|
|
180
|
+
const url = `${this.host}/api/2.0/mlflow/transition-requests/approve`;
|
|
181
|
+
const body = marshalRequest(req, marshalApproveTransitionRequestSchema);
|
|
182
|
+
let resp: ApproveTransitionRequest_Response | undefined;
|
|
183
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
184
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
185
|
+
if (this.workspaceId !== undefined) {
|
|
186
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
187
|
+
}
|
|
188
|
+
headers.set('User-Agent', this.userAgent);
|
|
189
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
190
|
+
const respBody = await executeHttpCall({
|
|
191
|
+
request: httpReq,
|
|
192
|
+
httpClient: this.httpClient,
|
|
193
|
+
logger: this.logger,
|
|
194
|
+
});
|
|
195
|
+
resp = parseResponse(
|
|
196
|
+
respBody,
|
|
197
|
+
unmarshalApproveTransitionRequest_ResponseSchema
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
await executeCall(call, options);
|
|
201
|
+
if (resp === undefined) {
|
|
202
|
+
throw new Error('API call completed without a result.');
|
|
203
|
+
}
|
|
204
|
+
return resp;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Posts a comment on a model version. A comment can be submitted either by a user or programmatically to display
|
|
209
|
+
* relevant information about the model. For example, test results or deployment errors.
|
|
210
|
+
*/
|
|
211
|
+
async createComment(
|
|
212
|
+
req: CreateCommentRequest,
|
|
213
|
+
options?: CallOptions
|
|
214
|
+
): Promise<CreateCommentRequest_Response> {
|
|
215
|
+
const url = `${this.host}/api/2.0/mlflow/comments/create`;
|
|
216
|
+
const body = marshalRequest(req, marshalCreateCommentRequestSchema);
|
|
217
|
+
let resp: CreateCommentRequest_Response | undefined;
|
|
218
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
219
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
220
|
+
if (this.workspaceId !== undefined) {
|
|
221
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
222
|
+
}
|
|
223
|
+
headers.set('User-Agent', this.userAgent);
|
|
224
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
225
|
+
const respBody = await executeHttpCall({
|
|
226
|
+
request: httpReq,
|
|
227
|
+
httpClient: this.httpClient,
|
|
228
|
+
logger: this.logger,
|
|
229
|
+
});
|
|
230
|
+
resp = parseResponse(
|
|
231
|
+
respBody,
|
|
232
|
+
unmarshalCreateCommentRequest_ResponseSchema
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
await executeCall(call, options);
|
|
236
|
+
if (resp === undefined) {
|
|
237
|
+
throw new Error('API call completed without a result.');
|
|
238
|
+
}
|
|
239
|
+
return resp;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* **NOTE:** This endpoint is in Public Preview.
|
|
244
|
+
* Creates a registry webhook.
|
|
245
|
+
*/
|
|
246
|
+
async createRegistryWebhook(
|
|
247
|
+
req: CreateRegistryWebhookRequest,
|
|
248
|
+
options?: CallOptions
|
|
249
|
+
): Promise<CreateRegistryWebhookRequest_Response> {
|
|
250
|
+
const url = `${this.host}/api/2.0/mlflow/registry-webhooks/create`;
|
|
251
|
+
const body = marshalRequest(req, marshalCreateRegistryWebhookRequestSchema);
|
|
252
|
+
let resp: CreateRegistryWebhookRequest_Response | undefined;
|
|
253
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
254
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
255
|
+
if (this.workspaceId !== undefined) {
|
|
256
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
257
|
+
}
|
|
258
|
+
headers.set('User-Agent', this.userAgent);
|
|
259
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
260
|
+
const respBody = await executeHttpCall({
|
|
261
|
+
request: httpReq,
|
|
262
|
+
httpClient: this.httpClient,
|
|
263
|
+
logger: this.logger,
|
|
264
|
+
});
|
|
265
|
+
resp = parseResponse(
|
|
266
|
+
respBody,
|
|
267
|
+
unmarshalCreateRegistryWebhookRequest_ResponseSchema
|
|
268
|
+
);
|
|
269
|
+
};
|
|
270
|
+
await executeCall(call, options);
|
|
271
|
+
if (resp === undefined) {
|
|
272
|
+
throw new Error('API call completed without a result.');
|
|
273
|
+
}
|
|
274
|
+
return resp;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** Creates a model version stage transition request. */
|
|
278
|
+
async createTransitionRequest(
|
|
279
|
+
req: CreateTransitionRequest,
|
|
280
|
+
options?: CallOptions
|
|
281
|
+
): Promise<CreateTransitionRequest_Response> {
|
|
282
|
+
const url = `${this.host}/api/2.0/mlflow/transition-requests/create`;
|
|
283
|
+
const body = marshalRequest(req, marshalCreateTransitionRequestSchema);
|
|
284
|
+
let resp: CreateTransitionRequest_Response | undefined;
|
|
285
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
286
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
287
|
+
if (this.workspaceId !== undefined) {
|
|
288
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
289
|
+
}
|
|
290
|
+
headers.set('User-Agent', this.userAgent);
|
|
291
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
292
|
+
const respBody = await executeHttpCall({
|
|
293
|
+
request: httpReq,
|
|
294
|
+
httpClient: this.httpClient,
|
|
295
|
+
logger: this.logger,
|
|
296
|
+
});
|
|
297
|
+
resp = parseResponse(
|
|
298
|
+
respBody,
|
|
299
|
+
unmarshalCreateTransitionRequest_ResponseSchema
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
await executeCall(call, options);
|
|
303
|
+
if (resp === undefined) {
|
|
304
|
+
throw new Error('API call completed without a result.');
|
|
305
|
+
}
|
|
306
|
+
return resp;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** Deletes a comment on a model version. */
|
|
310
|
+
async deleteComment(
|
|
311
|
+
req: DeleteCommentRequest,
|
|
312
|
+
options?: CallOptions
|
|
313
|
+
): Promise<DeleteCommentRequest_Response> {
|
|
314
|
+
const url = `${this.host}/api/2.0/mlflow/comments/delete`;
|
|
315
|
+
const params = new URLSearchParams();
|
|
316
|
+
if (req.id !== undefined) {
|
|
317
|
+
params.append('id', req.id);
|
|
318
|
+
}
|
|
319
|
+
const query = params.toString();
|
|
320
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
321
|
+
let resp: DeleteCommentRequest_Response | undefined;
|
|
322
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
323
|
+
const headers = new Headers();
|
|
324
|
+
if (this.workspaceId !== undefined) {
|
|
325
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
326
|
+
}
|
|
327
|
+
headers.set('User-Agent', this.userAgent);
|
|
328
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
329
|
+
const respBody = await executeHttpCall({
|
|
330
|
+
request: httpReq,
|
|
331
|
+
httpClient: this.httpClient,
|
|
332
|
+
logger: this.logger,
|
|
333
|
+
});
|
|
334
|
+
resp = parseResponse(
|
|
335
|
+
respBody,
|
|
336
|
+
unmarshalDeleteCommentRequest_ResponseSchema
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
await executeCall(call, options);
|
|
340
|
+
if (resp === undefined) {
|
|
341
|
+
throw new Error('API call completed without a result.');
|
|
342
|
+
}
|
|
343
|
+
return resp;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* **NOTE:** This endpoint is in Public Preview.
|
|
348
|
+
* Deletes a registry webhook.
|
|
349
|
+
*/
|
|
350
|
+
async deleteRegistryWebhook(
|
|
351
|
+
req: DeleteRegistryWebhookRequest,
|
|
352
|
+
options?: CallOptions
|
|
353
|
+
): Promise<DeleteRegistryWebhookRequest_Response> {
|
|
354
|
+
const url = `${this.host}/api/2.0/mlflow/registry-webhooks/delete`;
|
|
355
|
+
const params = new URLSearchParams();
|
|
356
|
+
if (req.id !== undefined) {
|
|
357
|
+
params.append('id', req.id);
|
|
358
|
+
}
|
|
359
|
+
const query = params.toString();
|
|
360
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
361
|
+
let resp: DeleteRegistryWebhookRequest_Response | undefined;
|
|
362
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
363
|
+
const headers = new Headers();
|
|
364
|
+
if (this.workspaceId !== undefined) {
|
|
365
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
366
|
+
}
|
|
367
|
+
headers.set('User-Agent', this.userAgent);
|
|
368
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
369
|
+
const respBody = await executeHttpCall({
|
|
370
|
+
request: httpReq,
|
|
371
|
+
httpClient: this.httpClient,
|
|
372
|
+
logger: this.logger,
|
|
373
|
+
});
|
|
374
|
+
resp = parseResponse(
|
|
375
|
+
respBody,
|
|
376
|
+
unmarshalDeleteRegistryWebhookRequest_ResponseSchema
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
await executeCall(call, options);
|
|
380
|
+
if (resp === undefined) {
|
|
381
|
+
throw new Error('API call completed without a result.');
|
|
382
|
+
}
|
|
383
|
+
return resp;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** Cancels a model version stage transition request. */
|
|
387
|
+
async deleteTransitionRequest(
|
|
388
|
+
req: DeleteTransitionRequest,
|
|
389
|
+
options?: CallOptions
|
|
390
|
+
): Promise<DeleteTransitionRequest_Response> {
|
|
391
|
+
const url = `${this.host}/api/2.0/mlflow/transition-requests/delete`;
|
|
392
|
+
const params = new URLSearchParams();
|
|
393
|
+
if (req.name !== undefined) {
|
|
394
|
+
params.append('name', req.name);
|
|
395
|
+
}
|
|
396
|
+
if (req.version !== undefined) {
|
|
397
|
+
params.append('version', req.version);
|
|
398
|
+
}
|
|
399
|
+
if (req.stage !== undefined) {
|
|
400
|
+
params.append('stage', req.stage);
|
|
401
|
+
}
|
|
402
|
+
if (req.creator !== undefined) {
|
|
403
|
+
params.append('creator', req.creator);
|
|
404
|
+
}
|
|
405
|
+
if (req.comment !== undefined) {
|
|
406
|
+
params.append('comment', req.comment);
|
|
407
|
+
}
|
|
408
|
+
const query = params.toString();
|
|
409
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
410
|
+
let resp: DeleteTransitionRequest_Response | undefined;
|
|
411
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
412
|
+
const headers = new Headers();
|
|
413
|
+
if (this.workspaceId !== undefined) {
|
|
414
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
415
|
+
}
|
|
416
|
+
headers.set('User-Agent', this.userAgent);
|
|
417
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
418
|
+
const respBody = await executeHttpCall({
|
|
419
|
+
request: httpReq,
|
|
420
|
+
httpClient: this.httpClient,
|
|
421
|
+
logger: this.logger,
|
|
422
|
+
});
|
|
423
|
+
resp = parseResponse(
|
|
424
|
+
respBody,
|
|
425
|
+
unmarshalDeleteTransitionRequest_ResponseSchema
|
|
426
|
+
);
|
|
427
|
+
};
|
|
428
|
+
await executeCall(call, options);
|
|
429
|
+
if (resp === undefined) {
|
|
430
|
+
throw new Error('API call completed without a result.');
|
|
431
|
+
}
|
|
432
|
+
return resp;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Get the details of a model.
|
|
437
|
+
* This is a <Databricks> workspace version of the [MLflow endpoint](https://www.mlflow.org/docs/latest/rest-api.html#get-registeredmodel)
|
|
438
|
+
* that also returns the model's <Databricks> workspace ID and the permission level of the requesting user on the model.
|
|
439
|
+
*/
|
|
440
|
+
async getRegisteredModelDatabricks(
|
|
441
|
+
req: GetRegisteredModelDatabricksRequest,
|
|
442
|
+
options?: CallOptions
|
|
443
|
+
): Promise<GetRegisteredModelDatabricksRequest_Response> {
|
|
444
|
+
const url = `${this.host}/api/2.0/mlflow/databricks/registered-models/get`;
|
|
445
|
+
const params = new URLSearchParams();
|
|
446
|
+
if (req.name !== undefined) {
|
|
447
|
+
params.append('name', req.name);
|
|
448
|
+
}
|
|
449
|
+
const query = params.toString();
|
|
450
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
451
|
+
let resp: GetRegisteredModelDatabricksRequest_Response | undefined;
|
|
452
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
453
|
+
const headers = new Headers();
|
|
454
|
+
if (this.workspaceId !== undefined) {
|
|
455
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
456
|
+
}
|
|
457
|
+
headers.set('User-Agent', this.userAgent);
|
|
458
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
459
|
+
const respBody = await executeHttpCall({
|
|
460
|
+
request: httpReq,
|
|
461
|
+
httpClient: this.httpClient,
|
|
462
|
+
logger: this.logger,
|
|
463
|
+
});
|
|
464
|
+
resp = parseResponse(
|
|
465
|
+
respBody,
|
|
466
|
+
unmarshalGetRegisteredModelDatabricksRequest_ResponseSchema
|
|
467
|
+
);
|
|
468
|
+
};
|
|
469
|
+
await executeCall(call, options);
|
|
470
|
+
if (resp === undefined) {
|
|
471
|
+
throw new Error('API call completed without a result.');
|
|
472
|
+
}
|
|
473
|
+
return resp;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* **NOTE:** This endpoint is in Public Preview.
|
|
478
|
+
* Lists all registry webhooks.
|
|
479
|
+
*/
|
|
480
|
+
async listRegistryWebhooks(
|
|
481
|
+
req: ListRegistryWebhooksRequest,
|
|
482
|
+
options?: CallOptions
|
|
483
|
+
): Promise<ListRegistryWebhooksRequest_Response> {
|
|
484
|
+
const url = `${this.host}/api/2.0/mlflow/registry-webhooks/list`;
|
|
485
|
+
const params = new URLSearchParams();
|
|
486
|
+
if (req.modelName !== undefined) {
|
|
487
|
+
params.append('model_name', req.modelName);
|
|
488
|
+
}
|
|
489
|
+
if (req.events !== undefined) {
|
|
490
|
+
params.append('events', String(req.events));
|
|
491
|
+
}
|
|
492
|
+
if (req.pageToken !== undefined) {
|
|
493
|
+
params.append('page_token', req.pageToken);
|
|
494
|
+
}
|
|
495
|
+
if (req.maxResults !== undefined) {
|
|
496
|
+
params.append('max_results', String(req.maxResults));
|
|
497
|
+
}
|
|
498
|
+
const query = params.toString();
|
|
499
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
500
|
+
let resp: ListRegistryWebhooksRequest_Response | undefined;
|
|
501
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
502
|
+
const headers = new Headers();
|
|
503
|
+
if (this.workspaceId !== undefined) {
|
|
504
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
505
|
+
}
|
|
506
|
+
headers.set('User-Agent', this.userAgent);
|
|
507
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
508
|
+
const respBody = await executeHttpCall({
|
|
509
|
+
request: httpReq,
|
|
510
|
+
httpClient: this.httpClient,
|
|
511
|
+
logger: this.logger,
|
|
512
|
+
});
|
|
513
|
+
resp = parseResponse(
|
|
514
|
+
respBody,
|
|
515
|
+
unmarshalListRegistryWebhooksRequest_ResponseSchema
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
await executeCall(call, options);
|
|
519
|
+
if (resp === undefined) {
|
|
520
|
+
throw new Error('API call completed without a result.');
|
|
521
|
+
}
|
|
522
|
+
return resp;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
async *listRegistryWebhooksIter(
|
|
526
|
+
req: ListRegistryWebhooksRequest,
|
|
527
|
+
options?: CallOptions
|
|
528
|
+
): AsyncGenerator<RegistryWebhook> {
|
|
529
|
+
const pageReq: ListRegistryWebhooksRequest = {...req};
|
|
530
|
+
for (;;) {
|
|
531
|
+
const resp = await this.listRegistryWebhooks(pageReq, options);
|
|
532
|
+
for (const item of resp.webhooks ?? []) {
|
|
533
|
+
yield item;
|
|
534
|
+
}
|
|
535
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** Gets a list of all open stage transition requests for the model version. */
|
|
543
|
+
async listTransitionsRequest(
|
|
544
|
+
req: ListTransitionRequest,
|
|
545
|
+
options?: CallOptions
|
|
546
|
+
): Promise<ListTransitionRequest_Response> {
|
|
547
|
+
const url = `${this.host}/api/2.0/mlflow/transition-requests/list`;
|
|
548
|
+
const params = new URLSearchParams();
|
|
549
|
+
if (req.name !== undefined) {
|
|
550
|
+
params.append('name', req.name);
|
|
551
|
+
}
|
|
552
|
+
if (req.version !== undefined) {
|
|
553
|
+
params.append('version', req.version);
|
|
554
|
+
}
|
|
555
|
+
const query = params.toString();
|
|
556
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
557
|
+
let resp: ListTransitionRequest_Response | undefined;
|
|
558
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
559
|
+
const headers = new Headers();
|
|
560
|
+
if (this.workspaceId !== undefined) {
|
|
561
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
562
|
+
}
|
|
563
|
+
headers.set('User-Agent', this.userAgent);
|
|
564
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
565
|
+
const respBody = await executeHttpCall({
|
|
566
|
+
request: httpReq,
|
|
567
|
+
httpClient: this.httpClient,
|
|
568
|
+
logger: this.logger,
|
|
569
|
+
});
|
|
570
|
+
resp = parseResponse(
|
|
571
|
+
respBody,
|
|
572
|
+
unmarshalListTransitionRequest_ResponseSchema
|
|
573
|
+
);
|
|
574
|
+
};
|
|
575
|
+
await executeCall(call, options);
|
|
576
|
+
if (resp === undefined) {
|
|
577
|
+
throw new Error('API call completed without a result.');
|
|
578
|
+
}
|
|
579
|
+
return resp;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** Rejects a model version stage transition request. */
|
|
583
|
+
async rejectTransitionRequest(
|
|
584
|
+
req: RejectTransitionRequest,
|
|
585
|
+
options?: CallOptions
|
|
586
|
+
): Promise<RejectTransitionRequest_Response> {
|
|
587
|
+
const url = `${this.host}/api/2.0/mlflow/transition-requests/reject`;
|
|
588
|
+
const body = marshalRequest(req, marshalRejectTransitionRequestSchema);
|
|
589
|
+
let resp: RejectTransitionRequest_Response | undefined;
|
|
590
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
591
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
592
|
+
if (this.workspaceId !== undefined) {
|
|
593
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
594
|
+
}
|
|
595
|
+
headers.set('User-Agent', this.userAgent);
|
|
596
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
597
|
+
const respBody = await executeHttpCall({
|
|
598
|
+
request: httpReq,
|
|
599
|
+
httpClient: this.httpClient,
|
|
600
|
+
logger: this.logger,
|
|
601
|
+
});
|
|
602
|
+
resp = parseResponse(
|
|
603
|
+
respBody,
|
|
604
|
+
unmarshalRejectTransitionRequest_ResponseSchema
|
|
605
|
+
);
|
|
606
|
+
};
|
|
607
|
+
await executeCall(call, options);
|
|
608
|
+
if (resp === undefined) {
|
|
609
|
+
throw new Error('API call completed without a result.');
|
|
610
|
+
}
|
|
611
|
+
return resp;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* **NOTE:** This endpoint is in Public Preview.
|
|
616
|
+
* Tests a registry webhook.
|
|
617
|
+
*/
|
|
618
|
+
async testRegistryWebhook(
|
|
619
|
+
req: TestRegistryWebhookRequest,
|
|
620
|
+
options?: CallOptions
|
|
621
|
+
): Promise<TestRegistryWebhookRequest_Response> {
|
|
622
|
+
const url = `${this.host}/api/2.0/mlflow/registry-webhooks/test`;
|
|
623
|
+
const body = marshalRequest(req, marshalTestRegistryWebhookRequestSchema);
|
|
624
|
+
let resp: TestRegistryWebhookRequest_Response | undefined;
|
|
625
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
626
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
627
|
+
if (this.workspaceId !== undefined) {
|
|
628
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
629
|
+
}
|
|
630
|
+
headers.set('User-Agent', this.userAgent);
|
|
631
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
632
|
+
const respBody = await executeHttpCall({
|
|
633
|
+
request: httpReq,
|
|
634
|
+
httpClient: this.httpClient,
|
|
635
|
+
logger: this.logger,
|
|
636
|
+
});
|
|
637
|
+
resp = parseResponse(
|
|
638
|
+
respBody,
|
|
639
|
+
unmarshalTestRegistryWebhookRequest_ResponseSchema
|
|
640
|
+
);
|
|
641
|
+
};
|
|
642
|
+
await executeCall(call, options);
|
|
643
|
+
if (resp === undefined) {
|
|
644
|
+
throw new Error('API call completed without a result.');
|
|
645
|
+
}
|
|
646
|
+
return resp;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Transition a model version's stage.
|
|
651
|
+
* This is a <Databricks> workspace version of the [MLflow endpoint](https://www.mlflow.org/docs/latest/rest-api.html#transition-modelversion-stage)
|
|
652
|
+
* that also accepts a comment associated with the transition to be recorded.
|
|
653
|
+
*/
|
|
654
|
+
async transitionModelVersionStageDatabricks(
|
|
655
|
+
req: TransitionModelVersionStageDatabricksRequest,
|
|
656
|
+
options?: CallOptions
|
|
657
|
+
): Promise<TransitionModelVersionStageDatabricksRequest_Response> {
|
|
658
|
+
const url = `${this.host}/api/2.0/mlflow/databricks/model-versions/transition-stage`;
|
|
659
|
+
const body = marshalRequest(
|
|
660
|
+
req,
|
|
661
|
+
marshalTransitionModelVersionStageDatabricksRequestSchema
|
|
662
|
+
);
|
|
663
|
+
let resp: TransitionModelVersionStageDatabricksRequest_Response | undefined;
|
|
664
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
665
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
666
|
+
if (this.workspaceId !== undefined) {
|
|
667
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
668
|
+
}
|
|
669
|
+
headers.set('User-Agent', this.userAgent);
|
|
670
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
671
|
+
const respBody = await executeHttpCall({
|
|
672
|
+
request: httpReq,
|
|
673
|
+
httpClient: this.httpClient,
|
|
674
|
+
logger: this.logger,
|
|
675
|
+
});
|
|
676
|
+
resp = parseResponse(
|
|
677
|
+
respBody,
|
|
678
|
+
unmarshalTransitionModelVersionStageDatabricksRequest_ResponseSchema
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
await executeCall(call, options);
|
|
682
|
+
if (resp === undefined) {
|
|
683
|
+
throw new Error('API call completed without a result.');
|
|
684
|
+
}
|
|
685
|
+
return resp;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** Post an edit to a comment on a model version. */
|
|
689
|
+
async updateComment(
|
|
690
|
+
req: UpdateCommentRequest,
|
|
691
|
+
options?: CallOptions
|
|
692
|
+
): Promise<UpdateCommentRequest_Response> {
|
|
693
|
+
const url = `${this.host}/api/2.0/mlflow/comments/update`;
|
|
694
|
+
const body = marshalRequest(req, marshalUpdateCommentRequestSchema);
|
|
695
|
+
let resp: UpdateCommentRequest_Response | undefined;
|
|
696
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
697
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
698
|
+
if (this.workspaceId !== undefined) {
|
|
699
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
700
|
+
}
|
|
701
|
+
headers.set('User-Agent', this.userAgent);
|
|
702
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
703
|
+
const respBody = await executeHttpCall({
|
|
704
|
+
request: httpReq,
|
|
705
|
+
httpClient: this.httpClient,
|
|
706
|
+
logger: this.logger,
|
|
707
|
+
});
|
|
708
|
+
resp = parseResponse(
|
|
709
|
+
respBody,
|
|
710
|
+
unmarshalUpdateCommentRequest_ResponseSchema
|
|
711
|
+
);
|
|
712
|
+
};
|
|
713
|
+
await executeCall(call, options);
|
|
714
|
+
if (resp === undefined) {
|
|
715
|
+
throw new Error('API call completed without a result.');
|
|
716
|
+
}
|
|
717
|
+
return resp;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* **NOTE:** This endpoint is in Public Preview.
|
|
722
|
+
* Updates a registry webhook.
|
|
723
|
+
*/
|
|
724
|
+
async updateRegistryWebhook(
|
|
725
|
+
req: UpdateRegistryWebhookRequest,
|
|
726
|
+
options?: CallOptions
|
|
727
|
+
): Promise<UpdateRegistryWebhookRequest_Response> {
|
|
728
|
+
const url = `${this.host}/api/2.0/mlflow/registry-webhooks/update`;
|
|
729
|
+
const body = marshalRequest(req, marshalUpdateRegistryWebhookRequestSchema);
|
|
730
|
+
let resp: UpdateRegistryWebhookRequest_Response | undefined;
|
|
731
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
732
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
733
|
+
if (this.workspaceId !== undefined) {
|
|
734
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
735
|
+
}
|
|
736
|
+
headers.set('User-Agent', this.userAgent);
|
|
737
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
738
|
+
const respBody = await executeHttpCall({
|
|
739
|
+
request: httpReq,
|
|
740
|
+
httpClient: this.httpClient,
|
|
741
|
+
logger: this.logger,
|
|
742
|
+
});
|
|
743
|
+
resp = parseResponse(
|
|
744
|
+
respBody,
|
|
745
|
+
unmarshalUpdateRegistryWebhookRequest_ResponseSchema
|
|
746
|
+
);
|
|
747
|
+
};
|
|
748
|
+
await executeCall(call, options);
|
|
749
|
+
if (resp === undefined) {
|
|
750
|
+
throw new Error('API call completed without a result.');
|
|
751
|
+
}
|
|
752
|
+
return resp;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/** Creates a model version. */
|
|
756
|
+
async createModelVersion(
|
|
757
|
+
req: CreateModelVersionRequest,
|
|
758
|
+
options?: CallOptions
|
|
759
|
+
): Promise<CreateModelVersionRequest_Response> {
|
|
760
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/create`;
|
|
761
|
+
const body = marshalRequest(req, marshalCreateModelVersionRequestSchema);
|
|
762
|
+
let resp: CreateModelVersionRequest_Response | undefined;
|
|
763
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
764
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
765
|
+
if (this.workspaceId !== undefined) {
|
|
766
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
767
|
+
}
|
|
768
|
+
headers.set('User-Agent', this.userAgent);
|
|
769
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
770
|
+
const respBody = await executeHttpCall({
|
|
771
|
+
request: httpReq,
|
|
772
|
+
httpClient: this.httpClient,
|
|
773
|
+
logger: this.logger,
|
|
774
|
+
});
|
|
775
|
+
resp = parseResponse(
|
|
776
|
+
respBody,
|
|
777
|
+
unmarshalCreateModelVersionRequest_ResponseSchema
|
|
778
|
+
);
|
|
779
|
+
};
|
|
780
|
+
await executeCall(call, options);
|
|
781
|
+
if (resp === undefined) {
|
|
782
|
+
throw new Error('API call completed without a result.');
|
|
783
|
+
}
|
|
784
|
+
return resp;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Creates a new registered model with the name specified in the request body.
|
|
789
|
+
* Throws `RESOURCE_ALREADY_EXISTS` if a registered model with the given name exists.
|
|
790
|
+
*/
|
|
791
|
+
async createRegisteredModel(
|
|
792
|
+
req: CreateRegisteredModelRequest,
|
|
793
|
+
options?: CallOptions
|
|
794
|
+
): Promise<CreateRegisteredModelRequest_Response> {
|
|
795
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/create`;
|
|
796
|
+
const body = marshalRequest(req, marshalCreateRegisteredModelRequestSchema);
|
|
797
|
+
let resp: CreateRegisteredModelRequest_Response | undefined;
|
|
798
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
799
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
800
|
+
if (this.workspaceId !== undefined) {
|
|
801
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
802
|
+
}
|
|
803
|
+
headers.set('User-Agent', this.userAgent);
|
|
804
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
805
|
+
const respBody = await executeHttpCall({
|
|
806
|
+
request: httpReq,
|
|
807
|
+
httpClient: this.httpClient,
|
|
808
|
+
logger: this.logger,
|
|
809
|
+
});
|
|
810
|
+
resp = parseResponse(
|
|
811
|
+
respBody,
|
|
812
|
+
unmarshalCreateRegisteredModelRequest_ResponseSchema
|
|
813
|
+
);
|
|
814
|
+
};
|
|
815
|
+
await executeCall(call, options);
|
|
816
|
+
if (resp === undefined) {
|
|
817
|
+
throw new Error('API call completed without a result.');
|
|
818
|
+
}
|
|
819
|
+
return resp;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/** Deletes a model version. */
|
|
823
|
+
async deleteModelVersion(
|
|
824
|
+
req: DeleteModelVersionRequest,
|
|
825
|
+
options?: CallOptions
|
|
826
|
+
): Promise<DeleteModelVersionRequest_Response> {
|
|
827
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/delete`;
|
|
828
|
+
const params = new URLSearchParams();
|
|
829
|
+
if (req.name !== undefined) {
|
|
830
|
+
params.append('name', req.name);
|
|
831
|
+
}
|
|
832
|
+
if (req.version !== undefined) {
|
|
833
|
+
params.append('version', req.version);
|
|
834
|
+
}
|
|
835
|
+
const query = params.toString();
|
|
836
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
837
|
+
let resp: DeleteModelVersionRequest_Response | undefined;
|
|
838
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
839
|
+
const headers = new Headers();
|
|
840
|
+
if (this.workspaceId !== undefined) {
|
|
841
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
842
|
+
}
|
|
843
|
+
headers.set('User-Agent', this.userAgent);
|
|
844
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
845
|
+
const respBody = await executeHttpCall({
|
|
846
|
+
request: httpReq,
|
|
847
|
+
httpClient: this.httpClient,
|
|
848
|
+
logger: this.logger,
|
|
849
|
+
});
|
|
850
|
+
resp = parseResponse(
|
|
851
|
+
respBody,
|
|
852
|
+
unmarshalDeleteModelVersionRequest_ResponseSchema
|
|
853
|
+
);
|
|
854
|
+
};
|
|
855
|
+
await executeCall(call, options);
|
|
856
|
+
if (resp === undefined) {
|
|
857
|
+
throw new Error('API call completed without a result.');
|
|
858
|
+
}
|
|
859
|
+
return resp;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/** Deletes a model version tag. */
|
|
863
|
+
async deleteModelVersionTag(
|
|
864
|
+
req: DeleteModelVersionTagRequest,
|
|
865
|
+
options?: CallOptions
|
|
866
|
+
): Promise<DeleteModelVersionTagRequest_Response> {
|
|
867
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/delete-tag`;
|
|
868
|
+
const params = new URLSearchParams();
|
|
869
|
+
if (req.name !== undefined) {
|
|
870
|
+
params.append('name', req.name);
|
|
871
|
+
}
|
|
872
|
+
if (req.version !== undefined) {
|
|
873
|
+
params.append('version', req.version);
|
|
874
|
+
}
|
|
875
|
+
if (req.key !== undefined) {
|
|
876
|
+
params.append('key', req.key);
|
|
877
|
+
}
|
|
878
|
+
const query = params.toString();
|
|
879
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
880
|
+
let resp: DeleteModelVersionTagRequest_Response | undefined;
|
|
881
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
882
|
+
const headers = new Headers();
|
|
883
|
+
if (this.workspaceId !== undefined) {
|
|
884
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
885
|
+
}
|
|
886
|
+
headers.set('User-Agent', this.userAgent);
|
|
887
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
888
|
+
const respBody = await executeHttpCall({
|
|
889
|
+
request: httpReq,
|
|
890
|
+
httpClient: this.httpClient,
|
|
891
|
+
logger: this.logger,
|
|
892
|
+
});
|
|
893
|
+
resp = parseResponse(
|
|
894
|
+
respBody,
|
|
895
|
+
unmarshalDeleteModelVersionTagRequest_ResponseSchema
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
await executeCall(call, options);
|
|
899
|
+
if (resp === undefined) {
|
|
900
|
+
throw new Error('API call completed without a result.');
|
|
901
|
+
}
|
|
902
|
+
return resp;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/** Deletes a registered model. */
|
|
906
|
+
async deleteRegisteredModel(
|
|
907
|
+
req: DeleteRegisteredModelRequest,
|
|
908
|
+
options?: CallOptions
|
|
909
|
+
): Promise<DeleteRegisteredModelRequest_Response> {
|
|
910
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/delete`;
|
|
911
|
+
const params = new URLSearchParams();
|
|
912
|
+
if (req.name !== undefined) {
|
|
913
|
+
params.append('name', req.name);
|
|
914
|
+
}
|
|
915
|
+
const query = params.toString();
|
|
916
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
917
|
+
let resp: DeleteRegisteredModelRequest_Response | undefined;
|
|
918
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
919
|
+
const headers = new Headers();
|
|
920
|
+
if (this.workspaceId !== undefined) {
|
|
921
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
922
|
+
}
|
|
923
|
+
headers.set('User-Agent', this.userAgent);
|
|
924
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
925
|
+
const respBody = await executeHttpCall({
|
|
926
|
+
request: httpReq,
|
|
927
|
+
httpClient: this.httpClient,
|
|
928
|
+
logger: this.logger,
|
|
929
|
+
});
|
|
930
|
+
resp = parseResponse(
|
|
931
|
+
respBody,
|
|
932
|
+
unmarshalDeleteRegisteredModelRequest_ResponseSchema
|
|
933
|
+
);
|
|
934
|
+
};
|
|
935
|
+
await executeCall(call, options);
|
|
936
|
+
if (resp === undefined) {
|
|
937
|
+
throw new Error('API call completed without a result.');
|
|
938
|
+
}
|
|
939
|
+
return resp;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/** Deletes the tag for a registered model. */
|
|
943
|
+
async deleteRegisteredModelTag(
|
|
944
|
+
req: DeleteRegisteredModelTagRequest,
|
|
945
|
+
options?: CallOptions
|
|
946
|
+
): Promise<DeleteRegisteredModelTagRequest_Response> {
|
|
947
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/delete-tag`;
|
|
948
|
+
const params = new URLSearchParams();
|
|
949
|
+
if (req.name !== undefined) {
|
|
950
|
+
params.append('name', req.name);
|
|
951
|
+
}
|
|
952
|
+
if (req.key !== undefined) {
|
|
953
|
+
params.append('key', req.key);
|
|
954
|
+
}
|
|
955
|
+
const query = params.toString();
|
|
956
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
957
|
+
let resp: DeleteRegisteredModelTagRequest_Response | undefined;
|
|
958
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
959
|
+
const headers = new Headers();
|
|
960
|
+
if (this.workspaceId !== undefined) {
|
|
961
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
962
|
+
}
|
|
963
|
+
headers.set('User-Agent', this.userAgent);
|
|
964
|
+
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
965
|
+
const respBody = await executeHttpCall({
|
|
966
|
+
request: httpReq,
|
|
967
|
+
httpClient: this.httpClient,
|
|
968
|
+
logger: this.logger,
|
|
969
|
+
});
|
|
970
|
+
resp = parseResponse(
|
|
971
|
+
respBody,
|
|
972
|
+
unmarshalDeleteRegisteredModelTagRequest_ResponseSchema
|
|
973
|
+
);
|
|
974
|
+
};
|
|
975
|
+
await executeCall(call, options);
|
|
976
|
+
if (resp === undefined) {
|
|
977
|
+
throw new Error('API call completed without a result.');
|
|
978
|
+
}
|
|
979
|
+
return resp;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/** Gets the latest version of a registered model. */
|
|
983
|
+
async getLatestVersions(
|
|
984
|
+
req: GetLatestVersionsRequest,
|
|
985
|
+
options?: CallOptions
|
|
986
|
+
): Promise<GetLatestVersionsRequest_Response> {
|
|
987
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/get-latest-versions`;
|
|
988
|
+
const body = marshalRequest(req, marshalGetLatestVersionsRequestSchema);
|
|
989
|
+
let resp: GetLatestVersionsRequest_Response | undefined;
|
|
990
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
991
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
992
|
+
if (this.workspaceId !== undefined) {
|
|
993
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
994
|
+
}
|
|
995
|
+
headers.set('User-Agent', this.userAgent);
|
|
996
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
997
|
+
const respBody = await executeHttpCall({
|
|
998
|
+
request: httpReq,
|
|
999
|
+
httpClient: this.httpClient,
|
|
1000
|
+
logger: this.logger,
|
|
1001
|
+
});
|
|
1002
|
+
resp = parseResponse(
|
|
1003
|
+
respBody,
|
|
1004
|
+
unmarshalGetLatestVersionsRequest_ResponseSchema
|
|
1005
|
+
);
|
|
1006
|
+
};
|
|
1007
|
+
await executeCall(call, options);
|
|
1008
|
+
if (resp === undefined) {
|
|
1009
|
+
throw new Error('API call completed without a result.');
|
|
1010
|
+
}
|
|
1011
|
+
return resp;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/** Get a model version. */
|
|
1015
|
+
async getModelVersion(
|
|
1016
|
+
req: GetModelVersionRequest,
|
|
1017
|
+
options?: CallOptions
|
|
1018
|
+
): Promise<GetModelVersionRequest_Response> {
|
|
1019
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/get`;
|
|
1020
|
+
const params = new URLSearchParams();
|
|
1021
|
+
if (req.name !== undefined) {
|
|
1022
|
+
params.append('name', req.name);
|
|
1023
|
+
}
|
|
1024
|
+
if (req.version !== undefined) {
|
|
1025
|
+
params.append('version', req.version);
|
|
1026
|
+
}
|
|
1027
|
+
const query = params.toString();
|
|
1028
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1029
|
+
let resp: GetModelVersionRequest_Response | undefined;
|
|
1030
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1031
|
+
const headers = new Headers();
|
|
1032
|
+
if (this.workspaceId !== undefined) {
|
|
1033
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1034
|
+
}
|
|
1035
|
+
headers.set('User-Agent', this.userAgent);
|
|
1036
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1037
|
+
const respBody = await executeHttpCall({
|
|
1038
|
+
request: httpReq,
|
|
1039
|
+
httpClient: this.httpClient,
|
|
1040
|
+
logger: this.logger,
|
|
1041
|
+
});
|
|
1042
|
+
resp = parseResponse(
|
|
1043
|
+
respBody,
|
|
1044
|
+
unmarshalGetModelVersionRequest_ResponseSchema
|
|
1045
|
+
);
|
|
1046
|
+
};
|
|
1047
|
+
await executeCall(call, options);
|
|
1048
|
+
if (resp === undefined) {
|
|
1049
|
+
throw new Error('API call completed without a result.');
|
|
1050
|
+
}
|
|
1051
|
+
return resp;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** Gets a URI to download the model version. */
|
|
1055
|
+
async getModelVersionDownloadUri(
|
|
1056
|
+
req: GetModelVersionDownloadUriRequest,
|
|
1057
|
+
options?: CallOptions
|
|
1058
|
+
): Promise<GetModelVersionDownloadUriRequest_Response> {
|
|
1059
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/get-download-uri`;
|
|
1060
|
+
const params = new URLSearchParams();
|
|
1061
|
+
if (req.name !== undefined) {
|
|
1062
|
+
params.append('name', req.name);
|
|
1063
|
+
}
|
|
1064
|
+
if (req.version !== undefined) {
|
|
1065
|
+
params.append('version', req.version);
|
|
1066
|
+
}
|
|
1067
|
+
const query = params.toString();
|
|
1068
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1069
|
+
let resp: GetModelVersionDownloadUriRequest_Response | undefined;
|
|
1070
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1071
|
+
const headers = new Headers();
|
|
1072
|
+
if (this.workspaceId !== undefined) {
|
|
1073
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1074
|
+
}
|
|
1075
|
+
headers.set('User-Agent', this.userAgent);
|
|
1076
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1077
|
+
const respBody = await executeHttpCall({
|
|
1078
|
+
request: httpReq,
|
|
1079
|
+
httpClient: this.httpClient,
|
|
1080
|
+
logger: this.logger,
|
|
1081
|
+
});
|
|
1082
|
+
resp = parseResponse(
|
|
1083
|
+
respBody,
|
|
1084
|
+
unmarshalGetModelVersionDownloadUriRequest_ResponseSchema
|
|
1085
|
+
);
|
|
1086
|
+
};
|
|
1087
|
+
await executeCall(call, options);
|
|
1088
|
+
if (resp === undefined) {
|
|
1089
|
+
throw new Error('API call completed without a result.');
|
|
1090
|
+
}
|
|
1091
|
+
return resp;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/** Lists all available registered models, up to the limit specified in __max_results__. */
|
|
1095
|
+
async listRegisteredModels(
|
|
1096
|
+
req: ListRegisteredModelsRequest,
|
|
1097
|
+
options?: CallOptions
|
|
1098
|
+
): Promise<ListRegisteredModelsRequest_Response> {
|
|
1099
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/list`;
|
|
1100
|
+
const params = new URLSearchParams();
|
|
1101
|
+
if (req.maxResults !== undefined) {
|
|
1102
|
+
params.append('max_results', String(req.maxResults));
|
|
1103
|
+
}
|
|
1104
|
+
if (req.pageToken !== undefined) {
|
|
1105
|
+
params.append('page_token', req.pageToken);
|
|
1106
|
+
}
|
|
1107
|
+
const query = params.toString();
|
|
1108
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1109
|
+
let resp: ListRegisteredModelsRequest_Response | undefined;
|
|
1110
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1111
|
+
const headers = new Headers();
|
|
1112
|
+
if (this.workspaceId !== undefined) {
|
|
1113
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1114
|
+
}
|
|
1115
|
+
headers.set('User-Agent', this.userAgent);
|
|
1116
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1117
|
+
const respBody = await executeHttpCall({
|
|
1118
|
+
request: httpReq,
|
|
1119
|
+
httpClient: this.httpClient,
|
|
1120
|
+
logger: this.logger,
|
|
1121
|
+
});
|
|
1122
|
+
resp = parseResponse(
|
|
1123
|
+
respBody,
|
|
1124
|
+
unmarshalListRegisteredModelsRequest_ResponseSchema
|
|
1125
|
+
);
|
|
1126
|
+
};
|
|
1127
|
+
await executeCall(call, options);
|
|
1128
|
+
if (resp === undefined) {
|
|
1129
|
+
throw new Error('API call completed without a result.');
|
|
1130
|
+
}
|
|
1131
|
+
return resp;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
async *listRegisteredModelsIter(
|
|
1135
|
+
req: ListRegisteredModelsRequest,
|
|
1136
|
+
options?: CallOptions
|
|
1137
|
+
): AsyncGenerator<RegisteredModel> {
|
|
1138
|
+
const pageReq: ListRegisteredModelsRequest = {...req};
|
|
1139
|
+
for (;;) {
|
|
1140
|
+
const resp = await this.listRegisteredModels(pageReq, options);
|
|
1141
|
+
for (const item of resp.registeredModels ?? []) {
|
|
1142
|
+
yield item;
|
|
1143
|
+
}
|
|
1144
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/** Renames a registered model. */
|
|
1152
|
+
async renameRegisteredModel(
|
|
1153
|
+
req: RenameRegisteredModelRequest,
|
|
1154
|
+
options?: CallOptions
|
|
1155
|
+
): Promise<RenameRegisteredModelRequest_Response> {
|
|
1156
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/rename`;
|
|
1157
|
+
const body = marshalRequest(req, marshalRenameRegisteredModelRequestSchema);
|
|
1158
|
+
let resp: RenameRegisteredModelRequest_Response | undefined;
|
|
1159
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1160
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1161
|
+
if (this.workspaceId !== undefined) {
|
|
1162
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1163
|
+
}
|
|
1164
|
+
headers.set('User-Agent', this.userAgent);
|
|
1165
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
1166
|
+
const respBody = await executeHttpCall({
|
|
1167
|
+
request: httpReq,
|
|
1168
|
+
httpClient: this.httpClient,
|
|
1169
|
+
logger: this.logger,
|
|
1170
|
+
});
|
|
1171
|
+
resp = parseResponse(
|
|
1172
|
+
respBody,
|
|
1173
|
+
unmarshalRenameRegisteredModelRequest_ResponseSchema
|
|
1174
|
+
);
|
|
1175
|
+
};
|
|
1176
|
+
await executeCall(call, options);
|
|
1177
|
+
if (resp === undefined) {
|
|
1178
|
+
throw new Error('API call completed without a result.');
|
|
1179
|
+
}
|
|
1180
|
+
return resp;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/** Searches for specific model versions based on the supplied __filter__. */
|
|
1184
|
+
async searchModelVersions(
|
|
1185
|
+
req: SearchModelVersionsRequest,
|
|
1186
|
+
options?: CallOptions
|
|
1187
|
+
): Promise<SearchModelVersionsRequest_Response> {
|
|
1188
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/search`;
|
|
1189
|
+
const params = new URLSearchParams();
|
|
1190
|
+
if (req.filter !== undefined) {
|
|
1191
|
+
params.append('filter', req.filter);
|
|
1192
|
+
}
|
|
1193
|
+
if (req.maxResults !== undefined) {
|
|
1194
|
+
params.append('max_results', String(req.maxResults));
|
|
1195
|
+
}
|
|
1196
|
+
if (req.orderBy !== undefined) {
|
|
1197
|
+
params.append('order_by', String(req.orderBy));
|
|
1198
|
+
}
|
|
1199
|
+
if (req.pageToken !== undefined) {
|
|
1200
|
+
params.append('page_token', req.pageToken);
|
|
1201
|
+
}
|
|
1202
|
+
const query = params.toString();
|
|
1203
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1204
|
+
let resp: SearchModelVersionsRequest_Response | undefined;
|
|
1205
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1206
|
+
const headers = new Headers();
|
|
1207
|
+
if (this.workspaceId !== undefined) {
|
|
1208
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1209
|
+
}
|
|
1210
|
+
headers.set('User-Agent', this.userAgent);
|
|
1211
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1212
|
+
const respBody = await executeHttpCall({
|
|
1213
|
+
request: httpReq,
|
|
1214
|
+
httpClient: this.httpClient,
|
|
1215
|
+
logger: this.logger,
|
|
1216
|
+
});
|
|
1217
|
+
resp = parseResponse(
|
|
1218
|
+
respBody,
|
|
1219
|
+
unmarshalSearchModelVersionsRequest_ResponseSchema
|
|
1220
|
+
);
|
|
1221
|
+
};
|
|
1222
|
+
await executeCall(call, options);
|
|
1223
|
+
if (resp === undefined) {
|
|
1224
|
+
throw new Error('API call completed without a result.');
|
|
1225
|
+
}
|
|
1226
|
+
return resp;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
async *searchModelVersionsIter(
|
|
1230
|
+
req: SearchModelVersionsRequest,
|
|
1231
|
+
options?: CallOptions
|
|
1232
|
+
): AsyncGenerator<ModelVersion> {
|
|
1233
|
+
const pageReq: SearchModelVersionsRequest = {...req};
|
|
1234
|
+
for (;;) {
|
|
1235
|
+
const resp = await this.searchModelVersions(pageReq, options);
|
|
1236
|
+
for (const item of resp.modelVersions ?? []) {
|
|
1237
|
+
yield item;
|
|
1238
|
+
}
|
|
1239
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/** Search for registered models based on the specified __filter__. */
|
|
1247
|
+
async searchRegisteredModels(
|
|
1248
|
+
req: SearchRegisteredModelsRequest,
|
|
1249
|
+
options?: CallOptions
|
|
1250
|
+
): Promise<SearchRegisteredModelsRequest_Response> {
|
|
1251
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/search`;
|
|
1252
|
+
const params = new URLSearchParams();
|
|
1253
|
+
if (req.filter !== undefined) {
|
|
1254
|
+
params.append('filter', req.filter);
|
|
1255
|
+
}
|
|
1256
|
+
if (req.maxResults !== undefined) {
|
|
1257
|
+
params.append('max_results', String(req.maxResults));
|
|
1258
|
+
}
|
|
1259
|
+
if (req.orderBy !== undefined) {
|
|
1260
|
+
params.append('order_by', String(req.orderBy));
|
|
1261
|
+
}
|
|
1262
|
+
if (req.pageToken !== undefined) {
|
|
1263
|
+
params.append('page_token', req.pageToken);
|
|
1264
|
+
}
|
|
1265
|
+
const query = params.toString();
|
|
1266
|
+
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
1267
|
+
let resp: SearchRegisteredModelsRequest_Response | undefined;
|
|
1268
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1269
|
+
const headers = new Headers();
|
|
1270
|
+
if (this.workspaceId !== undefined) {
|
|
1271
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1272
|
+
}
|
|
1273
|
+
headers.set('User-Agent', this.userAgent);
|
|
1274
|
+
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
1275
|
+
const respBody = await executeHttpCall({
|
|
1276
|
+
request: httpReq,
|
|
1277
|
+
httpClient: this.httpClient,
|
|
1278
|
+
logger: this.logger,
|
|
1279
|
+
});
|
|
1280
|
+
resp = parseResponse(
|
|
1281
|
+
respBody,
|
|
1282
|
+
unmarshalSearchRegisteredModelsRequest_ResponseSchema
|
|
1283
|
+
);
|
|
1284
|
+
};
|
|
1285
|
+
await executeCall(call, options);
|
|
1286
|
+
if (resp === undefined) {
|
|
1287
|
+
throw new Error('API call completed without a result.');
|
|
1288
|
+
}
|
|
1289
|
+
return resp;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
async *searchRegisteredModelsIter(
|
|
1293
|
+
req: SearchRegisteredModelsRequest,
|
|
1294
|
+
options?: CallOptions
|
|
1295
|
+
): AsyncGenerator<RegisteredModel> {
|
|
1296
|
+
const pageReq: SearchRegisteredModelsRequest = {...req};
|
|
1297
|
+
for (;;) {
|
|
1298
|
+
const resp = await this.searchRegisteredModels(pageReq, options);
|
|
1299
|
+
for (const item of resp.registeredModels ?? []) {
|
|
1300
|
+
yield item;
|
|
1301
|
+
}
|
|
1302
|
+
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/** Sets a model version tag. */
|
|
1310
|
+
async setModelVersionTag(
|
|
1311
|
+
req: SetModelVersionTagRequest,
|
|
1312
|
+
options?: CallOptions
|
|
1313
|
+
): Promise<SetModelVersionTagRequest_Response> {
|
|
1314
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/set-tag`;
|
|
1315
|
+
const body = marshalRequest(req, marshalSetModelVersionTagRequestSchema);
|
|
1316
|
+
let resp: SetModelVersionTagRequest_Response | undefined;
|
|
1317
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1318
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1319
|
+
if (this.workspaceId !== undefined) {
|
|
1320
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1321
|
+
}
|
|
1322
|
+
headers.set('User-Agent', this.userAgent);
|
|
1323
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
1324
|
+
const respBody = await executeHttpCall({
|
|
1325
|
+
request: httpReq,
|
|
1326
|
+
httpClient: this.httpClient,
|
|
1327
|
+
logger: this.logger,
|
|
1328
|
+
});
|
|
1329
|
+
resp = parseResponse(
|
|
1330
|
+
respBody,
|
|
1331
|
+
unmarshalSetModelVersionTagRequest_ResponseSchema
|
|
1332
|
+
);
|
|
1333
|
+
};
|
|
1334
|
+
await executeCall(call, options);
|
|
1335
|
+
if (resp === undefined) {
|
|
1336
|
+
throw new Error('API call completed without a result.');
|
|
1337
|
+
}
|
|
1338
|
+
return resp;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/** Sets a tag on a registered model. */
|
|
1342
|
+
async setRegisteredModelTag(
|
|
1343
|
+
req: SetRegisteredModelTagRequest,
|
|
1344
|
+
options?: CallOptions
|
|
1345
|
+
): Promise<SetRegisteredModelTagRequest_Response> {
|
|
1346
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/set-tag`;
|
|
1347
|
+
const body = marshalRequest(req, marshalSetRegisteredModelTagRequestSchema);
|
|
1348
|
+
let resp: SetRegisteredModelTagRequest_Response | undefined;
|
|
1349
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1350
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1351
|
+
if (this.workspaceId !== undefined) {
|
|
1352
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1353
|
+
}
|
|
1354
|
+
headers.set('User-Agent', this.userAgent);
|
|
1355
|
+
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
1356
|
+
const respBody = await executeHttpCall({
|
|
1357
|
+
request: httpReq,
|
|
1358
|
+
httpClient: this.httpClient,
|
|
1359
|
+
logger: this.logger,
|
|
1360
|
+
});
|
|
1361
|
+
resp = parseResponse(
|
|
1362
|
+
respBody,
|
|
1363
|
+
unmarshalSetRegisteredModelTagRequest_ResponseSchema
|
|
1364
|
+
);
|
|
1365
|
+
};
|
|
1366
|
+
await executeCall(call, options);
|
|
1367
|
+
if (resp === undefined) {
|
|
1368
|
+
throw new Error('API call completed without a result.');
|
|
1369
|
+
}
|
|
1370
|
+
return resp;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/** Updates the model version. */
|
|
1374
|
+
async updateModelVersion(
|
|
1375
|
+
req: UpdateModelVersionRequest,
|
|
1376
|
+
options?: CallOptions
|
|
1377
|
+
): Promise<UpdateModelVersionRequest_Response> {
|
|
1378
|
+
const url = `${this.host}/api/2.0/mlflow/model-versions/update`;
|
|
1379
|
+
const body = marshalRequest(req, marshalUpdateModelVersionRequestSchema);
|
|
1380
|
+
let resp: UpdateModelVersionRequest_Response | undefined;
|
|
1381
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1382
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1383
|
+
if (this.workspaceId !== undefined) {
|
|
1384
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1385
|
+
}
|
|
1386
|
+
headers.set('User-Agent', this.userAgent);
|
|
1387
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1388
|
+
const respBody = await executeHttpCall({
|
|
1389
|
+
request: httpReq,
|
|
1390
|
+
httpClient: this.httpClient,
|
|
1391
|
+
logger: this.logger,
|
|
1392
|
+
});
|
|
1393
|
+
resp = parseResponse(
|
|
1394
|
+
respBody,
|
|
1395
|
+
unmarshalUpdateModelVersionRequest_ResponseSchema
|
|
1396
|
+
);
|
|
1397
|
+
};
|
|
1398
|
+
await executeCall(call, options);
|
|
1399
|
+
if (resp === undefined) {
|
|
1400
|
+
throw new Error('API call completed without a result.');
|
|
1401
|
+
}
|
|
1402
|
+
return resp;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** Updates a registered model. */
|
|
1406
|
+
async updateRegisteredModel(
|
|
1407
|
+
req: UpdateRegisteredModelRequest,
|
|
1408
|
+
options?: CallOptions
|
|
1409
|
+
): Promise<UpdateRegisteredModelRequest_Response> {
|
|
1410
|
+
const url = `${this.host}/api/2.0/mlflow/registered-models/update`;
|
|
1411
|
+
const body = marshalRequest(req, marshalUpdateRegisteredModelRequestSchema);
|
|
1412
|
+
let resp: UpdateRegisteredModelRequest_Response | undefined;
|
|
1413
|
+
const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1414
|
+
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1415
|
+
if (this.workspaceId !== undefined) {
|
|
1416
|
+
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
1417
|
+
}
|
|
1418
|
+
headers.set('User-Agent', this.userAgent);
|
|
1419
|
+
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1420
|
+
const respBody = await executeHttpCall({
|
|
1421
|
+
request: httpReq,
|
|
1422
|
+
httpClient: this.httpClient,
|
|
1423
|
+
logger: this.logger,
|
|
1424
|
+
});
|
|
1425
|
+
resp = parseResponse(
|
|
1426
|
+
respBody,
|
|
1427
|
+
unmarshalUpdateRegisteredModelRequest_ResponseSchema
|
|
1428
|
+
);
|
|
1429
|
+
};
|
|
1430
|
+
await executeCall(call, options);
|
|
1431
|
+
if (resp === undefined) {
|
|
1432
|
+
throw new Error('API call completed without a result.');
|
|
1433
|
+
}
|
|
1434
|
+
return resp;
|
|
1435
|
+
}
|
|
1436
|
+
}
|