@@ -224,9 +224,12 @@ def create():
224224 if depl_type == DeploymentType .INFERENCE_V2 :
225225 # Retrieve prebuilt images for inference deployments
226226 prebuilt_images = cclient .get_prebuilt_images (depl_type = depl_type )
227+
227228 # Build list of image labels
228229 image_choices = [img .label for img in prebuilt_images .results ] if prebuilt_images .results else []
229- image_choices .append ("Other" )
230+
231+ # Right now we disable this other option to get a MVP out quickly.
232+ #image_choices.append("Other")
230233
231234 chosen_label = click .prompt (
232235 "Select a prebuilt image label or choose 'Other' to provide a custom image URL" ,
@@ -244,7 +247,15 @@ def create():
244247 else :
245248 # Find the prebuilt image with the matching label
246249 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
250+ # Prompt the user to select a tag from the available tags
251+ tag = click .prompt (
252+ "Select a tag for the image" ,
253+ type = click .Choice (selected_prebuilt .tags ),
254+ show_choices = True ,
255+ default = selected_prebuilt .tags [0 ],
256+ )
257+ # Combine the image URL with the chosen tag
258+ image = f"{ selected_prebuilt .image_name } :{ tag } "
248259 port = selected_prebuilt .port
249260 healthcheck = selected_prebuilt .healthcheck if selected_prebuilt .healthcheck else "/"
250261
@@ -290,35 +301,54 @@ def create():
290301 env_vars = env_vars if env_vars else None ,
291302 command = command ,
292303 )
293- print ( req )
304+
294305 created = cclient .create_inference (req )
295306 click .echo (f"Inference deployment { name } created with ID: { created .id } " )
296307
297308 elif depl_type == DeploymentType .COMPUTE_V2 :
298- # Retrieve prebuilt images for inference deployments
309+ # Retrieve prebuilt images for compute deployments
299310 prebuilt_images = cclient .get_prebuilt_images (depl_type = depl_type )
300- image_choices = [img .image_name for img in prebuilt_images .results ] if prebuilt_images .results else []
311+ # Build list of image labels
312+ image_choices = [img .label for img in prebuilt_images .results ] if prebuilt_images .results else []
301313
302- # Right now we don't support custom compute images
303- # TODO: add image tags to the url, right now its required by compute but not inference
304- chosen_image = click .prompt (
305- "Select a prebuilt image" , type = click .Choice (image_choices ), show_choices = True , default = image_choices [0 ]
314+ chosen_label = click .prompt (
315+ "Select a prebuilt image label" ,
316+ type = click .Choice (image_choices ),
317+ show_choices = True ,
318+ default = image_choices [0 ],
319+ )
320+
321+ selected_prebuilt = next (img for img in prebuilt_images .results if img .label == chosen_label )
322+
323+ # Find the prebuilt image with the matching label
324+ selected_prebuilt = next (img for img in prebuilt_images .results if img .label == chosen_label )
325+ # Prompt the user to select a tag from the available tags
326+ tag = click .prompt (
327+ "Select a tag for the image" ,
328+ type = click .Choice (selected_prebuilt .tags ),
329+ show_choices = True ,
330+ default = selected_prebuilt .tags [0 ],
306331 )
332+ # Combine the image URL with the chosen tag
333+ image_url = f"{ selected_prebuilt .image_name } :{ tag } "
307334
308335 # For compute deployments, we might ask for a public SSH key
309- ssh_key = click .prompt ("Enter your public SSH key" , default = "" , show_default = False )
310- # jupyter = click.prompt("Enable Jupyter Notebook on this compute deployment?",
311- # default="n", show_default=False)
336+ ssh_key = click .prompt ("Enter your public SSH key" )
337+
338+ # Right now we not support this on prod platform, just unify the feature
339+ #jupyter = click.prompt("Enable Jupyter Notebook on this compute deployment?", type=bool,default=False, show_default=False)
312340
313341 from platform_api_python_client import CreateComputeDeploymentRequest
314342
315343 req = CreateComputeDeploymentRequest (
316344 name = name ,
317345 cluster_id = cluster_id ,
318346 hardware_instance_id = hw_id ,
319- image_url = chosen_image ,
320- ssh_public_key = ssh_key if ssh_key .strip () else None ,
321- )
347+ image_url = image_url ,
348+ ssh_public_key = ssh_key , # we require this
349+ #enable_jupyter=jupyter,
350+ )
351+
322352 created = cclient .create_compute (req )
323353 click .echo (f"Compute deployment { name } created with ID: { created .id } " )
324354
0 commit comments