-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjob.ts
84 lines (64 loc) · 2.19 KB
/
job.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../resource';
import * as Core from '../../core';
export class Job extends APIResource {
list(options?: Core.RequestOptions): Core.APIPromise<JobListResponse> {
return (
this._client.get('/v1/post-training/jobs', options) as Core.APIPromise<{ data: JobListResponse }>
)._thenUnwrap((obj) => obj.data);
}
artifacts(
query: JobArtifactsParams,
options?: Core.RequestOptions,
): Core.APIPromise<JobArtifactsResponse | null> {
return this._client.get('/v1/post-training/job/artifacts', { query, ...options });
}
cancel(body: JobCancelParams, options?: Core.RequestOptions): Core.APIPromise<void> {
return this._client.post('/v1/post-training/job/cancel', {
body,
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
status(query: JobStatusParams, options?: Core.RequestOptions): Core.APIPromise<JobStatusResponse | null> {
return this._client.get('/v1/post-training/job/status', { query, ...options });
}
}
export type JobListResponse = Array<JobListResponse.JobListResponseItem>;
export namespace JobListResponse {
export interface JobListResponseItem {
job_uuid: string;
}
}
export interface JobArtifactsResponse {
checkpoints: Array<unknown>;
job_uuid: string;
}
export interface JobStatusResponse {
checkpoints: Array<unknown>;
job_uuid: string;
status: 'completed' | 'in_progress' | 'failed' | 'scheduled';
completed_at?: string;
resources_allocated?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
scheduled_at?: string;
started_at?: string;
}
export interface JobArtifactsParams {
job_uuid: string;
}
export interface JobCancelParams {
job_uuid: string;
}
export interface JobStatusParams {
job_uuid: string;
}
export declare namespace Job {
export {
type JobListResponse as JobListResponse,
type JobArtifactsResponse as JobArtifactsResponse,
type JobStatusResponse as JobStatusResponse,
type JobArtifactsParams as JobArtifactsParams,
type JobCancelParams as JobCancelParams,
type JobStatusParams as JobStatusParams,
};
}