@databricks/sdk-jobs 0.1.0-dev.2 → 0.1.0-dev.4

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/src/v2/client.ts DELETED
@@ -1,1258 +0,0 @@
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 {createDefault} from '@databricks/sdk-core/clientinfo';
5
- import type {Logger} from '@databricks/sdk-core/logger';
6
- import {NoOpLogger} from '@databricks/sdk-core/logger';
7
- import type {CallOptions} from '@databricks/sdk-options/call';
8
- import type {ClientOptions} from '@databricks/sdk-options/client';
9
- import type {LroOptions} from '@databricks/sdk-options/lro';
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
- executeWait,
19
- StillRunningError,
20
- } from './utils';
21
- import pkgJson from '../../package.json' with {type: 'json'};
22
- import type {
23
- BaseJob,
24
- BaseRun,
25
- CancelAllRunsRequest,
26
- CancelAllRunsRequest_Response,
27
- CancelRunRequest,
28
- CancelRunRequest_Response,
29
- CreateJobRequest,
30
- CreateJobRequest_Response,
31
- DeleteJobRequest,
32
- DeleteJobRequest_Response,
33
- DeleteRunRequest,
34
- DeleteRunRequest_Response,
35
- EnforcePolicyComplianceForJob,
36
- EnforcePolicyComplianceForJob_Response,
37
- ExportRunRequest,
38
- ExportRunRequest_Response,
39
- GetJobRequest,
40
- GetJobRequest_Response,
41
- GetPolicyComplianceForJob,
42
- GetPolicyComplianceForJob_Response,
43
- GetRunOutputRequest,
44
- GetRunOutputRequest_Response,
45
- GetRunRequest,
46
- GetRunRequest_Response,
47
- ListJobComplianceForPolicy,
48
- ListJobComplianceForPolicy_JobCompliance,
49
- ListJobComplianceForPolicy_Response,
50
- ListJobsRequest,
51
- ListJobsRequest_Response,
52
- ListRunsRequest,
53
- ListRunsRequest_Response,
54
- RepairRunRequest,
55
- RepairRunRequest_Response,
56
- ResetJobRequest,
57
- ResetJobRequest_Response,
58
- RunNowRequest,
59
- RunNowRequest_Response,
60
- SubmitRunRequest,
61
- SubmitRunRequest_Response,
62
- UpdateJobRequest,
63
- UpdateJobRequest_Response,
64
- } from './model';
65
- import {
66
- RunLifeCycleState_RunLifeCycleState,
67
- marshalCancelAllRunsRequestSchema,
68
- marshalCancelRunRequestSchema,
69
- marshalCreateJobRequestSchema,
70
- marshalDeleteJobRequestSchema,
71
- marshalDeleteRunRequestSchema,
72
- marshalEnforcePolicyComplianceForJobSchema,
73
- marshalRepairRunRequestSchema,
74
- marshalResetJobRequestSchema,
75
- marshalRunNowRequestSchema,
76
- marshalSubmitRunRequestSchema,
77
- marshalUpdateJobRequestSchema,
78
- unmarshalCancelAllRunsRequest_ResponseSchema,
79
- unmarshalCancelRunRequest_ResponseSchema,
80
- unmarshalCreateJobRequest_ResponseSchema,
81
- unmarshalDeleteJobRequest_ResponseSchema,
82
- unmarshalDeleteRunRequest_ResponseSchema,
83
- unmarshalEnforcePolicyComplianceForJob_ResponseSchema,
84
- unmarshalExportRunRequest_ResponseSchema,
85
- unmarshalGetJobRequest_ResponseSchema,
86
- unmarshalGetPolicyComplianceForJob_ResponseSchema,
87
- unmarshalGetRunOutputRequest_ResponseSchema,
88
- unmarshalGetRunRequest_ResponseSchema,
89
- unmarshalListJobComplianceForPolicy_ResponseSchema,
90
- unmarshalListJobsRequest_ResponseSchema,
91
- unmarshalListRunsRequest_ResponseSchema,
92
- unmarshalRepairRunRequest_ResponseSchema,
93
- unmarshalResetJobRequest_ResponseSchema,
94
- unmarshalRunNowRequest_ResponseSchema,
95
- unmarshalSubmitRunRequest_ResponseSchema,
96
- unmarshalUpdateJobRequest_ResponseSchema,
97
- } from './model';
98
-
99
- // Package identity segment for this client to be used in the User-Agent header.
100
- const PACKAGE_SEGMENT = {
101
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
102
- value: pkgJson.version,
103
- };
104
-
105
- export class JobsClient {
106
- private readonly host: string;
107
- // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
108
- // When set, workspace-level methods send X-Databricks-Org-Id on every
109
- // request.
110
- private readonly workspaceId: string | undefined;
111
- private readonly httpClient: HttpClient;
112
- private readonly logger: Logger;
113
- // User-Agent header value. Composed once at construction from
114
- // createDefault() merged with this package's identity and the active
115
- // credential's name.
116
- private readonly userAgent: string;
117
-
118
- constructor(options: ClientOptions) {
119
- if (options.host === undefined) {
120
- throw new Error('Host is required.');
121
- }
122
- this.host = options.host.replace(/\/$/, '');
123
- this.workspaceId = options.workspaceId;
124
- this.logger = options.logger ?? new NoOpLogger();
125
- const info = createDefault()
126
- .with(PACKAGE_SEGMENT)
127
- .with({key: 'sdk-js-auth', value: AUTH_VERSION})
128
- .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
129
- this.userAgent = info.toString();
130
- this.httpClient = newHttpClient(options);
131
- }
132
-
133
- /**
134
- * Updates a job so the job clusters that are created when running
135
- * the job (specified in `new_cluster`) are compliant with the
136
- * current versions of their respective cluster policies.
137
- * All-purpose clusters used in the job will not be updated.
138
- */
139
- async enforcePolicyComplianceForJob(
140
- req: EnforcePolicyComplianceForJob,
141
- options?: CallOptions
142
- ): Promise<EnforcePolicyComplianceForJob_Response> {
143
- const url = `${this.host}/api/2.0/policies/jobs/enforce-compliance`;
144
- const body = marshalRequest(
145
- req,
146
- marshalEnforcePolicyComplianceForJobSchema
147
- );
148
- let resp: EnforcePolicyComplianceForJob_Response | undefined;
149
- const call = async (callSignal?: AbortSignal): Promise<void> => {
150
- const headers = new Headers({'Content-Type': 'application/json'});
151
- if (this.workspaceId !== undefined) {
152
- headers.set('X-Databricks-Org-Id', this.workspaceId);
153
- }
154
- headers.set('User-Agent', this.userAgent);
155
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
156
- const respBody = await executeHttpCall({
157
- request: httpReq,
158
- httpClient: this.httpClient,
159
- logger: this.logger,
160
- });
161
- resp = parseResponse(
162
- respBody,
163
- unmarshalEnforcePolicyComplianceForJob_ResponseSchema
164
- );
165
- };
166
- await executeCall(call, options);
167
- if (resp === undefined) {
168
- throw new Error('operation completed without a result.');
169
- }
170
- return resp;
171
- }
172
-
173
- /**
174
- * Returns the policy compliance status of a job. Jobs could be out of
175
- * compliance if a cluster policy they use was updated after the job was
176
- * last edited and some of its job clusters no longer comply with
177
- * their updated policies.
178
- */
179
- async getPolicyComplianceForJob(
180
- req: GetPolicyComplianceForJob,
181
- options?: CallOptions
182
- ): Promise<GetPolicyComplianceForJob_Response> {
183
- const url = `${this.host}/api/2.0/policies/jobs/get-compliance`;
184
- const params = new URLSearchParams();
185
- if (req.jobId !== undefined) {
186
- params.append('job_id', String(req.jobId));
187
- }
188
- const query = params.toString();
189
- const fullUrl = query !== '' ? `${url}?${query}` : url;
190
- let resp: GetPolicyComplianceForJob_Response | undefined;
191
- const call = async (callSignal?: AbortSignal): Promise<void> => {
192
- const headers = new Headers();
193
- if (this.workspaceId !== undefined) {
194
- headers.set('X-Databricks-Org-Id', this.workspaceId);
195
- }
196
- headers.set('User-Agent', this.userAgent);
197
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
198
- const respBody = await executeHttpCall({
199
- request: httpReq,
200
- httpClient: this.httpClient,
201
- logger: this.logger,
202
- });
203
- resp = parseResponse(
204
- respBody,
205
- unmarshalGetPolicyComplianceForJob_ResponseSchema
206
- );
207
- };
208
- await executeCall(call, options);
209
- if (resp === undefined) {
210
- throw new Error('operation completed without a result.');
211
- }
212
- return resp;
213
- }
214
-
215
- /**
216
- * Returns the policy compliance status of all jobs that use a
217
- * given policy. Jobs could be out of compliance if a cluster policy they
218
- * use was updated after the job was last edited and its job
219
- * clusters no longer comply with the updated policy.
220
- */
221
- async listJobComplianceForPolicy(
222
- req: ListJobComplianceForPolicy,
223
- options?: CallOptions
224
- ): Promise<ListJobComplianceForPolicy_Response> {
225
- const url = `${this.host}/api/2.0/policies/jobs/list-compliance`;
226
- const params = new URLSearchParams();
227
- if (req.policyId !== undefined) {
228
- params.append('policy_id', req.policyId);
229
- }
230
- if (req.pageToken !== undefined) {
231
- params.append('page_token', req.pageToken);
232
- }
233
- if (req.pageSize !== undefined) {
234
- params.append('page_size', String(req.pageSize));
235
- }
236
- const query = params.toString();
237
- const fullUrl = query !== '' ? `${url}?${query}` : url;
238
- let resp: ListJobComplianceForPolicy_Response | undefined;
239
- const call = async (callSignal?: AbortSignal): Promise<void> => {
240
- const headers = new Headers();
241
- if (this.workspaceId !== undefined) {
242
- headers.set('X-Databricks-Org-Id', this.workspaceId);
243
- }
244
- headers.set('User-Agent', this.userAgent);
245
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
246
- const respBody = await executeHttpCall({
247
- request: httpReq,
248
- httpClient: this.httpClient,
249
- logger: this.logger,
250
- });
251
- resp = parseResponse(
252
- respBody,
253
- unmarshalListJobComplianceForPolicy_ResponseSchema
254
- );
255
- };
256
- await executeCall(call, options);
257
- if (resp === undefined) {
258
- throw new Error('operation completed without a result.');
259
- }
260
- return resp;
261
- }
262
-
263
- async *listJobComplianceForPolicyIter(
264
- req: ListJobComplianceForPolicy,
265
- options?: CallOptions
266
- ): AsyncGenerator<ListJobComplianceForPolicy_JobCompliance> {
267
- const pageReq: ListJobComplianceForPolicy = {...req};
268
- for (;;) {
269
- const resp = await this.listJobComplianceForPolicy(pageReq, options);
270
- for (const item of resp.jobs ?? []) {
271
- yield item;
272
- }
273
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
274
- return;
275
- }
276
- pageReq.pageToken = resp.nextPageToken;
277
- }
278
- }
279
-
280
- /**
281
- * Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't
282
- * prevent new runs from being started.
283
- */
284
- async cancelAllRuns(
285
- req: CancelAllRunsRequest,
286
- options?: CallOptions
287
- ): Promise<CancelAllRunsRequest_Response> {
288
- const url = `${this.host}/api/2.2/jobs/runs/cancel-all`;
289
- const body = marshalRequest(req, marshalCancelAllRunsRequestSchema);
290
- let resp: CancelAllRunsRequest_Response | undefined;
291
- const call = async (callSignal?: AbortSignal): Promise<void> => {
292
- const headers = new Headers({'Content-Type': 'application/json'});
293
- if (this.workspaceId !== undefined) {
294
- headers.set('X-Databricks-Org-Id', this.workspaceId);
295
- }
296
- headers.set('User-Agent', this.userAgent);
297
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
298
- const respBody = await executeHttpCall({
299
- request: httpReq,
300
- httpClient: this.httpClient,
301
- logger: this.logger,
302
- });
303
- resp = parseResponse(
304
- respBody,
305
- unmarshalCancelAllRunsRequest_ResponseSchema
306
- );
307
- };
308
- await executeCall(call, options);
309
- if (resp === undefined) {
310
- throw new Error('operation completed without a result.');
311
- }
312
- return resp;
313
- }
314
-
315
- /**
316
- * Cancels a job run or a task run. The run is canceled asynchronously, so it may still be running when
317
- * this request completes.
318
- */
319
- private async cancelRun(
320
- req: CancelRunRequest,
321
- options?: CallOptions
322
- ): Promise<CancelRunRequest_Response> {
323
- const url = `${this.host}/api/2.2/jobs/runs/cancel`;
324
- const body = marshalRequest(req, marshalCancelRunRequestSchema);
325
- let resp: CancelRunRequest_Response | undefined;
326
- const call = async (callSignal?: AbortSignal): Promise<void> => {
327
- const headers = new Headers({'Content-Type': 'application/json'});
328
- if (this.workspaceId !== undefined) {
329
- headers.set('X-Databricks-Org-Id', this.workspaceId);
330
- }
331
- headers.set('User-Agent', this.userAgent);
332
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
333
- const respBody = await executeHttpCall({
334
- request: httpReq,
335
- httpClient: this.httpClient,
336
- logger: this.logger,
337
- });
338
- resp = parseResponse(respBody, unmarshalCancelRunRequest_ResponseSchema);
339
- };
340
- await executeCall(call, options);
341
- if (resp === undefined) {
342
- throw new Error('operation completed without a result.');
343
- }
344
- return resp;
345
- }
346
-
347
- async cancelRunWaiter(
348
- req: CancelRunRequest,
349
- options?: CallOptions
350
- ): Promise<CancelRunWaiter> {
351
- await this.cancelRun(req, options);
352
- if (req.runId === undefined) {
353
- throw new Error('request field runId required for polling is missing');
354
- }
355
- return new CancelRunWaiter(this, req.runId);
356
- }
357
-
358
- /** Create a new job. */
359
- async createJob(
360
- req: CreateJobRequest,
361
- options?: CallOptions
362
- ): Promise<CreateJobRequest_Response> {
363
- const url = `${this.host}/api/2.2/jobs/create`;
364
- const body = marshalRequest(req, marshalCreateJobRequestSchema);
365
- let resp: CreateJobRequest_Response | undefined;
366
- const call = async (callSignal?: AbortSignal): Promise<void> => {
367
- const headers = new Headers({'Content-Type': 'application/json'});
368
- if (this.workspaceId !== undefined) {
369
- headers.set('X-Databricks-Org-Id', this.workspaceId);
370
- }
371
- headers.set('User-Agent', this.userAgent);
372
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
373
- const respBody = await executeHttpCall({
374
- request: httpReq,
375
- httpClient: this.httpClient,
376
- logger: this.logger,
377
- });
378
- resp = parseResponse(respBody, unmarshalCreateJobRequest_ResponseSchema);
379
- };
380
- await executeCall(call, options);
381
- if (resp === undefined) {
382
- throw new Error('operation completed without a result.');
383
- }
384
- return resp;
385
- }
386
-
387
- /** Deletes a job. */
388
- async deleteJob(
389
- req: DeleteJobRequest,
390
- options?: CallOptions
391
- ): Promise<DeleteJobRequest_Response> {
392
- const url = `${this.host}/api/2.2/jobs/delete`;
393
- const body = marshalRequest(req, marshalDeleteJobRequestSchema);
394
- let resp: DeleteJobRequest_Response | undefined;
395
- const call = async (callSignal?: AbortSignal): Promise<void> => {
396
- const headers = new Headers({'Content-Type': 'application/json'});
397
- if (this.workspaceId !== undefined) {
398
- headers.set('X-Databricks-Org-Id', this.workspaceId);
399
- }
400
- headers.set('User-Agent', this.userAgent);
401
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
402
- const respBody = await executeHttpCall({
403
- request: httpReq,
404
- httpClient: this.httpClient,
405
- logger: this.logger,
406
- });
407
- resp = parseResponse(respBody, unmarshalDeleteJobRequest_ResponseSchema);
408
- };
409
- await executeCall(call, options);
410
- if (resp === undefined) {
411
- throw new Error('operation completed without a result.');
412
- }
413
- return resp;
414
- }
415
-
416
- /** Deletes a non-active run. Returns an error if the run is active. */
417
- async deleteRun(
418
- req: DeleteRunRequest,
419
- options?: CallOptions
420
- ): Promise<DeleteRunRequest_Response> {
421
- const url = `${this.host}/api/2.2/jobs/runs/delete`;
422
- const body = marshalRequest(req, marshalDeleteRunRequestSchema);
423
- let resp: DeleteRunRequest_Response | undefined;
424
- const call = async (callSignal?: AbortSignal): Promise<void> => {
425
- const headers = new Headers({'Content-Type': 'application/json'});
426
- if (this.workspaceId !== undefined) {
427
- headers.set('X-Databricks-Org-Id', this.workspaceId);
428
- }
429
- headers.set('User-Agent', this.userAgent);
430
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
431
- const respBody = await executeHttpCall({
432
- request: httpReq,
433
- httpClient: this.httpClient,
434
- logger: this.logger,
435
- });
436
- resp = parseResponse(respBody, unmarshalDeleteRunRequest_ResponseSchema);
437
- };
438
- await executeCall(call, options);
439
- if (resp === undefined) {
440
- throw new Error('operation completed without a result.');
441
- }
442
- return resp;
443
- }
444
-
445
- /** Export and retrieve the job run task. */
446
- async exportRun(
447
- req: ExportRunRequest,
448
- options?: CallOptions
449
- ): Promise<ExportRunRequest_Response> {
450
- const url = `${this.host}/api/2.2/jobs/runs/export`;
451
- const params = new URLSearchParams();
452
- if (req.runId !== undefined) {
453
- params.append('run_id', String(req.runId));
454
- }
455
- if (req.viewsToExport !== undefined) {
456
- params.append('views_to_export', req.viewsToExport);
457
- }
458
- const query = params.toString();
459
- const fullUrl = query !== '' ? `${url}?${query}` : url;
460
- let resp: ExportRunRequest_Response | undefined;
461
- const call = async (callSignal?: AbortSignal): Promise<void> => {
462
- const headers = new Headers();
463
- if (this.workspaceId !== undefined) {
464
- headers.set('X-Databricks-Org-Id', this.workspaceId);
465
- }
466
- headers.set('User-Agent', this.userAgent);
467
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
468
- const respBody = await executeHttpCall({
469
- request: httpReq,
470
- httpClient: this.httpClient,
471
- logger: this.logger,
472
- });
473
- resp = parseResponse(respBody, unmarshalExportRunRequest_ResponseSchema);
474
- };
475
- await executeCall(call, options);
476
- if (resp === undefined) {
477
- throw new Error('operation completed without a result.');
478
- }
479
- return resp;
480
- }
481
-
482
- /**
483
- * Retrieves the details for a single job.
484
- *
485
- * Large arrays in the results will be paginated when they exceed 100 elements.
486
- * A request for a single job will return all properties for that job, and the first 100 elements of array properties (`tasks`, `job_clusters`, `environments` and `parameters`).
487
- * Use the `next_page_token` field to check for more results and pass its value as the `page_token` in subsequent requests.
488
- * If any array properties have more than 100 elements, additional results will be returned on subsequent requests. Arrays without additional results will be empty on later pages.
489
- */
490
- async getJob(
491
- req: GetJobRequest,
492
- options?: CallOptions
493
- ): Promise<GetJobRequest_Response> {
494
- const url = `${this.host}/api/2.2/jobs/get`;
495
- const params = new URLSearchParams();
496
- if (req.jobId !== undefined) {
497
- params.append('job_id', String(req.jobId));
498
- }
499
- if (req.includeTriggerState !== undefined) {
500
- params.append('include_trigger_state', String(req.includeTriggerState));
501
- }
502
- if (req.pageToken !== undefined) {
503
- params.append('page_token', req.pageToken);
504
- }
505
- const query = params.toString();
506
- const fullUrl = query !== '' ? `${url}?${query}` : url;
507
- let resp: GetJobRequest_Response | undefined;
508
- const call = async (callSignal?: AbortSignal): Promise<void> => {
509
- const headers = new Headers();
510
- if (this.workspaceId !== undefined) {
511
- headers.set('X-Databricks-Org-Id', this.workspaceId);
512
- }
513
- headers.set('User-Agent', this.userAgent);
514
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
515
- const respBody = await executeHttpCall({
516
- request: httpReq,
517
- httpClient: this.httpClient,
518
- logger: this.logger,
519
- });
520
- resp = parseResponse(respBody, unmarshalGetJobRequest_ResponseSchema);
521
- };
522
- await executeCall(call, options);
523
- if (resp === undefined) {
524
- throw new Error('operation completed without a result.');
525
- }
526
- return resp;
527
- }
528
-
529
- /**
530
- * Retrieves the metadata of a run.
531
- *
532
- * Large arrays in the results will be paginated when they exceed 100 elements.
533
- * A request for a single run will return all properties for that run, and the first 100 elements of array properties (`tasks`, `job_clusters`, `job_parameters` and `repair_history`).
534
- * Use the next_page_token field to check for more results and pass its value as the page_token in subsequent requests.
535
- * If any array properties have more than 100 elements, additional results will be returned on subsequent requests. Arrays without additional results will be empty on later pages.
536
- */
537
- async getRun(
538
- req: GetRunRequest,
539
- options?: CallOptions
540
- ): Promise<GetRunRequest_Response> {
541
- const url = `${this.host}/api/2.2/jobs/runs/get`;
542
- const params = new URLSearchParams();
543
- if (req.runId !== undefined) {
544
- params.append('run_id', String(req.runId));
545
- }
546
- if (req.includeHistory !== undefined) {
547
- params.append('include_history', String(req.includeHistory));
548
- }
549
- if (req.includeResolvedValues !== undefined) {
550
- params.append(
551
- 'include_resolved_values',
552
- String(req.includeResolvedValues)
553
- );
554
- }
555
- if (req.pageToken !== undefined) {
556
- params.append('page_token', req.pageToken);
557
- }
558
- const query = params.toString();
559
- const fullUrl = query !== '' ? `${url}?${query}` : url;
560
- let resp: GetRunRequest_Response | undefined;
561
- const call = async (callSignal?: AbortSignal): Promise<void> => {
562
- const headers = new Headers();
563
- if (this.workspaceId !== undefined) {
564
- headers.set('X-Databricks-Org-Id', this.workspaceId);
565
- }
566
- headers.set('User-Agent', this.userAgent);
567
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
568
- const respBody = await executeHttpCall({
569
- request: httpReq,
570
- httpClient: this.httpClient,
571
- logger: this.logger,
572
- });
573
- resp = parseResponse(respBody, unmarshalGetRunRequest_ResponseSchema);
574
- };
575
- await executeCall(call, options);
576
- if (resp === undefined) {
577
- throw new Error('operation completed without a result.');
578
- }
579
- return resp;
580
- }
581
-
582
- /**
583
- * Retrieve the output and metadata of a single task run. When a notebook task returns
584
- * a value through the `dbutils.notebook.exit()` call, you can use this endpoint to retrieve
585
- * that value. <Databricks> restricts this API to returning the first 5 MB of the output.
586
- * To return a larger result, you can store job results in a cloud storage service.
587
- *
588
- * This endpoint validates that the __run_id__ parameter is valid and returns an HTTP status
589
- * code 400 if the __run_id__ parameter is invalid. Runs are automatically removed after
590
- * 60 days. If you to want to reference them beyond 60 days, you must save old run results
591
- * before they expire.
592
- */
593
- async getRunOutput(
594
- req: GetRunOutputRequest,
595
- options?: CallOptions
596
- ): Promise<GetRunOutputRequest_Response> {
597
- const url = `${this.host}/api/2.2/jobs/runs/get-output`;
598
- const params = new URLSearchParams();
599
- if (req.runId !== undefined) {
600
- params.append('run_id', String(req.runId));
601
- }
602
- const query = params.toString();
603
- const fullUrl = query !== '' ? `${url}?${query}` : url;
604
- let resp: GetRunOutputRequest_Response | undefined;
605
- const call = async (callSignal?: AbortSignal): Promise<void> => {
606
- const headers = new Headers();
607
- if (this.workspaceId !== undefined) {
608
- headers.set('X-Databricks-Org-Id', this.workspaceId);
609
- }
610
- headers.set('User-Agent', this.userAgent);
611
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
612
- const respBody = await executeHttpCall({
613
- request: httpReq,
614
- httpClient: this.httpClient,
615
- logger: this.logger,
616
- });
617
- resp = parseResponse(
618
- respBody,
619
- unmarshalGetRunOutputRequest_ResponseSchema
620
- );
621
- };
622
- await executeCall(call, options);
623
- if (resp === undefined) {
624
- throw new Error('operation completed without a result.');
625
- }
626
- return resp;
627
- }
628
-
629
- /** Retrieves a list of jobs. */
630
- async listJobs(
631
- req: ListJobsRequest,
632
- options?: CallOptions
633
- ): Promise<ListJobsRequest_Response> {
634
- const url = `${this.host}/api/2.2/jobs/list`;
635
- const params = new URLSearchParams();
636
- if (req.offset !== undefined) {
637
- params.append('offset', String(req.offset));
638
- }
639
- if (req.limit !== undefined) {
640
- params.append('limit', String(req.limit));
641
- }
642
- if (req.expandTasks !== undefined) {
643
- params.append('expand_tasks', String(req.expandTasks));
644
- }
645
- if (req.name !== undefined) {
646
- params.append('name', req.name);
647
- }
648
- if (req.pageToken !== undefined) {
649
- params.append('page_token', req.pageToken);
650
- }
651
- const query = params.toString();
652
- const fullUrl = query !== '' ? `${url}?${query}` : url;
653
- let resp: ListJobsRequest_Response | undefined;
654
- const call = async (callSignal?: AbortSignal): Promise<void> => {
655
- const headers = new Headers();
656
- if (this.workspaceId !== undefined) {
657
- headers.set('X-Databricks-Org-Id', this.workspaceId);
658
- }
659
- headers.set('User-Agent', this.userAgent);
660
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
661
- const respBody = await executeHttpCall({
662
- request: httpReq,
663
- httpClient: this.httpClient,
664
- logger: this.logger,
665
- });
666
- resp = parseResponse(respBody, unmarshalListJobsRequest_ResponseSchema);
667
- };
668
- await executeCall(call, options);
669
- if (resp === undefined) {
670
- throw new Error('operation completed without a result.');
671
- }
672
- return resp;
673
- }
674
-
675
- async *listJobsIter(
676
- req: ListJobsRequest,
677
- options?: CallOptions
678
- ): AsyncGenerator<BaseJob> {
679
- const pageReq: ListJobsRequest = {...req};
680
- for (;;) {
681
- const resp = await this.listJobs(pageReq, options);
682
- for (const item of resp.jobs ?? []) {
683
- yield item;
684
- }
685
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
686
- return;
687
- }
688
- pageReq.pageToken = resp.nextPageToken;
689
- }
690
- }
691
-
692
- /** List runs in descending order by start time. */
693
- async listRuns(
694
- req: ListRunsRequest,
695
- options?: CallOptions
696
- ): Promise<ListRunsRequest_Response> {
697
- const url = `${this.host}/api/2.2/jobs/runs/list`;
698
- const params = new URLSearchParams();
699
- if (req.jobId !== undefined) {
700
- params.append('job_id', String(req.jobId));
701
- }
702
- if (req.stateConstraint?.$case === 'activeOnly') {
703
- params.append('active_only', String(req.stateConstraint.activeOnly));
704
- }
705
- if (req.stateConstraint?.$case === 'completedOnly') {
706
- params.append(
707
- 'completed_only',
708
- String(req.stateConstraint.completedOnly)
709
- );
710
- }
711
- if (req.offset !== undefined) {
712
- params.append('offset', String(req.offset));
713
- }
714
- if (req.limit !== undefined) {
715
- params.append('limit', String(req.limit));
716
- }
717
- if (req.runType !== undefined) {
718
- params.append('run_type', req.runType);
719
- }
720
- if (req.expandTasks !== undefined) {
721
- params.append('expand_tasks', String(req.expandTasks));
722
- }
723
- if (req.startTimeFrom !== undefined) {
724
- params.append('start_time_from', String(req.startTimeFrom));
725
- }
726
- if (req.startTimeTo !== undefined) {
727
- params.append('start_time_to', String(req.startTimeTo));
728
- }
729
- if (req.pageToken !== undefined) {
730
- params.append('page_token', req.pageToken);
731
- }
732
- const query = params.toString();
733
- const fullUrl = query !== '' ? `${url}?${query}` : url;
734
- let resp: ListRunsRequest_Response | undefined;
735
- const call = async (callSignal?: AbortSignal): Promise<void> => {
736
- const headers = new Headers();
737
- if (this.workspaceId !== undefined) {
738
- headers.set('X-Databricks-Org-Id', this.workspaceId);
739
- }
740
- headers.set('User-Agent', this.userAgent);
741
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
742
- const respBody = await executeHttpCall({
743
- request: httpReq,
744
- httpClient: this.httpClient,
745
- logger: this.logger,
746
- });
747
- resp = parseResponse(respBody, unmarshalListRunsRequest_ResponseSchema);
748
- };
749
- await executeCall(call, options);
750
- if (resp === undefined) {
751
- throw new Error('operation completed without a result.');
752
- }
753
- return resp;
754
- }
755
-
756
- async *listRunsIter(
757
- req: ListRunsRequest,
758
- options?: CallOptions
759
- ): AsyncGenerator<BaseRun> {
760
- const pageReq: ListRunsRequest = {...req};
761
- for (;;) {
762
- const resp = await this.listRuns(pageReq, options);
763
- for (const item of resp.runs ?? []) {
764
- yield item;
765
- }
766
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
767
- return;
768
- }
769
- pageReq.pageToken = resp.nextPageToken;
770
- }
771
- }
772
-
773
- /**
774
- * Re-run one or more tasks. Tasks are re-run as part of the original job run.
775
- * They use the current job and task settings, and can be viewed in the history for the
776
- * original job run.
777
- */
778
- private async repair(
779
- req: RepairRunRequest,
780
- options?: CallOptions
781
- ): Promise<RepairRunRequest_Response> {
782
- const url = `${this.host}/api/2.2/jobs/runs/repair`;
783
- const body = marshalRequest(req, marshalRepairRunRequestSchema);
784
- let resp: RepairRunRequest_Response | undefined;
785
- const call = async (callSignal?: AbortSignal): Promise<void> => {
786
- const headers = new Headers({'Content-Type': 'application/json'});
787
- if (this.workspaceId !== undefined) {
788
- headers.set('X-Databricks-Org-Id', this.workspaceId);
789
- }
790
- headers.set('User-Agent', this.userAgent);
791
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
792
- const respBody = await executeHttpCall({
793
- request: httpReq,
794
- httpClient: this.httpClient,
795
- logger: this.logger,
796
- });
797
- resp = parseResponse(respBody, unmarshalRepairRunRequest_ResponseSchema);
798
- };
799
- await executeCall(call, options);
800
- if (resp === undefined) {
801
- throw new Error('operation completed without a result.');
802
- }
803
- return resp;
804
- }
805
-
806
- async repairWaiter(
807
- req: RepairRunRequest,
808
- options?: CallOptions
809
- ): Promise<RepairWaiter> {
810
- await this.repair(req, options);
811
- if (req.runId === undefined) {
812
- throw new Error('request field runId required for polling is missing');
813
- }
814
- return new RepairWaiter(this, req.runId);
815
- }
816
-
817
- /** Overwrite all settings for the given job. Use the [_Update_ endpoint](:method:jobs/update) to update job settings partially. */
818
- async resetJob(
819
- req: ResetJobRequest,
820
- options?: CallOptions
821
- ): Promise<ResetJobRequest_Response> {
822
- const url = `${this.host}/api/2.2/jobs/reset`;
823
- const body = marshalRequest(req, marshalResetJobRequestSchema);
824
- let resp: ResetJobRequest_Response | undefined;
825
- const call = async (callSignal?: AbortSignal): Promise<void> => {
826
- const headers = new Headers({'Content-Type': 'application/json'});
827
- if (this.workspaceId !== undefined) {
828
- headers.set('X-Databricks-Org-Id', this.workspaceId);
829
- }
830
- headers.set('User-Agent', this.userAgent);
831
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
832
- const respBody = await executeHttpCall({
833
- request: httpReq,
834
- httpClient: this.httpClient,
835
- logger: this.logger,
836
- });
837
- resp = parseResponse(respBody, unmarshalResetJobRequest_ResponseSchema);
838
- };
839
- await executeCall(call, options);
840
- if (resp === undefined) {
841
- throw new Error('operation completed without a result.');
842
- }
843
- return resp;
844
- }
845
-
846
- /** Run a job and return the `run_id` of the triggered run. */
847
- private async runNow(
848
- req: RunNowRequest,
849
- options?: CallOptions
850
- ): Promise<RunNowRequest_Response> {
851
- const url = `${this.host}/api/2.2/jobs/run-now`;
852
- const body = marshalRequest(req, marshalRunNowRequestSchema);
853
- let resp: RunNowRequest_Response | undefined;
854
- const call = async (callSignal?: AbortSignal): Promise<void> => {
855
- const headers = new Headers({'Content-Type': 'application/json'});
856
- if (this.workspaceId !== undefined) {
857
- headers.set('X-Databricks-Org-Id', this.workspaceId);
858
- }
859
- headers.set('User-Agent', this.userAgent);
860
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
861
- const respBody = await executeHttpCall({
862
- request: httpReq,
863
- httpClient: this.httpClient,
864
- logger: this.logger,
865
- });
866
- resp = parseResponse(respBody, unmarshalRunNowRequest_ResponseSchema);
867
- };
868
- await executeCall(call, options);
869
- if (resp === undefined) {
870
- throw new Error('operation completed without a result.');
871
- }
872
- return resp;
873
- }
874
-
875
- async runNowWaiter(
876
- req: RunNowRequest,
877
- options?: CallOptions
878
- ): Promise<RunNowWaiter> {
879
- const resp = await this.runNow(req, options);
880
- if (resp.runId === undefined) {
881
- throw new Error('response field runId required for polling is missing');
882
- }
883
- return new RunNowWaiter(this, resp.runId);
884
- }
885
-
886
- /**
887
- * Submit a one-time run. This endpoint allows you to submit a workload directly
888
- * without creating a job. Runs submitted using this endpoint don’t display in
889
- * the UI. Use the `jobs/runs/get` API to check the run state after the job is
890
- * submitted.
891
- *
892
- * **Important:** Jobs submitted using this endpoint are not saved as a job.
893
- * They do not show up in the Jobs UI, and do not retry when they fail. Because
894
- * they are not saved, <Databricks> cannot auto-optimize serverless compute in case
895
- * of failure. If your job fails, you may want to use classic compute to specify
896
- * the compute needs for the job. Alternatively, use the `POST /jobs/create` and
897
- * `POST /jobs/run-now` endpoints to create and run a saved job.
898
- */
899
- private async submitRun(
900
- req: SubmitRunRequest,
901
- options?: CallOptions
902
- ): Promise<SubmitRunRequest_Response> {
903
- const url = `${this.host}/api/2.2/jobs/runs/submit`;
904
- const body = marshalRequest(req, marshalSubmitRunRequestSchema);
905
- let resp: SubmitRunRequest_Response | undefined;
906
- const call = async (callSignal?: AbortSignal): Promise<void> => {
907
- const headers = new Headers({'Content-Type': 'application/json'});
908
- if (this.workspaceId !== undefined) {
909
- headers.set('X-Databricks-Org-Id', this.workspaceId);
910
- }
911
- headers.set('User-Agent', this.userAgent);
912
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
913
- const respBody = await executeHttpCall({
914
- request: httpReq,
915
- httpClient: this.httpClient,
916
- logger: this.logger,
917
- });
918
- resp = parseResponse(respBody, unmarshalSubmitRunRequest_ResponseSchema);
919
- };
920
- await executeCall(call, options);
921
- if (resp === undefined) {
922
- throw new Error('operation completed without a result.');
923
- }
924
- return resp;
925
- }
926
-
927
- async submitRunWaiter(
928
- req: SubmitRunRequest,
929
- options?: CallOptions
930
- ): Promise<SubmitRunWaiter> {
931
- const resp = await this.submitRun(req, options);
932
- if (resp.runId === undefined) {
933
- throw new Error('response field runId required for polling is missing');
934
- }
935
- return new SubmitRunWaiter(this, resp.runId);
936
- }
937
-
938
- /** Add, update, or remove specific settings of an existing job. Use the [_Reset_ endpoint](:method:jobs/reset) to overwrite all job settings. */
939
- async updateJob(
940
- req: UpdateJobRequest,
941
- options?: CallOptions
942
- ): Promise<UpdateJobRequest_Response> {
943
- const url = `${this.host}/api/2.2/jobs/update`;
944
- const body = marshalRequest(req, marshalUpdateJobRequestSchema);
945
- let resp: UpdateJobRequest_Response | undefined;
946
- const call = async (callSignal?: AbortSignal): Promise<void> => {
947
- const headers = new Headers({'Content-Type': 'application/json'});
948
- if (this.workspaceId !== undefined) {
949
- headers.set('X-Databricks-Org-Id', this.workspaceId);
950
- }
951
- headers.set('User-Agent', this.userAgent);
952
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
953
- const respBody = await executeHttpCall({
954
- request: httpReq,
955
- httpClient: this.httpClient,
956
- logger: this.logger,
957
- });
958
- resp = parseResponse(respBody, unmarshalUpdateJobRequest_ResponseSchema);
959
- };
960
- await executeCall(call, options);
961
- if (resp === undefined) {
962
- throw new Error('operation completed without a result.');
963
- }
964
- return resp;
965
- }
966
- }
967
-
968
- export class CancelRunWaiter {
969
- constructor(
970
- private readonly client: JobsClient,
971
- readonly runId: bigint
972
- ) {}
973
-
974
- /**
975
- * Polls until the operation reaches a terminal state.
976
- *
977
- * Throws if a failure state is reached.
978
- */
979
- async wait(options?: LroOptions): Promise<GetRunRequest_Response> {
980
- let result: GetRunRequest_Response | undefined;
981
-
982
- const call = async (callSignal?: AbortSignal): Promise<void> => {
983
- const pollResp = await this.client.getRun(
984
- {
985
- runId: this.runId,
986
- },
987
- callSignal !== undefined ? {signal: callSignal} : undefined
988
- );
989
-
990
- const status = pollResp.state?.lifeCycleState;
991
- if (status === undefined) {
992
- throw new Error('response missing required status field');
993
- }
994
-
995
- switch (status) {
996
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
997
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
998
- result = pollResp;
999
- return;
1000
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR: {
1001
- const msg = pollResp.state?.stateMessage ?? '(no message)';
1002
- throw new Error(`terminal state ${status}: ${msg}`);
1003
- }
1004
- default:
1005
- throw new StillRunningError();
1006
- }
1007
- };
1008
-
1009
- await executeWait(call, options);
1010
- if (result === undefined) {
1011
- throw new Error('operation completed without a result.');
1012
- }
1013
- return result;
1014
- }
1015
-
1016
- /** Checks whether the operation has reached a terminal state. */
1017
- async done(options?: CallOptions): Promise<boolean> {
1018
- const pollResp = await this.client.getRun(
1019
- {
1020
- runId: this.runId,
1021
- },
1022
- options
1023
- );
1024
-
1025
- const status = pollResp.state?.lifeCycleState;
1026
- if (status === undefined) {
1027
- throw new Error('response missing required status field');
1028
- }
1029
-
1030
- switch (status) {
1031
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1032
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1033
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR:
1034
- return true;
1035
- default:
1036
- return false;
1037
- }
1038
- }
1039
- }
1040
-
1041
- export class RepairWaiter {
1042
- constructor(
1043
- private readonly client: JobsClient,
1044
- readonly runId: bigint
1045
- ) {}
1046
-
1047
- /**
1048
- * Polls until the operation reaches a terminal state.
1049
- *
1050
- * Throws if a failure state is reached.
1051
- */
1052
- async wait(options?: LroOptions): Promise<GetRunRequest_Response> {
1053
- let result: GetRunRequest_Response | undefined;
1054
-
1055
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1056
- const pollResp = await this.client.getRun(
1057
- {
1058
- runId: this.runId,
1059
- },
1060
- callSignal !== undefined ? {signal: callSignal} : undefined
1061
- );
1062
-
1063
- const status = pollResp.state?.lifeCycleState;
1064
- if (status === undefined) {
1065
- throw new Error('response missing required status field');
1066
- }
1067
-
1068
- switch (status) {
1069
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1070
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1071
- result = pollResp;
1072
- return;
1073
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR: {
1074
- const msg = pollResp.state?.stateMessage ?? '(no message)';
1075
- throw new Error(`terminal state ${status}: ${msg}`);
1076
- }
1077
- default:
1078
- throw new StillRunningError();
1079
- }
1080
- };
1081
-
1082
- await executeWait(call, options);
1083
- if (result === undefined) {
1084
- throw new Error('operation completed without a result.');
1085
- }
1086
- return result;
1087
- }
1088
-
1089
- /** Checks whether the operation has reached a terminal state. */
1090
- async done(options?: CallOptions): Promise<boolean> {
1091
- const pollResp = await this.client.getRun(
1092
- {
1093
- runId: this.runId,
1094
- },
1095
- options
1096
- );
1097
-
1098
- const status = pollResp.state?.lifeCycleState;
1099
- if (status === undefined) {
1100
- throw new Error('response missing required status field');
1101
- }
1102
-
1103
- switch (status) {
1104
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1105
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1106
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR:
1107
- return true;
1108
- default:
1109
- return false;
1110
- }
1111
- }
1112
- }
1113
-
1114
- export class RunNowWaiter {
1115
- constructor(
1116
- private readonly client: JobsClient,
1117
- readonly runId: bigint
1118
- ) {}
1119
-
1120
- /**
1121
- * Polls until the operation reaches a terminal state.
1122
- *
1123
- * Throws if a failure state is reached.
1124
- */
1125
- async wait(options?: LroOptions): Promise<GetRunRequest_Response> {
1126
- let result: GetRunRequest_Response | undefined;
1127
-
1128
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1129
- const pollResp = await this.client.getRun(
1130
- {
1131
- runId: this.runId,
1132
- },
1133
- callSignal !== undefined ? {signal: callSignal} : undefined
1134
- );
1135
-
1136
- const status = pollResp.state?.lifeCycleState;
1137
- if (status === undefined) {
1138
- throw new Error('response missing required status field');
1139
- }
1140
-
1141
- switch (status) {
1142
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1143
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1144
- result = pollResp;
1145
- return;
1146
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR: {
1147
- const msg = pollResp.state?.stateMessage ?? '(no message)';
1148
- throw new Error(`terminal state ${status}: ${msg}`);
1149
- }
1150
- default:
1151
- throw new StillRunningError();
1152
- }
1153
- };
1154
-
1155
- await executeWait(call, options);
1156
- if (result === undefined) {
1157
- throw new Error('operation completed without a result.');
1158
- }
1159
- return result;
1160
- }
1161
-
1162
- /** Checks whether the operation has reached a terminal state. */
1163
- async done(options?: CallOptions): Promise<boolean> {
1164
- const pollResp = await this.client.getRun(
1165
- {
1166
- runId: this.runId,
1167
- },
1168
- options
1169
- );
1170
-
1171
- const status = pollResp.state?.lifeCycleState;
1172
- if (status === undefined) {
1173
- throw new Error('response missing required status field');
1174
- }
1175
-
1176
- switch (status) {
1177
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1178
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1179
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR:
1180
- return true;
1181
- default:
1182
- return false;
1183
- }
1184
- }
1185
- }
1186
-
1187
- export class SubmitRunWaiter {
1188
- constructor(
1189
- private readonly client: JobsClient,
1190
- readonly runId: bigint
1191
- ) {}
1192
-
1193
- /**
1194
- * Polls until the operation reaches a terminal state.
1195
- *
1196
- * Throws if a failure state is reached.
1197
- */
1198
- async wait(options?: LroOptions): Promise<GetRunRequest_Response> {
1199
- let result: GetRunRequest_Response | undefined;
1200
-
1201
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1202
- const pollResp = await this.client.getRun(
1203
- {
1204
- runId: this.runId,
1205
- },
1206
- callSignal !== undefined ? {signal: callSignal} : undefined
1207
- );
1208
-
1209
- const status = pollResp.state?.lifeCycleState;
1210
- if (status === undefined) {
1211
- throw new Error('response missing required status field');
1212
- }
1213
-
1214
- switch (status) {
1215
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1216
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1217
- result = pollResp;
1218
- return;
1219
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR: {
1220
- const msg = pollResp.state?.stateMessage ?? '(no message)';
1221
- throw new Error(`terminal state ${status}: ${msg}`);
1222
- }
1223
- default:
1224
- throw new StillRunningError();
1225
- }
1226
- };
1227
-
1228
- await executeWait(call, options);
1229
- if (result === undefined) {
1230
- throw new Error('operation completed without a result.');
1231
- }
1232
- return result;
1233
- }
1234
-
1235
- /** Checks whether the operation has reached a terminal state. */
1236
- async done(options?: CallOptions): Promise<boolean> {
1237
- const pollResp = await this.client.getRun(
1238
- {
1239
- runId: this.runId,
1240
- },
1241
- options
1242
- );
1243
-
1244
- const status = pollResp.state?.lifeCycleState;
1245
- if (status === undefined) {
1246
- throw new Error('response missing required status field');
1247
- }
1248
-
1249
- switch (status) {
1250
- case RunLifeCycleState_RunLifeCycleState.TERMINATED:
1251
- case RunLifeCycleState_RunLifeCycleState.SKIPPED:
1252
- case RunLifeCycleState_RunLifeCycleState.INTERNAL_ERROR:
1253
- return true;
1254
- default:
1255
- return false;
1256
- }
1257
- }
1258
- }