runpod-sdk 1.1.2 → 1.2.0-beta.2
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 +217 -32
- package/dist/src/graphql/client.d.ts +22 -0
- package/dist/src/graphql/client.js +75 -0
- package/dist/src/graphql/client.js.map +1 -0
- package/dist/src/graphql/generated/index.d.ts +742 -0
- package/dist/src/graphql/generated/index.js +347 -0
- package/dist/src/graphql/generated/index.js.map +1 -0
- package/dist/src/graphql/generated/operations.d.ts +428 -0
- package/dist/src/graphql/generated/operations.js +2 -0
- package/dist/src/graphql/generated/operations.js.map +1 -0
- package/dist/src/graphql/generated/sdk.d.ts +31 -0
- package/dist/src/graphql/generated/sdk.js +232 -0
- package/dist/src/graphql/generated/sdk.js.map +1 -0
- package/dist/src/graphql/generated/types.d.ts +4281 -0
- package/dist/src/graphql/generated/types.js +2 -0
- package/dist/src/graphql/generated/types.js.map +1 -0
- package/dist/src/index.d.ts +53 -8
- package/dist/src/index.js +73 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/pods/generated-gpu-types.d.ts +299 -0
- package/dist/src/pods/generated-gpu-types.js +148 -0
- package/dist/src/pods/generated-gpu-types.js.map +1 -0
- package/dist/src/pods/index.d.ts +122 -0
- package/dist/src/pods/index.js +242 -0
- package/dist/src/pods/index.js.map +1 -0
- package/package.json +17 -2
- package/schema.gql +161 -0
- package/.prettierrc +0 -12
- package/README-dev.md +0 -7
- package/examples/basic.js +0 -19
- package/examples/cancel.js +0 -27
- package/examples/devServerless.js +0 -17
- package/examples/errors.js +0 -11
- package/examples/health.js +0 -11
- package/examples/purge-queue.js +0 -11
- package/examples/run.js +0 -27
- package/examples/runSync.js +0 -17
- package/examples/stream.js +0 -48
- package/examples/test.js +0 -74
- package/src/index.ts +0 -330
- package/tsconfig.json +0 -17
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// Generated file - do not edit manually
|
|
2
|
+
// Generated on 2025-08-14T14:27:24.764Z
|
|
3
|
+
// Environment: production
|
|
4
|
+
// Source: https://api.runpod.io/graphql
|
|
5
|
+
/**
|
|
6
|
+
* GPU types available in RunPod production environment
|
|
7
|
+
* Use these constants for type-safe GPU selection
|
|
8
|
+
*/
|
|
9
|
+
export var GpuTypes;
|
|
10
|
+
(function (GpuTypes) {
|
|
11
|
+
GpuTypes["MI300X"] = "AMD Instinct MI300X OAM";
|
|
12
|
+
GpuTypes["A100_PCIE"] = "NVIDIA A100 80GB PCIe";
|
|
13
|
+
GpuTypes["A100_SXM"] = "NVIDIA A100-SXM4-80GB";
|
|
14
|
+
GpuTypes["A30"] = "NVIDIA A30";
|
|
15
|
+
GpuTypes["A40"] = "NVIDIA A40";
|
|
16
|
+
GpuTypes["B200"] = "NVIDIA B200";
|
|
17
|
+
GpuTypes["RTX_3070"] = "NVIDIA GeForce RTX 3070";
|
|
18
|
+
GpuTypes["RTX_3080"] = "NVIDIA GeForce RTX 3080";
|
|
19
|
+
GpuTypes["RTX_3080_TI"] = "NVIDIA GeForce RTX 3080 Ti";
|
|
20
|
+
GpuTypes["RTX_3090"] = "NVIDIA GeForce RTX 3090";
|
|
21
|
+
GpuTypes["RTX_3090_TI"] = "NVIDIA GeForce RTX 3090 Ti";
|
|
22
|
+
GpuTypes["RTX_4070_TI"] = "NVIDIA GeForce RTX 4070 Ti";
|
|
23
|
+
GpuTypes["RTX_4080"] = "NVIDIA GeForce RTX 4080";
|
|
24
|
+
GpuTypes["RTX_4080_SUPER"] = "NVIDIA GeForce RTX 4080 SUPER";
|
|
25
|
+
GpuTypes["RTX_4090"] = "NVIDIA GeForce RTX 4090";
|
|
26
|
+
GpuTypes["RTX_5080"] = "NVIDIA GeForce RTX 5080";
|
|
27
|
+
GpuTypes["RTX_5090"] = "NVIDIA GeForce RTX 5090";
|
|
28
|
+
GpuTypes["H100_SXM"] = "NVIDIA H100 80GB HBM3";
|
|
29
|
+
GpuTypes["H100_NVL"] = "NVIDIA H100 NVL";
|
|
30
|
+
GpuTypes["H100_PCIE"] = "NVIDIA H100 PCIe";
|
|
31
|
+
GpuTypes["H200_SXM"] = "NVIDIA H200";
|
|
32
|
+
GpuTypes["L4"] = "NVIDIA L4";
|
|
33
|
+
GpuTypes["L40"] = "NVIDIA L40";
|
|
34
|
+
GpuTypes["L40S"] = "NVIDIA L40S";
|
|
35
|
+
GpuTypes["RTX_2000_ADA"] = "NVIDIA RTX 2000 Ada Generation";
|
|
36
|
+
GpuTypes["RTX_4000_ADA"] = "NVIDIA RTX 4000 Ada Generation";
|
|
37
|
+
GpuTypes["RTX_4000_ADA_SFF"] = "NVIDIA RTX 4000 SFF Ada Generation";
|
|
38
|
+
GpuTypes["RTX_5000_ADA"] = "NVIDIA RTX 5000 Ada Generation";
|
|
39
|
+
GpuTypes["RTX_6000_ADA"] = "NVIDIA RTX 6000 Ada Generation";
|
|
40
|
+
GpuTypes["RTX_A2000"] = "NVIDIA RTX A2000";
|
|
41
|
+
GpuTypes["RTX_A4000"] = "NVIDIA RTX A4000";
|
|
42
|
+
GpuTypes["RTX_A4500"] = "NVIDIA RTX A4500";
|
|
43
|
+
GpuTypes["RTX_A5000"] = "NVIDIA RTX A5000";
|
|
44
|
+
GpuTypes["RTX_A6000"] = "NVIDIA RTX A6000";
|
|
45
|
+
GpuTypes["RTX_PRO_6000"] = "NVIDIA RTX PRO 6000 Blackwell Workstation Edition";
|
|
46
|
+
GpuTypes["V100_FHHL"] = "Tesla V100-FHHL-16GB";
|
|
47
|
+
GpuTypes["TESLA_V100"] = "Tesla V100-PCIE-16GB";
|
|
48
|
+
GpuTypes["V100_SXM2"] = "Tesla V100-SXM2-16GB";
|
|
49
|
+
GpuTypes["V100_SXM2_32GB"] = "Tesla V100-SXM2-32GB";
|
|
50
|
+
GpuTypes["UNKNOWN"] = "unknown";
|
|
51
|
+
})(GpuTypes || (GpuTypes = {}));
|
|
52
|
+
/**
|
|
53
|
+
* Human-readable display names for GPU types
|
|
54
|
+
*/
|
|
55
|
+
export const GPU_TYPE_DISPLAY_NAMES = {
|
|
56
|
+
'AMD Instinct MI300X OAM': 'MI300X',
|
|
57
|
+
'NVIDIA A100 80GB PCIe': 'A100 PCIe',
|
|
58
|
+
'NVIDIA A100-SXM4-80GB': 'A100 SXM',
|
|
59
|
+
'NVIDIA A30': 'A30',
|
|
60
|
+
'NVIDIA A40': 'A40',
|
|
61
|
+
'NVIDIA B200': 'B200',
|
|
62
|
+
'NVIDIA GeForce RTX 3070': 'RTX 3070',
|
|
63
|
+
'NVIDIA GeForce RTX 3080': 'RTX 3080',
|
|
64
|
+
'NVIDIA GeForce RTX 3080 Ti': 'RTX 3080 Ti',
|
|
65
|
+
'NVIDIA GeForce RTX 3090': 'RTX 3090',
|
|
66
|
+
'NVIDIA GeForce RTX 3090 Ti': 'RTX 3090 Ti',
|
|
67
|
+
'NVIDIA GeForce RTX 4070 Ti': 'RTX 4070 Ti',
|
|
68
|
+
'NVIDIA GeForce RTX 4080': 'RTX 4080',
|
|
69
|
+
'NVIDIA GeForce RTX 4080 SUPER': 'RTX 4080 SUPER',
|
|
70
|
+
'NVIDIA GeForce RTX 4090': 'RTX 4090',
|
|
71
|
+
'NVIDIA GeForce RTX 5080': 'RTX 5080',
|
|
72
|
+
'NVIDIA GeForce RTX 5090': 'RTX 5090',
|
|
73
|
+
'NVIDIA H100 80GB HBM3': 'H100 SXM',
|
|
74
|
+
'NVIDIA H100 NVL': 'H100 NVL',
|
|
75
|
+
'NVIDIA H100 PCIe': 'H100 PCIe',
|
|
76
|
+
'NVIDIA H200': 'H200 SXM',
|
|
77
|
+
'NVIDIA L4': 'L4',
|
|
78
|
+
'NVIDIA L40': 'L40',
|
|
79
|
+
'NVIDIA L40S': 'L40S',
|
|
80
|
+
'NVIDIA RTX 2000 Ada Generation': 'RTX 2000 Ada',
|
|
81
|
+
'NVIDIA RTX 4000 Ada Generation': 'RTX 4000 Ada',
|
|
82
|
+
'NVIDIA RTX 4000 SFF Ada Generation': 'RTX 4000 Ada SFF',
|
|
83
|
+
'NVIDIA RTX 5000 Ada Generation': 'RTX 5000 Ada',
|
|
84
|
+
'NVIDIA RTX 6000 Ada Generation': 'RTX 6000 Ada',
|
|
85
|
+
'NVIDIA RTX A2000': 'RTX A2000',
|
|
86
|
+
'NVIDIA RTX A4000': 'RTX A4000',
|
|
87
|
+
'NVIDIA RTX A4500': 'RTX A4500',
|
|
88
|
+
'NVIDIA RTX A5000': 'RTX A5000',
|
|
89
|
+
'NVIDIA RTX A6000': 'RTX A6000',
|
|
90
|
+
'NVIDIA RTX PRO 6000 Blackwell Workstation Edition': 'RTX PRO 6000',
|
|
91
|
+
'Tesla V100-FHHL-16GB': 'V100 FHHL',
|
|
92
|
+
'Tesla V100-PCIE-16GB': 'Tesla V100',
|
|
93
|
+
'Tesla V100-SXM2-16GB': 'V100 SXM2',
|
|
94
|
+
'Tesla V100-SXM2-32GB': 'V100 SXM2 32GB',
|
|
95
|
+
'unknown': 'unknown'
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Full GPU type data with specifications
|
|
99
|
+
*/
|
|
100
|
+
export const GPU_TYPES_LIST = [
|
|
101
|
+
{ id: 'AMD Instinct MI300X OAM', displayName: 'MI300X', memoryInGb: 192, secureCloud: true, communityCloud: false },
|
|
102
|
+
{ id: 'NVIDIA A100 80GB PCIe', displayName: 'A100 PCIe', memoryInGb: 80, secureCloud: true, communityCloud: true },
|
|
103
|
+
{ id: 'NVIDIA A100-SXM4-80GB', displayName: 'A100 SXM', memoryInGb: 80, secureCloud: true, communityCloud: true },
|
|
104
|
+
{ id: 'NVIDIA A30', displayName: 'A30', memoryInGb: 24, secureCloud: false, communityCloud: true },
|
|
105
|
+
{ id: 'NVIDIA A40', displayName: 'A40', memoryInGb: 48, secureCloud: true, communityCloud: false },
|
|
106
|
+
{ id: 'NVIDIA B200', displayName: 'B200', memoryInGb: 180, secureCloud: true, communityCloud: false },
|
|
107
|
+
{ id: 'NVIDIA GeForce RTX 3070', displayName: 'RTX 3070', memoryInGb: 8, secureCloud: false, communityCloud: true },
|
|
108
|
+
{ id: 'NVIDIA GeForce RTX 3080', displayName: 'RTX 3080', memoryInGb: 10, secureCloud: false, communityCloud: true },
|
|
109
|
+
{ id: 'NVIDIA GeForce RTX 3080 Ti', displayName: 'RTX 3080 Ti', memoryInGb: 12, secureCloud: false, communityCloud: true },
|
|
110
|
+
{ id: 'NVIDIA GeForce RTX 3090', displayName: 'RTX 3090', memoryInGb: 24, secureCloud: true, communityCloud: true },
|
|
111
|
+
{ id: 'NVIDIA GeForce RTX 3090 Ti', displayName: 'RTX 3090 Ti', memoryInGb: 24, secureCloud: false, communityCloud: true },
|
|
112
|
+
{ id: 'NVIDIA GeForce RTX 4070 Ti', displayName: 'RTX 4070 Ti', memoryInGb: 12, secureCloud: false, communityCloud: true },
|
|
113
|
+
{ id: 'NVIDIA GeForce RTX 4080', displayName: 'RTX 4080', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
114
|
+
{ id: 'NVIDIA GeForce RTX 4080 SUPER', displayName: 'RTX 4080 SUPER', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
115
|
+
{ id: 'NVIDIA GeForce RTX 4090', displayName: 'RTX 4090', memoryInGb: 24, secureCloud: true, communityCloud: true },
|
|
116
|
+
{ id: 'NVIDIA GeForce RTX 5080', displayName: 'RTX 5080', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
117
|
+
{ id: 'NVIDIA GeForce RTX 5090', displayName: 'RTX 5090', memoryInGb: 32, secureCloud: true, communityCloud: true },
|
|
118
|
+
{ id: 'NVIDIA H100 80GB HBM3', displayName: 'H100 SXM', memoryInGb: 80, secureCloud: true, communityCloud: true },
|
|
119
|
+
{ id: 'NVIDIA H100 NVL', displayName: 'H100 NVL', memoryInGb: 94, secureCloud: true, communityCloud: true },
|
|
120
|
+
{ id: 'NVIDIA H100 PCIe', displayName: 'H100 PCIe', memoryInGb: 80, secureCloud: true, communityCloud: true },
|
|
121
|
+
{ id: 'NVIDIA H200', displayName: 'H200 SXM', memoryInGb: 141, secureCloud: true, communityCloud: true },
|
|
122
|
+
{ id: 'NVIDIA L4', displayName: 'L4', memoryInGb: 24, secureCloud: true, communityCloud: false },
|
|
123
|
+
{ id: 'NVIDIA L40', displayName: 'L40', memoryInGb: 48, secureCloud: true, communityCloud: true },
|
|
124
|
+
{ id: 'NVIDIA L40S', displayName: 'L40S', memoryInGb: 48, secureCloud: true, communityCloud: true },
|
|
125
|
+
{ id: 'NVIDIA RTX 2000 Ada Generation', displayName: 'RTX 2000 Ada', memoryInGb: 16, secureCloud: true, communityCloud: false },
|
|
126
|
+
{ id: 'NVIDIA RTX 4000 Ada Generation', displayName: 'RTX 4000 Ada', memoryInGb: 20, secureCloud: true, communityCloud: true },
|
|
127
|
+
{ id: 'NVIDIA RTX 4000 SFF Ada Generation', displayName: 'RTX 4000 Ada SFF', memoryInGb: 20, secureCloud: false, communityCloud: true },
|
|
128
|
+
{ id: 'NVIDIA RTX 5000 Ada Generation', displayName: 'RTX 5000 Ada', memoryInGb: 32, secureCloud: false, communityCloud: true },
|
|
129
|
+
{ id: 'NVIDIA RTX 6000 Ada Generation', displayName: 'RTX 6000 Ada', memoryInGb: 48, secureCloud: true, communityCloud: true },
|
|
130
|
+
{ id: 'NVIDIA RTX A2000', displayName: 'RTX A2000', memoryInGb: 6, secureCloud: false, communityCloud: true },
|
|
131
|
+
{ id: 'NVIDIA RTX A4000', displayName: 'RTX A4000', memoryInGb: 16, secureCloud: true, communityCloud: true },
|
|
132
|
+
{ id: 'NVIDIA RTX A4500', displayName: 'RTX A4500', memoryInGb: 20, secureCloud: true, communityCloud: true },
|
|
133
|
+
{ id: 'NVIDIA RTX A5000', displayName: 'RTX A5000', memoryInGb: 24, secureCloud: true, communityCloud: true },
|
|
134
|
+
{ id: 'NVIDIA RTX A6000', displayName: 'RTX A6000', memoryInGb: 48, secureCloud: true, communityCloud: true },
|
|
135
|
+
{ id: 'NVIDIA RTX PRO 6000 Blackwell Workstation Edition', displayName: 'RTX PRO 6000', memoryInGb: 96, secureCloud: true, communityCloud: true },
|
|
136
|
+
{ id: 'Tesla V100-FHHL-16GB', displayName: 'V100 FHHL', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
137
|
+
{ id: 'Tesla V100-PCIE-16GB', displayName: 'Tesla V100', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
138
|
+
{ id: 'Tesla V100-SXM2-16GB', displayName: 'V100 SXM2', memoryInGb: 16, secureCloud: false, communityCloud: true },
|
|
139
|
+
{ id: 'Tesla V100-SXM2-32GB', displayName: 'V100 SXM2 32GB', memoryInGb: 32, secureCloud: false, communityCloud: true },
|
|
140
|
+
{ id: 'unknown', displayName: 'unknown', memoryInGb: 0, secureCloud: false, communityCloud: false }
|
|
141
|
+
];
|
|
142
|
+
/**
|
|
143
|
+
* Get display name for a GPU type ID
|
|
144
|
+
*/
|
|
145
|
+
export function getGpuDisplayName(gpuTypeId) {
|
|
146
|
+
return GPU_TYPE_DISPLAY_NAMES[gpuTypeId] || gpuTypeId;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=generated-gpu-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-gpu-types.js","sourceRoot":"","sources":["../../../src/pods/generated-gpu-types.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,wCAAwC;AACxC,0BAA0B;AAC1B,wCAAwC;AAExC;;;GAGG;AACH,MAAM,CAAN,IAAY,QAyCX;AAzCD,WAAY,QAAQ;IAClB,8CAAkC,CAAA;IAClC,+CAAmC,CAAA;IACnC,8CAAkC,CAAA;IAClC,8BAAkB,CAAA;IAClB,8BAAkB,CAAA;IAClB,gCAAoB,CAAA;IACpB,gDAAoC,CAAA;IACpC,gDAAoC,CAAA;IACpC,sDAA0C,CAAA;IAC1C,gDAAoC,CAAA;IACpC,sDAA0C,CAAA;IAC1C,sDAA0C,CAAA;IAC1C,gDAAoC,CAAA;IACpC,4DAAgD,CAAA;IACh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'../graphql/generated/index.js';
|
|
3
|
+
import { GpuTypes, type GpuTypeId, getGpuDisplayName, GPU_TYPES_LIST } from './generated-gpu-types.js';
|
|
4
|
+
export { GpuTypes, type GpuTypeId, getGpuDisplayName, GPU_TYPES_LIST };
|
|
5
|
+
export interface PodConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
imageName: string;
|
|
8
|
+
gpuTypeId: GpuTypes | string;
|
|
9
|
+
gpuCount?: number;
|
|
10
|
+
volumeInGb?: number;
|
|
11
|
+
volumeMountPath?: string;
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
ports?: string;
|
|
14
|
+
containerDiskInGb?: number;
|
|
15
|
+
dockerArgs?: string;
|
|
16
|
+
interruptible?: boolean;
|
|
17
|
+
bidPerGpu?: number;
|
|
18
|
+
}
|
|
19
|
+
export type Pod = PodDetailsFragment;
|
|
20
|
+
export interface PodFilters {
|
|
21
|
+
status?: string;
|
|
22
|
+
podType?: string;
|
|
23
|
+
}
|
|
24
|
+
export type GpuType = {
|
|
25
|
+
id: string;
|
|
26
|
+
displayName: string;
|
|
27
|
+
memoryInGb: number;
|
|
28
|
+
secureCloud: boolean;
|
|
29
|
+
communityCloud: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare class PodManager {
|
|
32
|
+
private sdk;
|
|
33
|
+
private client;
|
|
34
|
+
constructor(client: RunPodGraphQLClient);
|
|
35
|
+
/**
|
|
36
|
+
* Create a pod (on-demand or interruptible)
|
|
37
|
+
* @param config Pod configuration
|
|
38
|
+
* @returns Promise<Pod>
|
|
39
|
+
*/
|
|
40
|
+
create(config: PodConfig): Promise<Pod>;
|
|
41
|
+
private _createOnDemand;
|
|
42
|
+
private _createInterruptible;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use create() instead
|
|
45
|
+
*/
|
|
46
|
+
createOnDemand(config: PodConfig): Promise<Pod>;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use create() instead
|
|
49
|
+
*/
|
|
50
|
+
createInterruptable(config: PodConfig & {
|
|
51
|
+
bidPerGpu: number;
|
|
52
|
+
}): Promise<Pod>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a specific pod by ID
|
|
55
|
+
* @param podId Pod ID
|
|
56
|
+
* @returns Promise<Pod>
|
|
57
|
+
*/
|
|
58
|
+
get(podId: string): Promise<Pod>;
|
|
59
|
+
/**
|
|
60
|
+
* List all pods for the current user
|
|
61
|
+
* @param filters Optional filters
|
|
62
|
+
* @returns Promise<Pod[]>
|
|
63
|
+
*/
|
|
64
|
+
list(filters?: PodFilters): Promise<Pod[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Stop a running pod
|
|
67
|
+
* @param podId Pod ID
|
|
68
|
+
* @returns Promise<Pod>
|
|
69
|
+
*/
|
|
70
|
+
stop(podId: string): Promise<Pod>;
|
|
71
|
+
/**
|
|
72
|
+
* Resume a stopped pod
|
|
73
|
+
* @param podId Pod ID
|
|
74
|
+
* @param gpuCount Number of GPUs to resume with
|
|
75
|
+
* @returns Promise<Pod>
|
|
76
|
+
*/
|
|
77
|
+
resume(podId: string, gpuCount?: number): Promise<Pod>;
|
|
78
|
+
/**
|
|
79
|
+
* Terminate a pod (permanent deletion)
|
|
80
|
+
* @param podId Pod ID
|
|
81
|
+
* @returns Promise<void>
|
|
82
|
+
*/
|
|
83
|
+
terminate(podId: string): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Wait for pod to reach a specific status
|
|
86
|
+
* @param podId Pod ID
|
|
87
|
+
* @param targetStatus Target status to wait for
|
|
88
|
+
* @param timeoutMs Timeout in milliseconds (default: 5 minutes)
|
|
89
|
+
* @returns Promise<Pod>
|
|
90
|
+
*/
|
|
91
|
+
waitForStatus(podId: string, targetStatus: string, timeoutMs?: number): Promise<Pod>;
|
|
92
|
+
/**
|
|
93
|
+
* Convenience method - wait for pod to be running
|
|
94
|
+
* @param podId Pod ID
|
|
95
|
+
* @param timeoutMs Timeout in milliseconds
|
|
96
|
+
* @returns Promise<Pod>
|
|
97
|
+
*/
|
|
98
|
+
waitForReady(podId: string, timeoutMs?: number): Promise<Pod>;
|
|
99
|
+
/**
|
|
100
|
+
* Get pod runtime information (ports, GPU utilization, etc.)
|
|
101
|
+
* @param podId Pod ID
|
|
102
|
+
* @returns Promise<Pod['runtime']>
|
|
103
|
+
*/
|
|
104
|
+
getRuntime(podId: string): Promise<Pod['runtime']>;
|
|
105
|
+
/**
|
|
106
|
+
* Check if pod is running
|
|
107
|
+
* @param podId Pod ID
|
|
108
|
+
* @returns Promise<boolean>
|
|
109
|
+
*/
|
|
110
|
+
isRunning(podId: string): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Get pod cost per hour
|
|
113
|
+
* @param podId Pod ID
|
|
114
|
+
* @returns Promise<number>
|
|
115
|
+
*/
|
|
116
|
+
getCostPerHour(podId: string): Promise<number>;
|
|
117
|
+
/**
|
|
118
|
+
* List available GPU types
|
|
119
|
+
* @returns Promise<GpuType[]>
|
|
120
|
+
*/
|
|
121
|
+
listGpuTypes(): Promise<GpuType[]>;
|
|
122
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { getSdk } from '../graphql/generated/index.js';
|
|
2
|
+
import { GpuTypes, getGpuDisplayName, GPU_TYPES_LIST } from './generated-gpu-types.js';
|
|
3
|
+
// Re-export for convenience
|
|
4
|
+
export { GpuTypes, getGpuDisplayName, GPU_TYPES_LIST };
|
|
5
|
+
export class PodManager {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
this.sdk = getSdk(client.graphqlClient);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a pod (on-demand or interruptible)
|
|
12
|
+
* @param config Pod configuration
|
|
13
|
+
* @returns Promise<Pod>
|
|
14
|
+
*/
|
|
15
|
+
async create(config) {
|
|
16
|
+
// Client-side validation (fail fast)
|
|
17
|
+
if (!config.name?.trim()) {
|
|
18
|
+
throw new Error('Pod name is required');
|
|
19
|
+
}
|
|
20
|
+
if (!config.imageName) {
|
|
21
|
+
throw new Error('Image name is required');
|
|
22
|
+
}
|
|
23
|
+
if (!config.gpuTypeId) {
|
|
24
|
+
throw new Error('GPU type ID is required');
|
|
25
|
+
}
|
|
26
|
+
if (config.interruptible) {
|
|
27
|
+
if (!config.bidPerGpu || config.bidPerGpu <= 0) {
|
|
28
|
+
throw new Error('bidPerGpu is required for interruptible pods');
|
|
29
|
+
}
|
|
30
|
+
return this._createInterruptible(config);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return this._createOnDemand(config);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async _createOnDemand(config) {
|
|
37
|
+
const input = {
|
|
38
|
+
name: config.name.trim(),
|
|
39
|
+
imageName: config.imageName,
|
|
40
|
+
gpuTypeId: config.gpuTypeId,
|
|
41
|
+
gpuCount: config.gpuCount || 1,
|
|
42
|
+
volumeInGb: config.volumeInGb || 10,
|
|
43
|
+
volumeMountPath: config.volumeMountPath || '/workspace',
|
|
44
|
+
containerDiskInGb: config.containerDiskInGb || 5,
|
|
45
|
+
env: config.env ? Object.entries(config.env).map(([key, value]) => ({ key, value })) : undefined,
|
|
46
|
+
ports: config.ports,
|
|
47
|
+
dockerArgs: config.dockerArgs
|
|
48
|
+
};
|
|
49
|
+
const result = await this.sdk.CreateOnDemandPod({ input });
|
|
50
|
+
if (!result.podFindAndDeployOnDemand) {
|
|
51
|
+
throw new Error('Failed to create pod');
|
|
52
|
+
}
|
|
53
|
+
return result.podFindAndDeployOnDemand;
|
|
54
|
+
}
|
|
55
|
+
async _createInterruptible(config) {
|
|
56
|
+
const input = {
|
|
57
|
+
name: config.name.trim(),
|
|
58
|
+
imageName: config.imageName,
|
|
59
|
+
gpuTypeId: config.gpuTypeId,
|
|
60
|
+
gpuCount: config.gpuCount || 1,
|
|
61
|
+
volumeInGb: config.volumeInGb || 10,
|
|
62
|
+
volumeMountPath: config.volumeMountPath || '/workspace',
|
|
63
|
+
containerDiskInGb: config.containerDiskInGb || 5,
|
|
64
|
+
bidPerGpu: config.bidPerGpu,
|
|
65
|
+
env: config.env ? Object.entries(config.env).map(([key, value]) => ({ key, value })) : undefined,
|
|
66
|
+
ports: config.ports,
|
|
67
|
+
dockerArgs: config.dockerArgs
|
|
68
|
+
};
|
|
69
|
+
const result = await this.sdk.CreateInterruptablePod({ input });
|
|
70
|
+
if (!result.podRentInterruptable) {
|
|
71
|
+
throw new Error('Failed to create interruptible pod');
|
|
72
|
+
}
|
|
73
|
+
return result.podRentInterruptable;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Use create() instead
|
|
77
|
+
*/
|
|
78
|
+
async createOnDemand(config) {
|
|
79
|
+
return this.create({ ...config, interruptible: false });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Use create() instead
|
|
83
|
+
*/
|
|
84
|
+
async createInterruptable(config) {
|
|
85
|
+
return this.create({ ...config, interruptible: true });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a specific pod by ID
|
|
89
|
+
* @param podId Pod ID
|
|
90
|
+
* @returns Promise<Pod>
|
|
91
|
+
*/
|
|
92
|
+
async get(podId) {
|
|
93
|
+
if (!podId?.trim()) {
|
|
94
|
+
throw new Error('Pod ID is required');
|
|
95
|
+
}
|
|
96
|
+
const result = await this.sdk.GetPod({ podId: podId.trim() });
|
|
97
|
+
if (!result.pod) {
|
|
98
|
+
throw new Error(`Pod ${podId} not found`);
|
|
99
|
+
}
|
|
100
|
+
return result.pod;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* List all pods for the current user
|
|
104
|
+
* @param filters Optional filters
|
|
105
|
+
* @returns Promise<Pod[]>
|
|
106
|
+
*/
|
|
107
|
+
async list(filters) {
|
|
108
|
+
const result = await this.sdk.ListMyPods();
|
|
109
|
+
if (!result.myself?.pods) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
let pods = result.myself.pods.filter((pod) => pod !== null && pod !== undefined);
|
|
113
|
+
// Apply filters
|
|
114
|
+
if (filters?.status) {
|
|
115
|
+
pods = pods.filter((pod) => pod.desiredStatus === filters.status);
|
|
116
|
+
}
|
|
117
|
+
if (filters?.podType) {
|
|
118
|
+
pods = pods.filter((pod) => pod.podType === filters.podType);
|
|
119
|
+
}
|
|
120
|
+
return pods;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Stop a running pod
|
|
124
|
+
* @param podId Pod ID
|
|
125
|
+
* @returns Promise<Pod>
|
|
126
|
+
*/
|
|
127
|
+
async stop(podId) {
|
|
128
|
+
if (!podId?.trim()) {
|
|
129
|
+
throw new Error('Pod ID is required');
|
|
130
|
+
}
|
|
131
|
+
const result = await this.sdk.StopPod({ podId: podId.trim() });
|
|
132
|
+
if (!result.podStop) {
|
|
133
|
+
throw new Error(`Failed to stop pod ${podId}`);
|
|
134
|
+
}
|
|
135
|
+
return result.podStop;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resume a stopped pod
|
|
139
|
+
* @param podId Pod ID
|
|
140
|
+
* @param gpuCount Number of GPUs to resume with
|
|
141
|
+
* @returns Promise<Pod>
|
|
142
|
+
*/
|
|
143
|
+
async resume(podId, gpuCount = 1) {
|
|
144
|
+
if (!podId?.trim()) {
|
|
145
|
+
throw new Error('Pod ID is required');
|
|
146
|
+
}
|
|
147
|
+
if (gpuCount < 1) {
|
|
148
|
+
throw new Error('GPU count must be at least 1');
|
|
149
|
+
}
|
|
150
|
+
const result = await this.sdk.ResumePod({ podId: podId.trim(), gpuCount });
|
|
151
|
+
if (!result.podResume) {
|
|
152
|
+
throw new Error(`Failed to resume pod ${podId}`);
|
|
153
|
+
}
|
|
154
|
+
return result.podResume;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Terminate a pod (permanent deletion)
|
|
158
|
+
* @param podId Pod ID
|
|
159
|
+
* @returns Promise<void>
|
|
160
|
+
*/
|
|
161
|
+
async terminate(podId) {
|
|
162
|
+
if (!podId?.trim()) {
|
|
163
|
+
throw new Error('Pod ID is required');
|
|
164
|
+
}
|
|
165
|
+
await this.sdk.TerminatePod({ podId: podId.trim() });
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Wait for pod to reach a specific status
|
|
169
|
+
* @param podId Pod ID
|
|
170
|
+
* @param targetStatus Target status to wait for
|
|
171
|
+
* @param timeoutMs Timeout in milliseconds (default: 5 minutes)
|
|
172
|
+
* @returns Promise<Pod>
|
|
173
|
+
*/
|
|
174
|
+
async waitForStatus(podId, targetStatus, timeoutMs = 300000) {
|
|
175
|
+
const start = Date.now();
|
|
176
|
+
while (Date.now() - start < timeoutMs) {
|
|
177
|
+
const pod = await this.get(podId);
|
|
178
|
+
if (pod.desiredStatus === targetStatus) {
|
|
179
|
+
return pod;
|
|
180
|
+
}
|
|
181
|
+
// Wait 5 seconds between checks
|
|
182
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
183
|
+
}
|
|
184
|
+
throw new Error(`Timeout waiting for pod ${podId} to reach status ${targetStatus}`);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Convenience method - wait for pod to be running
|
|
188
|
+
* @param podId Pod ID
|
|
189
|
+
* @param timeoutMs Timeout in milliseconds
|
|
190
|
+
* @returns Promise<Pod>
|
|
191
|
+
*/
|
|
192
|
+
async waitForReady(podId, timeoutMs) {
|
|
193
|
+
return this.waitForStatus(podId, 'RUNNING', timeoutMs);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get pod runtime information (ports, GPU utilization, etc.)
|
|
197
|
+
* @param podId Pod ID
|
|
198
|
+
* @returns Promise<Pod['runtime']>
|
|
199
|
+
*/
|
|
200
|
+
async getRuntime(podId) {
|
|
201
|
+
const pod = await this.get(podId);
|
|
202
|
+
return pod.runtime;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if pod is running
|
|
206
|
+
* @param podId Pod ID
|
|
207
|
+
* @returns Promise<boolean>
|
|
208
|
+
*/
|
|
209
|
+
async isRunning(podId) {
|
|
210
|
+
const pod = await this.get(podId);
|
|
211
|
+
return pod.desiredStatus === 'RUNNING';
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get pod cost per hour
|
|
215
|
+
* @param podId Pod ID
|
|
216
|
+
* @returns Promise<number>
|
|
217
|
+
*/
|
|
218
|
+
async getCostPerHour(podId) {
|
|
219
|
+
const pod = await this.get(podId);
|
|
220
|
+
return pod.costPerHr;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* List available GPU types
|
|
224
|
+
* @returns Promise<GpuType[]>
|
|
225
|
+
*/
|
|
226
|
+
async listGpuTypes() {
|
|
227
|
+
const result = await this.sdk.ListGpuTypes();
|
|
228
|
+
if (!result.gpuTypes) {
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
231
|
+
return result.gpuTypes
|
|
232
|
+
.filter((gpu) => gpu !== null && gpu !== undefined)
|
|
233
|
+
.map((gpu) => ({
|
|
234
|
+
id: gpu.id || '',
|
|
235
|
+
displayName: gpu.displayName || '',
|
|
236
|
+
memoryInGb: gpu.memoryInGb || 0,
|
|
237
|
+
secureCloud: gpu.secureCloud || false,
|
|
238
|
+
communityCloud: gpu.communityCloud || false
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pods/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAKP,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAkB,iBAAiB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEtG,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAkB,iBAAiB,EAAE,cAAc,EAAE,CAAA;AAkCtE,MAAM,OAAO,UAAU;IAIrB,YAAY,MAA2B;QAC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cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,KAAK;SAC5C,CAAC,CAAC,CAAA;IACP,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runpod-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.2",
|
|
4
4
|
"description": "JavaScript SDK for Runpod",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"author": "Runpod",
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"graphql-request": "^7.2.0",
|
|
11
|
+
"graphql-tag": "^2.12.6",
|
|
10
12
|
"ramda": "^0.29.0",
|
|
11
13
|
"xior": "^0.1.4"
|
|
12
14
|
},
|
|
13
15
|
"devDependencies": {
|
|
16
|
+
"@graphql-codegen/add": "^5.0.3",
|
|
17
|
+
"@graphql-codegen/cli": "^5.0.7",
|
|
18
|
+
"@graphql-codegen/schema-ast": "^4.1.0",
|
|
19
|
+
"@graphql-codegen/typescript": "^4.1.6",
|
|
20
|
+
"@graphql-codegen/typescript-graphql-request": "^6.3.0",
|
|
21
|
+
"@graphql-codegen/typescript-operations": "^4.6.1",
|
|
22
|
+
"@graphql-inspector/cli": "^5.0.8",
|
|
14
23
|
"@types/node": "^20.0.0",
|
|
15
24
|
"@types/ramda": "^0.29.7",
|
|
16
25
|
"dotenv": "^16.3.1",
|
|
26
|
+
"graphql": "^16.11.0",
|
|
17
27
|
"typescript": "^5.2.2"
|
|
18
28
|
},
|
|
19
29
|
"scripts": {
|
|
20
|
-
"
|
|
30
|
+
"codegen": "graphql-codegen --config codegen.yml",
|
|
31
|
+
"codegen:watch": "graphql-codegen --config codegen.yml --watch",
|
|
32
|
+
"check:codegen": "npm run codegen && git diff --exit-code -- src/graphql/generated/ || (echo 'Generated files out of date. Run: npm run codegen' && exit 1)",
|
|
33
|
+
"build": "npm run codegen && tsc",
|
|
34
|
+
"dev": "npm run codegen:watch & tsc --watch",
|
|
35
|
+
"test": "echo 'No tests yet'",
|
|
21
36
|
"prepublishOnly": "npm run build"
|
|
22
37
|
}
|
|
23
38
|
}
|