File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def get_pod(pod_id: str):
88
88
89
89
def create_pod (
90
90
name : str ,
91
- image_name : str ,
91
+ image_name : Optional [ str ] = "" ,
92
92
gpu_type_id : Optional [str ] = None ,
93
93
cloud_type : str = "ALL" ,
94
94
support_public_ip : bool = True ,
@@ -141,6 +141,10 @@ def create_pod(
141
141
>>> pod_id = runpod.create_pod("test", "runpod/stack", instance_id="cpu3c-2-4")
142
142
"""
143
143
# Input Validation
144
+
145
+ if not image_name and not template_id :
146
+ raise ValueError ("Either image_name or template_id must be provided" )
147
+
144
148
if gpu_type_id is not None :
145
149
get_gpu (gpu_type_id ) # Check if GPU exists, will raise ValueError if not.
146
150
if cloud_type not in ["ALL" , "COMMUNITY" , "SECURE" ]:
Original file line number Diff line number Diff line change @@ -136,6 +136,18 @@ def test_create_pod(self):
136
136
"cloud_type must be one of ALL, COMMUNITY or SECURE" ,
137
137
)
138
138
139
+ with self .assertRaises (ValueError ) as context :
140
+ pod = ctl_commands .create_pod (
141
+ name = "POD_NAME" ,
142
+ gpu_type_id = "NVIDIA A100 80GB PCIe" ,
143
+ network_volume_id = "NETWORK_VOLUME_ID" ,
144
+ )
145
+
146
+ self .assertEqual (
147
+ str (context .exception ),
148
+ "Either image_name or template_id must be provided" ,
149
+ )
150
+
139
151
def test_stop_pod (self ):
140
152
"""
141
153
Test stop_pod
You can’t perform that action at this time.
0 commit comments