Skip to content

Commit 40f8a98

Browse files
committed
change to 3.2.4, updated depl create
1 parent 2896fa0 commit 40f8a98

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

centml/cli/cluster.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -195,55 +195,60 @@ def create():
195195
)
196196
depl_type = depl_name_to_type_map[dtype_str]
197197

198-
# Select cluster
198+
# Select cluster using a numbered list
199199
clusters = cclient.get_clusters().results
200200
if not clusters:
201201
click.echo("No clusters available. Please ensure you have a cluster setup.")
202202
return
203-
cluster_names = [c.display_name for c in clusters]
204-
cluster_name = click.prompt(
205-
"Select a cluster", type=click.Choice(cluster_names), show_choices=True, default=cluster_names[0]
206-
)
207-
cluster_id = next(c.id for c in clusters if c.display_name == cluster_name)
208203

209-
# Hardware selection
204+
click.echo("Available clusters:")
205+
for idx, cluster in enumerate(clusters, start=1):
206+
click.echo(f"{idx}. {cluster.display_name}")
207+
cluster_choice = click.prompt("Select a cluster by number", type=int, default=1)
208+
selected_cluster = clusters[cluster_choice - 1]
209+
cluster_id = selected_cluster.id
210+
211+
# Hardware selection using a numbered list
210212
hw_resp = cclient.get_hardware_instances(cluster_id)
211213
if not hw_resp:
212214
click.echo("No hardware instances available for this cluster.")
213215
return
214-
hw_names = [h.name for h in hw_resp]
215-
hw_name = click.prompt(
216-
"Select a hardware instance", type=click.Choice(hw_names), show_choices=True, default=hw_names[0]
217-
)
218-
hw_id = next(h.id for h in hw_resp if h.name == hw_name)
216+
217+
click.echo("Available hardware instances:")
218+
for idx, hw in enumerate(hw_resp, start=1):
219+
click.echo(f"{idx}. {hw.name}")
220+
hw_choice = click.prompt("Select a hardware instance by number", type=int, default=1)
221+
selected_hw = hw_resp[hw_choice - 1]
222+
hw_id = selected_hw.id
219223

220224
if depl_type == DeploymentType.INFERENCE_V2:
221225
# Retrieve prebuilt images for inference deployments
222226
prebuilt_images = cclient.get_prebuilt_images(depl_type=depl_type)
223-
image_choices = [img.image_name for img in prebuilt_images.results] if prebuilt_images.results else []
227+
# Build list of image labels
228+
image_choices = [img.label for img in prebuilt_images.results] if prebuilt_images.results else []
224229
image_choices.append("Other")
225230

226-
chosen_image = click.prompt(
227-
"Select a prebuilt image or choose 'Other' to provide a custom image URL",
231+
chosen_label = click.prompt(
232+
"Select a prebuilt image label or choose 'Other' to provide a custom image URL",
228233
type=click.Choice(image_choices),
229234
show_choices=True,
230235
default=image_choices[0],
231236
)
232237

233-
if chosen_image == "Other":
238+
if chosen_label == "Other":
234239
image = click.prompt("Enter the custom image URL")
235240
port = click.prompt("Enter the container port for the image", default=8080, type=int)
236241
healthcheck = click.prompt(
237242
"Enter healthcheck endpoint (default '/') for the image", default="/", show_default=True
238243
)
239244
else:
240-
# Find the selected prebuilt image details
241-
selected_prebuilt = next(img for img in prebuilt_images.results if img.image_name == chosen_image)
242-
image = selected_prebuilt.image_name
243-
# Use the prebuilt image port and healthcheck as defaults
245+
# Find the prebuilt image with the matching label
246+
selected_prebuilt = next(img for img in prebuilt_images.results if img.label == chosen_label)
247+
image = selected_prebuilt.image_name # Use the image_name from the selected prebuilt image
244248
port = selected_prebuilt.port
245249
healthcheck = selected_prebuilt.healthcheck if selected_prebuilt.healthcheck else "/"
246250

251+
247252
env_vars_str = click.prompt(
248253
"Enter environment variables in KEY=VALUE format (comma separated) or leave blank",
249254
default="",
@@ -255,6 +260,12 @@ def create():
255260
k, v = kv.strip().split("=")
256261
env_vars[k] = v
257262

263+
# Prompt for command and command arguments (optional)
264+
command_str = click.prompt("Enter command (space-separated) or leave blank", default="", show_default=False)
265+
command = command_str.split() if command_str.strip() else []
266+
command_args_str = click.prompt("Enter command arguments (space-separated) or leave blank", default="", show_default=False)
267+
command_args = command_args_str.split() if command_args_str.strip() else []
268+
258269
# Common fields
259270
min_scale = click.prompt("Minimum number of replicas", default=1, type=int)
260271
max_scale = click.prompt("Maximum number of replicas", default=1, type=int)
@@ -275,7 +286,10 @@ def create():
275286
max_scale=max_scale,
276287
concurrency=concurrency,
277288
env_vars=env_vars if env_vars else None,
289+
command=command,
290+
command_args=command_args,
278291
)
292+
print(req)
279293
created = cclient.create_inference(req)
280294
click.echo(f"Inference deployment {name} created with ID: {created.id}")
281295

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
setup(
1313
name='centml',
14-
version='3.1.15',
14+
version='3.2.4',
1515
packages=find_packages(),
1616
python_requires="<3.12",
1717
long_description=open('README.md').read(),

0 commit comments

Comments
 (0)