@databricks/sdk-modelregistry 0.1.0-dev.3 → 0.1.0-dev.5
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/README.md +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +171 -141
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/model.d.ts +61 -54
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +79 -81
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v1/client.ts +0 -1393
- package/src/v1/index.ts +0 -94
- package/src/v1/model.ts +0 -1993
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/dist/v1/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
4
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveClientConfig } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
8
|
import { marshalApproveTransitionRequestSchema, marshalCreateCommentRequestSchema, marshalCreateModelVersionRequestSchema, marshalCreateRegisteredModelRequestSchema, marshalCreateRegistryWebhookRequestSchema, marshalCreateTransitionRequestSchema, marshalListLatestVersionsRequestSchema, marshalRejectTransitionRequestSchema, marshalRenameRegisteredModelRequestSchema, marshalSetModelVersionTagRequestSchema, marshalSetRegisteredModelTagRequestSchema, marshalTestRegistryWebhookRequestSchema, marshalTransitionModelVersionStageDatabricksRequestSchema, marshalUpdateCommentRequestSchema, marshalUpdateModelVersionRequestSchema, marshalUpdateRegisteredModelRequestSchema, marshalUpdateRegistryWebhookRequestSchema, unmarshalApproveTransitionResponseSchema, unmarshalCreateCommentResponseSchema, unmarshalCreateModelVersionResponseSchema, unmarshalCreateRegisteredModelResponseSchema, unmarshalCreateRegistryWebhookResponseSchema, unmarshalCreateTransitionResponseSchema, unmarshalDeleteCommentResponseSchema, unmarshalDeleteModelVersionResponseSchema, unmarshalDeleteModelVersionTagResponseSchema, unmarshalDeleteRegisteredModelResponseSchema, unmarshalDeleteRegisteredModelTagResponseSchema, unmarshalDeleteRegistryWebhookResponseSchema, unmarshalDeleteTransitionResponseSchema, unmarshalGetLatestVersionsResponseSchema, unmarshalGetModelVersionDownloadUriResponseSchema, unmarshalGetModelVersionResponseSchema, unmarshalGetRegisteredModelDatabricksResponseSchema, unmarshalListRegisteredModelsResponseSchema, unmarshalListRegistryWebhooksResponseSchema, unmarshalListTransitionResponseSchema, unmarshalRejectTransitionResponseSchema, unmarshalRenameRegisteredModelResponseSchema, unmarshalSearchModelVersionsResponseSchema, unmarshalSearchRegisteredModelsResponseSchema, unmarshalSetModelVersionTagResponseSchema, unmarshalSetRegisteredModelTagResponseSchema, unmarshalTestRegistryWebhookResponseSchema, unmarshalTransitionModelVersionStageDatabricksResponseSchema, unmarshalUpdateCommentResponseSchema, unmarshalUpdateModelVersionResponseSchema, unmarshalUpdateRegisteredModelResponseSchema, unmarshalUpdateRegistryWebhookResponseSchema, } from './model';
|
|
@@ -12,46 +12,45 @@ const PACKAGE_SEGMENT = {
|
|
|
12
12
|
value: pkgJson.version,
|
|
13
13
|
};
|
|
14
14
|
export class ModelRegistryClient {
|
|
15
|
-
|
|
16
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
17
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
18
|
-
// request.
|
|
19
|
-
workspaceId;
|
|
20
|
-
httpClient;
|
|
15
|
+
options;
|
|
21
16
|
logger;
|
|
22
17
|
// User-Agent header value. Composed once at construction from
|
|
23
18
|
// createDefault() merged with this package's identity and the active
|
|
24
19
|
// credential's name.
|
|
25
20
|
userAgent;
|
|
21
|
+
// Memoized configuration. The profile is resolved once, lazily, on the first
|
|
22
|
+
// request, then reused; host, workspaceId/accountId, and credentials are
|
|
23
|
+
// filled from it when not set explicitly on the options.
|
|
24
|
+
config;
|
|
26
25
|
constructor(options) {
|
|
27
|
-
|
|
28
|
-
throw new Error('Host is required.');
|
|
29
|
-
}
|
|
30
|
-
this.host = options.host.replace(/\/$/, '');
|
|
31
|
-
this.workspaceId = options.workspaceId;
|
|
26
|
+
this.options = options;
|
|
32
27
|
this.logger = options.logger ?? new NoOpLogger();
|
|
33
28
|
const info = createDefault()
|
|
34
29
|
.with(PACKAGE_SEGMENT)
|
|
35
30
|
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
36
31
|
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
37
32
|
this.userAgent = info.toString();
|
|
38
|
-
|
|
33
|
+
}
|
|
34
|
+
resolveConfig() {
|
|
35
|
+
this.config ??= resolveClientConfig(this.options);
|
|
36
|
+
return this.config;
|
|
39
37
|
}
|
|
40
38
|
/** Approves a model version stage transition request. */
|
|
41
39
|
async approveTransitionRequest(req, options) {
|
|
42
|
-
const
|
|
40
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
41
|
+
const url = `${host}/api/2.0/mlflow/transition-requests/approve`;
|
|
43
42
|
const body = marshalRequest(req, marshalApproveTransitionRequestSchema);
|
|
44
43
|
let resp;
|
|
45
44
|
const call = async (callSignal) => {
|
|
46
45
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
47
|
-
if (
|
|
48
|
-
headers.set('X-Databricks-Org-Id',
|
|
46
|
+
if (workspaceId !== undefined) {
|
|
47
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
49
48
|
}
|
|
50
49
|
headers.set('User-Agent', this.userAgent);
|
|
51
50
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
52
51
|
const respBody = await executeHttpCall({
|
|
53
52
|
request: httpReq,
|
|
54
|
-
httpClient
|
|
53
|
+
httpClient,
|
|
55
54
|
logger: this.logger,
|
|
56
55
|
});
|
|
57
56
|
resp = parseResponse(respBody, unmarshalApproveTransitionResponseSchema);
|
|
@@ -67,19 +66,20 @@ export class ModelRegistryClient {
|
|
|
67
66
|
* relevant information about the model. For example, test results or deployment errors.
|
|
68
67
|
*/
|
|
69
68
|
async createComment(req, options) {
|
|
70
|
-
const
|
|
69
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
70
|
+
const url = `${host}/api/2.0/mlflow/comments/create`;
|
|
71
71
|
const body = marshalRequest(req, marshalCreateCommentRequestSchema);
|
|
72
72
|
let resp;
|
|
73
73
|
const call = async (callSignal) => {
|
|
74
74
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
75
|
-
if (
|
|
76
|
-
headers.set('X-Databricks-Org-Id',
|
|
75
|
+
if (workspaceId !== undefined) {
|
|
76
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
77
77
|
}
|
|
78
78
|
headers.set('User-Agent', this.userAgent);
|
|
79
79
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
80
80
|
const respBody = await executeHttpCall({
|
|
81
81
|
request: httpReq,
|
|
82
|
-
httpClient
|
|
82
|
+
httpClient,
|
|
83
83
|
logger: this.logger,
|
|
84
84
|
});
|
|
85
85
|
resp = parseResponse(respBody, unmarshalCreateCommentResponseSchema);
|
|
@@ -95,19 +95,20 @@ export class ModelRegistryClient {
|
|
|
95
95
|
* Creates a registry webhook.
|
|
96
96
|
*/
|
|
97
97
|
async createRegistryWebhook(req, options) {
|
|
98
|
-
const
|
|
98
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
99
|
+
const url = `${host}/api/2.0/mlflow/registry-webhooks/create`;
|
|
99
100
|
const body = marshalRequest(req, marshalCreateRegistryWebhookRequestSchema);
|
|
100
101
|
let resp;
|
|
101
102
|
const call = async (callSignal) => {
|
|
102
103
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
103
|
-
if (
|
|
104
|
-
headers.set('X-Databricks-Org-Id',
|
|
104
|
+
if (workspaceId !== undefined) {
|
|
105
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
105
106
|
}
|
|
106
107
|
headers.set('User-Agent', this.userAgent);
|
|
107
108
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
108
109
|
const respBody = await executeHttpCall({
|
|
109
110
|
request: httpReq,
|
|
110
|
-
httpClient
|
|
111
|
+
httpClient,
|
|
111
112
|
logger: this.logger,
|
|
112
113
|
});
|
|
113
114
|
resp = parseResponse(respBody, unmarshalCreateRegistryWebhookResponseSchema);
|
|
@@ -120,19 +121,20 @@ export class ModelRegistryClient {
|
|
|
120
121
|
}
|
|
121
122
|
/** Creates a model version stage transition request. */
|
|
122
123
|
async createTransitionRequest(req, options) {
|
|
123
|
-
const
|
|
124
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
125
|
+
const url = `${host}/api/2.0/mlflow/transition-requests/create`;
|
|
124
126
|
const body = marshalRequest(req, marshalCreateTransitionRequestSchema);
|
|
125
127
|
let resp;
|
|
126
128
|
const call = async (callSignal) => {
|
|
127
129
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
128
|
-
if (
|
|
129
|
-
headers.set('X-Databricks-Org-Id',
|
|
130
|
+
if (workspaceId !== undefined) {
|
|
131
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
130
132
|
}
|
|
131
133
|
headers.set('User-Agent', this.userAgent);
|
|
132
134
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
133
135
|
const respBody = await executeHttpCall({
|
|
134
136
|
request: httpReq,
|
|
135
|
-
httpClient
|
|
137
|
+
httpClient,
|
|
136
138
|
logger: this.logger,
|
|
137
139
|
});
|
|
138
140
|
resp = parseResponse(respBody, unmarshalCreateTransitionResponseSchema);
|
|
@@ -145,7 +147,8 @@ export class ModelRegistryClient {
|
|
|
145
147
|
}
|
|
146
148
|
/** Deletes a comment on a model version. */
|
|
147
149
|
async deleteComment(req, options) {
|
|
148
|
-
const
|
|
150
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
151
|
+
const url = `${host}/api/2.0/mlflow/comments/delete`;
|
|
149
152
|
const params = new URLSearchParams();
|
|
150
153
|
if (req.id !== undefined) {
|
|
151
154
|
params.append('id', req.id);
|
|
@@ -155,14 +158,14 @@ export class ModelRegistryClient {
|
|
|
155
158
|
let resp;
|
|
156
159
|
const call = async (callSignal) => {
|
|
157
160
|
const headers = new Headers();
|
|
158
|
-
if (
|
|
159
|
-
headers.set('X-Databricks-Org-Id',
|
|
161
|
+
if (workspaceId !== undefined) {
|
|
162
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
160
163
|
}
|
|
161
164
|
headers.set('User-Agent', this.userAgent);
|
|
162
165
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
163
166
|
const respBody = await executeHttpCall({
|
|
164
167
|
request: httpReq,
|
|
165
|
-
httpClient
|
|
168
|
+
httpClient,
|
|
166
169
|
logger: this.logger,
|
|
167
170
|
});
|
|
168
171
|
resp = parseResponse(respBody, unmarshalDeleteCommentResponseSchema);
|
|
@@ -178,7 +181,8 @@ export class ModelRegistryClient {
|
|
|
178
181
|
* Deletes a registry webhook.
|
|
179
182
|
*/
|
|
180
183
|
async deleteRegistryWebhook(req, options) {
|
|
181
|
-
const
|
|
184
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
185
|
+
const url = `${host}/api/2.0/mlflow/registry-webhooks/delete`;
|
|
182
186
|
const params = new URLSearchParams();
|
|
183
187
|
if (req.id !== undefined) {
|
|
184
188
|
params.append('id', req.id);
|
|
@@ -188,14 +192,14 @@ export class ModelRegistryClient {
|
|
|
188
192
|
let resp;
|
|
189
193
|
const call = async (callSignal) => {
|
|
190
194
|
const headers = new Headers();
|
|
191
|
-
if (
|
|
192
|
-
headers.set('X-Databricks-Org-Id',
|
|
195
|
+
if (workspaceId !== undefined) {
|
|
196
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
193
197
|
}
|
|
194
198
|
headers.set('User-Agent', this.userAgent);
|
|
195
199
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
196
200
|
const respBody = await executeHttpCall({
|
|
197
201
|
request: httpReq,
|
|
198
|
-
httpClient
|
|
202
|
+
httpClient,
|
|
199
203
|
logger: this.logger,
|
|
200
204
|
});
|
|
201
205
|
resp = parseResponse(respBody, unmarshalDeleteRegistryWebhookResponseSchema);
|
|
@@ -208,7 +212,8 @@ export class ModelRegistryClient {
|
|
|
208
212
|
}
|
|
209
213
|
/** Cancels a model version stage transition request. */
|
|
210
214
|
async deleteTransitionRequest(req, options) {
|
|
211
|
-
const
|
|
215
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
216
|
+
const url = `${host}/api/2.0/mlflow/transition-requests/delete`;
|
|
212
217
|
const params = new URLSearchParams();
|
|
213
218
|
if (req.name !== undefined) {
|
|
214
219
|
params.append('name', req.name);
|
|
@@ -230,14 +235,14 @@ export class ModelRegistryClient {
|
|
|
230
235
|
let resp;
|
|
231
236
|
const call = async (callSignal) => {
|
|
232
237
|
const headers = new Headers();
|
|
233
|
-
if (
|
|
234
|
-
headers.set('X-Databricks-Org-Id',
|
|
238
|
+
if (workspaceId !== undefined) {
|
|
239
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
235
240
|
}
|
|
236
241
|
headers.set('User-Agent', this.userAgent);
|
|
237
242
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
238
243
|
const respBody = await executeHttpCall({
|
|
239
244
|
request: httpReq,
|
|
240
|
-
httpClient
|
|
245
|
+
httpClient,
|
|
241
246
|
logger: this.logger,
|
|
242
247
|
});
|
|
243
248
|
resp = parseResponse(respBody, unmarshalDeleteTransitionResponseSchema);
|
|
@@ -254,7 +259,8 @@ export class ModelRegistryClient {
|
|
|
254
259
|
* that also returns the model's <Databricks> workspace ID and the permission level of the requesting user on the model.
|
|
255
260
|
*/
|
|
256
261
|
async getRegisteredModelDatabricks(req, options) {
|
|
257
|
-
const
|
|
262
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
263
|
+
const url = `${host}/api/2.0/mlflow/databricks/registered-models/get`;
|
|
258
264
|
const params = new URLSearchParams();
|
|
259
265
|
if (req.name !== undefined) {
|
|
260
266
|
params.append('name', req.name);
|
|
@@ -264,14 +270,14 @@ export class ModelRegistryClient {
|
|
|
264
270
|
let resp;
|
|
265
271
|
const call = async (callSignal) => {
|
|
266
272
|
const headers = new Headers();
|
|
267
|
-
if (
|
|
268
|
-
headers.set('X-Databricks-Org-Id',
|
|
273
|
+
if (workspaceId !== undefined) {
|
|
274
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
269
275
|
}
|
|
270
276
|
headers.set('User-Agent', this.userAgent);
|
|
271
277
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
272
278
|
const respBody = await executeHttpCall({
|
|
273
279
|
request: httpReq,
|
|
274
|
-
httpClient
|
|
280
|
+
httpClient,
|
|
275
281
|
logger: this.logger,
|
|
276
282
|
});
|
|
277
283
|
resp = parseResponse(respBody, unmarshalGetRegisteredModelDatabricksResponseSchema);
|
|
@@ -287,7 +293,8 @@ export class ModelRegistryClient {
|
|
|
287
293
|
* Lists all registry webhooks.
|
|
288
294
|
*/
|
|
289
295
|
async listRegistryWebhooks(req, options) {
|
|
290
|
-
const
|
|
296
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
297
|
+
const url = `${host}/api/2.0/mlflow/registry-webhooks/list`;
|
|
291
298
|
const params = new URLSearchParams();
|
|
292
299
|
if (req.modelName !== undefined) {
|
|
293
300
|
params.append('model_name', req.modelName);
|
|
@@ -306,14 +313,14 @@ export class ModelRegistryClient {
|
|
|
306
313
|
let resp;
|
|
307
314
|
const call = async (callSignal) => {
|
|
308
315
|
const headers = new Headers();
|
|
309
|
-
if (
|
|
310
|
-
headers.set('X-Databricks-Org-Id',
|
|
316
|
+
if (workspaceId !== undefined) {
|
|
317
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
311
318
|
}
|
|
312
319
|
headers.set('User-Agent', this.userAgent);
|
|
313
320
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
314
321
|
const respBody = await executeHttpCall({
|
|
315
322
|
request: httpReq,
|
|
316
|
-
httpClient
|
|
323
|
+
httpClient,
|
|
317
324
|
logger: this.logger,
|
|
318
325
|
});
|
|
319
326
|
resp = parseResponse(respBody, unmarshalListRegistryWebhooksResponseSchema);
|
|
@@ -339,7 +346,8 @@ export class ModelRegistryClient {
|
|
|
339
346
|
}
|
|
340
347
|
/** Gets a list of all open stage transition requests for the model version. */
|
|
341
348
|
async listTransitionsRequest(req, options) {
|
|
342
|
-
const
|
|
349
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
350
|
+
const url = `${host}/api/2.0/mlflow/transition-requests/list`;
|
|
343
351
|
const params = new URLSearchParams();
|
|
344
352
|
if (req.name !== undefined) {
|
|
345
353
|
params.append('name', req.name);
|
|
@@ -352,14 +360,14 @@ export class ModelRegistryClient {
|
|
|
352
360
|
let resp;
|
|
353
361
|
const call = async (callSignal) => {
|
|
354
362
|
const headers = new Headers();
|
|
355
|
-
if (
|
|
356
|
-
headers.set('X-Databricks-Org-Id',
|
|
363
|
+
if (workspaceId !== undefined) {
|
|
364
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
357
365
|
}
|
|
358
366
|
headers.set('User-Agent', this.userAgent);
|
|
359
367
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
360
368
|
const respBody = await executeHttpCall({
|
|
361
369
|
request: httpReq,
|
|
362
|
-
httpClient
|
|
370
|
+
httpClient,
|
|
363
371
|
logger: this.logger,
|
|
364
372
|
});
|
|
365
373
|
resp = parseResponse(respBody, unmarshalListTransitionResponseSchema);
|
|
@@ -372,19 +380,20 @@ export class ModelRegistryClient {
|
|
|
372
380
|
}
|
|
373
381
|
/** Rejects a model version stage transition request. */
|
|
374
382
|
async rejectTransitionRequest(req, options) {
|
|
375
|
-
const
|
|
383
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
384
|
+
const url = `${host}/api/2.0/mlflow/transition-requests/reject`;
|
|
376
385
|
const body = marshalRequest(req, marshalRejectTransitionRequestSchema);
|
|
377
386
|
let resp;
|
|
378
387
|
const call = async (callSignal) => {
|
|
379
388
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
380
|
-
if (
|
|
381
|
-
headers.set('X-Databricks-Org-Id',
|
|
389
|
+
if (workspaceId !== undefined) {
|
|
390
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
382
391
|
}
|
|
383
392
|
headers.set('User-Agent', this.userAgent);
|
|
384
393
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
385
394
|
const respBody = await executeHttpCall({
|
|
386
395
|
request: httpReq,
|
|
387
|
-
httpClient
|
|
396
|
+
httpClient,
|
|
388
397
|
logger: this.logger,
|
|
389
398
|
});
|
|
390
399
|
resp = parseResponse(respBody, unmarshalRejectTransitionResponseSchema);
|
|
@@ -400,19 +409,20 @@ export class ModelRegistryClient {
|
|
|
400
409
|
* Tests a registry webhook.
|
|
401
410
|
*/
|
|
402
411
|
async testRegistryWebhook(req, options) {
|
|
403
|
-
const
|
|
412
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
413
|
+
const url = `${host}/api/2.0/mlflow/registry-webhooks/test`;
|
|
404
414
|
const body = marshalRequest(req, marshalTestRegistryWebhookRequestSchema);
|
|
405
415
|
let resp;
|
|
406
416
|
const call = async (callSignal) => {
|
|
407
417
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
408
|
-
if (
|
|
409
|
-
headers.set('X-Databricks-Org-Id',
|
|
418
|
+
if (workspaceId !== undefined) {
|
|
419
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
410
420
|
}
|
|
411
421
|
headers.set('User-Agent', this.userAgent);
|
|
412
422
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
413
423
|
const respBody = await executeHttpCall({
|
|
414
424
|
request: httpReq,
|
|
415
|
-
httpClient
|
|
425
|
+
httpClient,
|
|
416
426
|
logger: this.logger,
|
|
417
427
|
});
|
|
418
428
|
resp = parseResponse(respBody, unmarshalTestRegistryWebhookResponseSchema);
|
|
@@ -429,19 +439,20 @@ export class ModelRegistryClient {
|
|
|
429
439
|
* that also accepts a comment associated with the transition to be recorded.
|
|
430
440
|
*/
|
|
431
441
|
async transitionModelVersionStageDatabricks(req, options) {
|
|
432
|
-
const
|
|
442
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
443
|
+
const url = `${host}/api/2.0/mlflow/databricks/model-versions/transition-stage`;
|
|
433
444
|
const body = marshalRequest(req, marshalTransitionModelVersionStageDatabricksRequestSchema);
|
|
434
445
|
let resp;
|
|
435
446
|
const call = async (callSignal) => {
|
|
436
447
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
437
|
-
if (
|
|
438
|
-
headers.set('X-Databricks-Org-Id',
|
|
448
|
+
if (workspaceId !== undefined) {
|
|
449
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
439
450
|
}
|
|
440
451
|
headers.set('User-Agent', this.userAgent);
|
|
441
452
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
442
453
|
const respBody = await executeHttpCall({
|
|
443
454
|
request: httpReq,
|
|
444
|
-
httpClient
|
|
455
|
+
httpClient,
|
|
445
456
|
logger: this.logger,
|
|
446
457
|
});
|
|
447
458
|
resp = parseResponse(respBody, unmarshalTransitionModelVersionStageDatabricksResponseSchema);
|
|
@@ -454,19 +465,20 @@ export class ModelRegistryClient {
|
|
|
454
465
|
}
|
|
455
466
|
/** Post an edit to a comment on a model version. */
|
|
456
467
|
async updateComment(req, options) {
|
|
457
|
-
const
|
|
468
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
469
|
+
const url = `${host}/api/2.0/mlflow/comments/update`;
|
|
458
470
|
const body = marshalRequest(req, marshalUpdateCommentRequestSchema);
|
|
459
471
|
let resp;
|
|
460
472
|
const call = async (callSignal) => {
|
|
461
473
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
462
|
-
if (
|
|
463
|
-
headers.set('X-Databricks-Org-Id',
|
|
474
|
+
if (workspaceId !== undefined) {
|
|
475
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
464
476
|
}
|
|
465
477
|
headers.set('User-Agent', this.userAgent);
|
|
466
478
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
467
479
|
const respBody = await executeHttpCall({
|
|
468
480
|
request: httpReq,
|
|
469
|
-
httpClient
|
|
481
|
+
httpClient,
|
|
470
482
|
logger: this.logger,
|
|
471
483
|
});
|
|
472
484
|
resp = parseResponse(respBody, unmarshalUpdateCommentResponseSchema);
|
|
@@ -482,19 +494,20 @@ export class ModelRegistryClient {
|
|
|
482
494
|
* Updates a registry webhook.
|
|
483
495
|
*/
|
|
484
496
|
async updateRegistryWebhook(req, options) {
|
|
485
|
-
const
|
|
497
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
498
|
+
const url = `${host}/api/2.0/mlflow/registry-webhooks/update`;
|
|
486
499
|
const body = marshalRequest(req, marshalUpdateRegistryWebhookRequestSchema);
|
|
487
500
|
let resp;
|
|
488
501
|
const call = async (callSignal) => {
|
|
489
502
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
490
|
-
if (
|
|
491
|
-
headers.set('X-Databricks-Org-Id',
|
|
503
|
+
if (workspaceId !== undefined) {
|
|
504
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
492
505
|
}
|
|
493
506
|
headers.set('User-Agent', this.userAgent);
|
|
494
507
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
495
508
|
const respBody = await executeHttpCall({
|
|
496
509
|
request: httpReq,
|
|
497
|
-
httpClient
|
|
510
|
+
httpClient,
|
|
498
511
|
logger: this.logger,
|
|
499
512
|
});
|
|
500
513
|
resp = parseResponse(respBody, unmarshalUpdateRegistryWebhookResponseSchema);
|
|
@@ -507,19 +520,20 @@ export class ModelRegistryClient {
|
|
|
507
520
|
}
|
|
508
521
|
/** Creates a model version. */
|
|
509
522
|
async createModelVersion(req, options) {
|
|
510
|
-
const
|
|
523
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
524
|
+
const url = `${host}/api/2.0/mlflow/model-versions/create`;
|
|
511
525
|
const body = marshalRequest(req, marshalCreateModelVersionRequestSchema);
|
|
512
526
|
let resp;
|
|
513
527
|
const call = async (callSignal) => {
|
|
514
528
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
515
|
-
if (
|
|
516
|
-
headers.set('X-Databricks-Org-Id',
|
|
529
|
+
if (workspaceId !== undefined) {
|
|
530
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
517
531
|
}
|
|
518
532
|
headers.set('User-Agent', this.userAgent);
|
|
519
533
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
520
534
|
const respBody = await executeHttpCall({
|
|
521
535
|
request: httpReq,
|
|
522
|
-
httpClient
|
|
536
|
+
httpClient,
|
|
523
537
|
logger: this.logger,
|
|
524
538
|
});
|
|
525
539
|
resp = parseResponse(respBody, unmarshalCreateModelVersionResponseSchema);
|
|
@@ -535,19 +549,20 @@ export class ModelRegistryClient {
|
|
|
535
549
|
* Throws `RESOURCE_ALREADY_EXISTS` if a registered model with the given name exists.
|
|
536
550
|
*/
|
|
537
551
|
async createRegisteredModel(req, options) {
|
|
538
|
-
const
|
|
552
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
553
|
+
const url = `${host}/api/2.0/mlflow/registered-models/create`;
|
|
539
554
|
const body = marshalRequest(req, marshalCreateRegisteredModelRequestSchema);
|
|
540
555
|
let resp;
|
|
541
556
|
const call = async (callSignal) => {
|
|
542
557
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
543
|
-
if (
|
|
544
|
-
headers.set('X-Databricks-Org-Id',
|
|
558
|
+
if (workspaceId !== undefined) {
|
|
559
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
545
560
|
}
|
|
546
561
|
headers.set('User-Agent', this.userAgent);
|
|
547
562
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
548
563
|
const respBody = await executeHttpCall({
|
|
549
564
|
request: httpReq,
|
|
550
|
-
httpClient
|
|
565
|
+
httpClient,
|
|
551
566
|
logger: this.logger,
|
|
552
567
|
});
|
|
553
568
|
resp = parseResponse(respBody, unmarshalCreateRegisteredModelResponseSchema);
|
|
@@ -560,7 +575,8 @@ export class ModelRegistryClient {
|
|
|
560
575
|
}
|
|
561
576
|
/** Deletes a model version. */
|
|
562
577
|
async deleteModelVersion(req, options) {
|
|
563
|
-
const
|
|
578
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
579
|
+
const url = `${host}/api/2.0/mlflow/model-versions/delete`;
|
|
564
580
|
const params = new URLSearchParams();
|
|
565
581
|
if (req.name !== undefined) {
|
|
566
582
|
params.append('name', req.name);
|
|
@@ -573,14 +589,14 @@ export class ModelRegistryClient {
|
|
|
573
589
|
let resp;
|
|
574
590
|
const call = async (callSignal) => {
|
|
575
591
|
const headers = new Headers();
|
|
576
|
-
if (
|
|
577
|
-
headers.set('X-Databricks-Org-Id',
|
|
592
|
+
if (workspaceId !== undefined) {
|
|
593
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
578
594
|
}
|
|
579
595
|
headers.set('User-Agent', this.userAgent);
|
|
580
596
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
581
597
|
const respBody = await executeHttpCall({
|
|
582
598
|
request: httpReq,
|
|
583
|
-
httpClient
|
|
599
|
+
httpClient,
|
|
584
600
|
logger: this.logger,
|
|
585
601
|
});
|
|
586
602
|
resp = parseResponse(respBody, unmarshalDeleteModelVersionResponseSchema);
|
|
@@ -593,7 +609,8 @@ export class ModelRegistryClient {
|
|
|
593
609
|
}
|
|
594
610
|
/** Deletes a model version tag. */
|
|
595
611
|
async deleteModelVersionTag(req, options) {
|
|
596
|
-
const
|
|
612
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
613
|
+
const url = `${host}/api/2.0/mlflow/model-versions/delete-tag`;
|
|
597
614
|
const params = new URLSearchParams();
|
|
598
615
|
if (req.name !== undefined) {
|
|
599
616
|
params.append('name', req.name);
|
|
@@ -609,14 +626,14 @@ export class ModelRegistryClient {
|
|
|
609
626
|
let resp;
|
|
610
627
|
const call = async (callSignal) => {
|
|
611
628
|
const headers = new Headers();
|
|
612
|
-
if (
|
|
613
|
-
headers.set('X-Databricks-Org-Id',
|
|
629
|
+
if (workspaceId !== undefined) {
|
|
630
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
614
631
|
}
|
|
615
632
|
headers.set('User-Agent', this.userAgent);
|
|
616
633
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
617
634
|
const respBody = await executeHttpCall({
|
|
618
635
|
request: httpReq,
|
|
619
|
-
httpClient
|
|
636
|
+
httpClient,
|
|
620
637
|
logger: this.logger,
|
|
621
638
|
});
|
|
622
639
|
resp = parseResponse(respBody, unmarshalDeleteModelVersionTagResponseSchema);
|
|
@@ -629,7 +646,8 @@ export class ModelRegistryClient {
|
|
|
629
646
|
}
|
|
630
647
|
/** Deletes a registered model. */
|
|
631
648
|
async deleteRegisteredModel(req, options) {
|
|
632
|
-
const
|
|
649
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
650
|
+
const url = `${host}/api/2.0/mlflow/registered-models/delete`;
|
|
633
651
|
const params = new URLSearchParams();
|
|
634
652
|
if (req.name !== undefined) {
|
|
635
653
|
params.append('name', req.name);
|
|
@@ -639,14 +657,14 @@ export class ModelRegistryClient {
|
|
|
639
657
|
let resp;
|
|
640
658
|
const call = async (callSignal) => {
|
|
641
659
|
const headers = new Headers();
|
|
642
|
-
if (
|
|
643
|
-
headers.set('X-Databricks-Org-Id',
|
|
660
|
+
if (workspaceId !== undefined) {
|
|
661
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
644
662
|
}
|
|
645
663
|
headers.set('User-Agent', this.userAgent);
|
|
646
664
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
647
665
|
const respBody = await executeHttpCall({
|
|
648
666
|
request: httpReq,
|
|
649
|
-
httpClient
|
|
667
|
+
httpClient,
|
|
650
668
|
logger: this.logger,
|
|
651
669
|
});
|
|
652
670
|
resp = parseResponse(respBody, unmarshalDeleteRegisteredModelResponseSchema);
|
|
@@ -659,7 +677,8 @@ export class ModelRegistryClient {
|
|
|
659
677
|
}
|
|
660
678
|
/** Deletes the tag for a registered model. */
|
|
661
679
|
async deleteRegisteredModelTag(req, options) {
|
|
662
|
-
const
|
|
680
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
681
|
+
const url = `${host}/api/2.0/mlflow/registered-models/delete-tag`;
|
|
663
682
|
const params = new URLSearchParams();
|
|
664
683
|
if (req.name !== undefined) {
|
|
665
684
|
params.append('name', req.name);
|
|
@@ -672,14 +691,14 @@ export class ModelRegistryClient {
|
|
|
672
691
|
let resp;
|
|
673
692
|
const call = async (callSignal) => {
|
|
674
693
|
const headers = new Headers();
|
|
675
|
-
if (
|
|
676
|
-
headers.set('X-Databricks-Org-Id',
|
|
694
|
+
if (workspaceId !== undefined) {
|
|
695
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
677
696
|
}
|
|
678
697
|
headers.set('User-Agent', this.userAgent);
|
|
679
698
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
680
699
|
const respBody = await executeHttpCall({
|
|
681
700
|
request: httpReq,
|
|
682
|
-
httpClient
|
|
701
|
+
httpClient,
|
|
683
702
|
logger: this.logger,
|
|
684
703
|
});
|
|
685
704
|
resp = parseResponse(respBody, unmarshalDeleteRegisteredModelTagResponseSchema);
|
|
@@ -692,7 +711,8 @@ export class ModelRegistryClient {
|
|
|
692
711
|
}
|
|
693
712
|
/** Get a model version. */
|
|
694
713
|
async getModelVersion(req, options) {
|
|
695
|
-
const
|
|
714
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
715
|
+
const url = `${host}/api/2.0/mlflow/model-versions/get`;
|
|
696
716
|
const params = new URLSearchParams();
|
|
697
717
|
if (req.name !== undefined) {
|
|
698
718
|
params.append('name', req.name);
|
|
@@ -705,14 +725,14 @@ export class ModelRegistryClient {
|
|
|
705
725
|
let resp;
|
|
706
726
|
const call = async (callSignal) => {
|
|
707
727
|
const headers = new Headers();
|
|
708
|
-
if (
|
|
709
|
-
headers.set('X-Databricks-Org-Id',
|
|
728
|
+
if (workspaceId !== undefined) {
|
|
729
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
710
730
|
}
|
|
711
731
|
headers.set('User-Agent', this.userAgent);
|
|
712
732
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
713
733
|
const respBody = await executeHttpCall({
|
|
714
734
|
request: httpReq,
|
|
715
|
-
httpClient
|
|
735
|
+
httpClient,
|
|
716
736
|
logger: this.logger,
|
|
717
737
|
});
|
|
718
738
|
resp = parseResponse(respBody, unmarshalGetModelVersionResponseSchema);
|
|
@@ -725,7 +745,8 @@ export class ModelRegistryClient {
|
|
|
725
745
|
}
|
|
726
746
|
/** Gets a URI to download the model version. */
|
|
727
747
|
async getModelVersionDownloadUri(req, options) {
|
|
728
|
-
const
|
|
748
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
749
|
+
const url = `${host}/api/2.0/mlflow/model-versions/get-download-uri`;
|
|
729
750
|
const params = new URLSearchParams();
|
|
730
751
|
if (req.name !== undefined) {
|
|
731
752
|
params.append('name', req.name);
|
|
@@ -738,14 +759,14 @@ export class ModelRegistryClient {
|
|
|
738
759
|
let resp;
|
|
739
760
|
const call = async (callSignal) => {
|
|
740
761
|
const headers = new Headers();
|
|
741
|
-
if (
|
|
742
|
-
headers.set('X-Databricks-Org-Id',
|
|
762
|
+
if (workspaceId !== undefined) {
|
|
763
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
743
764
|
}
|
|
744
765
|
headers.set('User-Agent', this.userAgent);
|
|
745
766
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
746
767
|
const respBody = await executeHttpCall({
|
|
747
768
|
request: httpReq,
|
|
748
|
-
httpClient
|
|
769
|
+
httpClient,
|
|
749
770
|
logger: this.logger,
|
|
750
771
|
});
|
|
751
772
|
resp = parseResponse(respBody, unmarshalGetModelVersionDownloadUriResponseSchema);
|
|
@@ -758,19 +779,20 @@ export class ModelRegistryClient {
|
|
|
758
779
|
}
|
|
759
780
|
/** Gets the latest version of a registered model. */
|
|
760
781
|
async listLatestVersions(req, options) {
|
|
761
|
-
const
|
|
782
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
783
|
+
const url = `${host}/api/2.0/mlflow/registered-models/get-latest-versions`;
|
|
762
784
|
const body = marshalRequest(req, marshalListLatestVersionsRequestSchema);
|
|
763
785
|
let resp;
|
|
764
786
|
const call = async (callSignal) => {
|
|
765
787
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
766
|
-
if (
|
|
767
|
-
headers.set('X-Databricks-Org-Id',
|
|
788
|
+
if (workspaceId !== undefined) {
|
|
789
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
768
790
|
}
|
|
769
791
|
headers.set('User-Agent', this.userAgent);
|
|
770
792
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
771
793
|
const respBody = await executeHttpCall({
|
|
772
794
|
request: httpReq,
|
|
773
|
-
httpClient
|
|
795
|
+
httpClient,
|
|
774
796
|
logger: this.logger,
|
|
775
797
|
});
|
|
776
798
|
resp = parseResponse(respBody, unmarshalGetLatestVersionsResponseSchema);
|
|
@@ -783,7 +805,8 @@ export class ModelRegistryClient {
|
|
|
783
805
|
}
|
|
784
806
|
/** Lists all available registered models, up to the limit specified in __max_results__. */
|
|
785
807
|
async listRegisteredModels(req, options) {
|
|
786
|
-
const
|
|
808
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
809
|
+
const url = `${host}/api/2.0/mlflow/registered-models/list`;
|
|
787
810
|
const params = new URLSearchParams();
|
|
788
811
|
if (req.maxResults !== undefined) {
|
|
789
812
|
params.append('max_results', String(req.maxResults));
|
|
@@ -796,14 +819,14 @@ export class ModelRegistryClient {
|
|
|
796
819
|
let resp;
|
|
797
820
|
const call = async (callSignal) => {
|
|
798
821
|
const headers = new Headers();
|
|
799
|
-
if (
|
|
800
|
-
headers.set('X-Databricks-Org-Id',
|
|
822
|
+
if (workspaceId !== undefined) {
|
|
823
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
801
824
|
}
|
|
802
825
|
headers.set('User-Agent', this.userAgent);
|
|
803
826
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
804
827
|
const respBody = await executeHttpCall({
|
|
805
828
|
request: httpReq,
|
|
806
|
-
httpClient
|
|
829
|
+
httpClient,
|
|
807
830
|
logger: this.logger,
|
|
808
831
|
});
|
|
809
832
|
resp = parseResponse(respBody, unmarshalListRegisteredModelsResponseSchema);
|
|
@@ -829,19 +852,20 @@ export class ModelRegistryClient {
|
|
|
829
852
|
}
|
|
830
853
|
/** Renames a registered model. */
|
|
831
854
|
async renameRegisteredModel(req, options) {
|
|
832
|
-
const
|
|
855
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
856
|
+
const url = `${host}/api/2.0/mlflow/registered-models/rename`;
|
|
833
857
|
const body = marshalRequest(req, marshalRenameRegisteredModelRequestSchema);
|
|
834
858
|
let resp;
|
|
835
859
|
const call = async (callSignal) => {
|
|
836
860
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
837
|
-
if (
|
|
838
|
-
headers.set('X-Databricks-Org-Id',
|
|
861
|
+
if (workspaceId !== undefined) {
|
|
862
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
839
863
|
}
|
|
840
864
|
headers.set('User-Agent', this.userAgent);
|
|
841
865
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
842
866
|
const respBody = await executeHttpCall({
|
|
843
867
|
request: httpReq,
|
|
844
|
-
httpClient
|
|
868
|
+
httpClient,
|
|
845
869
|
logger: this.logger,
|
|
846
870
|
});
|
|
847
871
|
resp = parseResponse(respBody, unmarshalRenameRegisteredModelResponseSchema);
|
|
@@ -854,7 +878,8 @@ export class ModelRegistryClient {
|
|
|
854
878
|
}
|
|
855
879
|
/** Searches for specific model versions based on the supplied __filter__. */
|
|
856
880
|
async searchModelVersions(req, options) {
|
|
857
|
-
const
|
|
881
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
882
|
+
const url = `${host}/api/2.0/mlflow/model-versions/search`;
|
|
858
883
|
const params = new URLSearchParams();
|
|
859
884
|
if (req.filter !== undefined) {
|
|
860
885
|
params.append('filter', req.filter);
|
|
@@ -873,14 +898,14 @@ export class ModelRegistryClient {
|
|
|
873
898
|
let resp;
|
|
874
899
|
const call = async (callSignal) => {
|
|
875
900
|
const headers = new Headers();
|
|
876
|
-
if (
|
|
877
|
-
headers.set('X-Databricks-Org-Id',
|
|
901
|
+
if (workspaceId !== undefined) {
|
|
902
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
878
903
|
}
|
|
879
904
|
headers.set('User-Agent', this.userAgent);
|
|
880
905
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
881
906
|
const respBody = await executeHttpCall({
|
|
882
907
|
request: httpReq,
|
|
883
|
-
httpClient
|
|
908
|
+
httpClient,
|
|
884
909
|
logger: this.logger,
|
|
885
910
|
});
|
|
886
911
|
resp = parseResponse(respBody, unmarshalSearchModelVersionsResponseSchema);
|
|
@@ -906,7 +931,8 @@ export class ModelRegistryClient {
|
|
|
906
931
|
}
|
|
907
932
|
/** Search for registered models based on the specified __filter__. */
|
|
908
933
|
async searchRegisteredModels(req, options) {
|
|
909
|
-
const
|
|
934
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
935
|
+
const url = `${host}/api/2.0/mlflow/registered-models/search`;
|
|
910
936
|
const params = new URLSearchParams();
|
|
911
937
|
if (req.filter !== undefined) {
|
|
912
938
|
params.append('filter', req.filter);
|
|
@@ -925,14 +951,14 @@ export class ModelRegistryClient {
|
|
|
925
951
|
let resp;
|
|
926
952
|
const call = async (callSignal) => {
|
|
927
953
|
const headers = new Headers();
|
|
928
|
-
if (
|
|
929
|
-
headers.set('X-Databricks-Org-Id',
|
|
954
|
+
if (workspaceId !== undefined) {
|
|
955
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
930
956
|
}
|
|
931
957
|
headers.set('User-Agent', this.userAgent);
|
|
932
958
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
933
959
|
const respBody = await executeHttpCall({
|
|
934
960
|
request: httpReq,
|
|
935
|
-
httpClient
|
|
961
|
+
httpClient,
|
|
936
962
|
logger: this.logger,
|
|
937
963
|
});
|
|
938
964
|
resp = parseResponse(respBody, unmarshalSearchRegisteredModelsResponseSchema);
|
|
@@ -958,19 +984,20 @@ export class ModelRegistryClient {
|
|
|
958
984
|
}
|
|
959
985
|
/** Sets a model version tag. */
|
|
960
986
|
async setModelVersionTag(req, options) {
|
|
961
|
-
const
|
|
987
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
988
|
+
const url = `${host}/api/2.0/mlflow/model-versions/set-tag`;
|
|
962
989
|
const body = marshalRequest(req, marshalSetModelVersionTagRequestSchema);
|
|
963
990
|
let resp;
|
|
964
991
|
const call = async (callSignal) => {
|
|
965
992
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
966
|
-
if (
|
|
967
|
-
headers.set('X-Databricks-Org-Id',
|
|
993
|
+
if (workspaceId !== undefined) {
|
|
994
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
968
995
|
}
|
|
969
996
|
headers.set('User-Agent', this.userAgent);
|
|
970
997
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
971
998
|
const respBody = await executeHttpCall({
|
|
972
999
|
request: httpReq,
|
|
973
|
-
httpClient
|
|
1000
|
+
httpClient,
|
|
974
1001
|
logger: this.logger,
|
|
975
1002
|
});
|
|
976
1003
|
resp = parseResponse(respBody, unmarshalSetModelVersionTagResponseSchema);
|
|
@@ -983,19 +1010,20 @@ export class ModelRegistryClient {
|
|
|
983
1010
|
}
|
|
984
1011
|
/** Sets a tag on a registered model. */
|
|
985
1012
|
async setRegisteredModelTag(req, options) {
|
|
986
|
-
const
|
|
1013
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1014
|
+
const url = `${host}/api/2.0/mlflow/registered-models/set-tag`;
|
|
987
1015
|
const body = marshalRequest(req, marshalSetRegisteredModelTagRequestSchema);
|
|
988
1016
|
let resp;
|
|
989
1017
|
const call = async (callSignal) => {
|
|
990
1018
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
991
|
-
if (
|
|
992
|
-
headers.set('X-Databricks-Org-Id',
|
|
1019
|
+
if (workspaceId !== undefined) {
|
|
1020
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
993
1021
|
}
|
|
994
1022
|
headers.set('User-Agent', this.userAgent);
|
|
995
1023
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
996
1024
|
const respBody = await executeHttpCall({
|
|
997
1025
|
request: httpReq,
|
|
998
|
-
httpClient
|
|
1026
|
+
httpClient,
|
|
999
1027
|
logger: this.logger,
|
|
1000
1028
|
});
|
|
1001
1029
|
resp = parseResponse(respBody, unmarshalSetRegisteredModelTagResponseSchema);
|
|
@@ -1008,19 +1036,20 @@ export class ModelRegistryClient {
|
|
|
1008
1036
|
}
|
|
1009
1037
|
/** Updates the model version. */
|
|
1010
1038
|
async updateModelVersion(req, options) {
|
|
1011
|
-
const
|
|
1039
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1040
|
+
const url = `${host}/api/2.0/mlflow/model-versions/update`;
|
|
1012
1041
|
const body = marshalRequest(req, marshalUpdateModelVersionRequestSchema);
|
|
1013
1042
|
let resp;
|
|
1014
1043
|
const call = async (callSignal) => {
|
|
1015
1044
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1016
|
-
if (
|
|
1017
|
-
headers.set('X-Databricks-Org-Id',
|
|
1045
|
+
if (workspaceId !== undefined) {
|
|
1046
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1018
1047
|
}
|
|
1019
1048
|
headers.set('User-Agent', this.userAgent);
|
|
1020
1049
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1021
1050
|
const respBody = await executeHttpCall({
|
|
1022
1051
|
request: httpReq,
|
|
1023
|
-
httpClient
|
|
1052
|
+
httpClient,
|
|
1024
1053
|
logger: this.logger,
|
|
1025
1054
|
});
|
|
1026
1055
|
resp = parseResponse(respBody, unmarshalUpdateModelVersionResponseSchema);
|
|
@@ -1033,19 +1062,20 @@ export class ModelRegistryClient {
|
|
|
1033
1062
|
}
|
|
1034
1063
|
/** Updates a registered model. */
|
|
1035
1064
|
async updateRegisteredModel(req, options) {
|
|
1036
|
-
const
|
|
1065
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
1066
|
+
const url = `${host}/api/2.0/mlflow/registered-models/update`;
|
|
1037
1067
|
const body = marshalRequest(req, marshalUpdateRegisteredModelRequestSchema);
|
|
1038
1068
|
let resp;
|
|
1039
1069
|
const call = async (callSignal) => {
|
|
1040
1070
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
1041
|
-
if (
|
|
1042
|
-
headers.set('X-Databricks-Org-Id',
|
|
1071
|
+
if (workspaceId !== undefined) {
|
|
1072
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
1043
1073
|
}
|
|
1044
1074
|
headers.set('User-Agent', this.userAgent);
|
|
1045
1075
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
1046
1076
|
const respBody = await executeHttpCall({
|
|
1047
1077
|
request: httpReq,
|
|
1048
|
-
httpClient
|
|
1078
|
+
httpClient,
|
|
1049
1079
|
logger: this.logger,
|
|
1050
1080
|
});
|
|
1051
1081
|
resp = parseResponse(respBody, unmarshalUpdateRegisteredModelResponseSchema);
|