Skip to content

Commit 958878a

Browse files
committed
refactor: validate image config
1 parent 677bca5 commit 958878a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/codeflare_sdk/cluster/cluster.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ def evaluate_dispatch_priority(self):
128128
print(f"Priority class {priority_class} is not available in the cluster")
129129
return None
130130

131+
def validate_image_config(self):
132+
"""
133+
Validates that the image configuration is not empty.
134+
135+
:param image: The image string to validate
136+
:raises ValueError: If the image is not specified
137+
"""
138+
if self.config.image == "" or self.config.image == None:
139+
raise ValueError("Image must be specified in the ClusterConfiguration")
140+
141+
131142
def create_app_wrapper(self):
132143
"""
133144
Called upon cluster object creation, creates an AppWrapper yaml based on
@@ -142,6 +153,9 @@ def create_app_wrapper(self):
142153
raise TypeError(
143154
f"Namespace {self.config.namespace} is of type {type(self.config.namespace)}. Check your Kubernetes Authentication."
144155
)
156+
157+
# Validate image configuration
158+
self.validate_image_config()
145159

146160
# Before attempting to create the cluster AW, let's evaluate the ClusterConfig
147161
if self.config.dispatch_priority:

0 commit comments

Comments
 (0)