Skip to content

Commit a1ae3d2

Browse files
authored
improve env var ux by pre-filtering gpus (#32)
* improve env var ux by pre-filtering gpus
1 parent f2d680d commit a1ae3d2

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "prime-cli"
3-
version = "0.2.9"
3+
version = "0.2.10"
44
description = "Prime Intellect CLI"
55
readme = "README.md"
66
requires-python = ">=3.9"

src/prime_cli/commands/pods.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,27 @@ def create(
320320
):
321321
availabilities = availability_client.get()
322322

323+
if env_vars:
324+
filtered_availabilities = {}
325+
for availability_type, gpus in availabilities.items():
326+
filtered_gpus = []
327+
for gpu in gpus:
328+
if gpu.provider == "runpod":
329+
continue
330+
if gpu.images:
331+
# Filter out ubuntu image
332+
filtered_images = [
333+
img for img in gpu.images if img != "ubuntu_22_cuda_12"
334+
]
335+
if len(filtered_images) > 0:
336+
gpu.images = filtered_images
337+
filtered_gpus.append(gpu)
338+
339+
if filtered_gpus:
340+
filtered_availabilities[availability_type] = filtered_gpus
341+
342+
availabilities = filtered_availabilities
343+
323344
if id or cloud_id:
324345
# Find the matching GPU configuration by ID or cloud_id
325346
for gpu_type_key, gpus in availabilities.items():
@@ -566,26 +587,28 @@ def select_provider_from_configs(
566587
)
567588
raise typer.Exit(1)
568589

569-
if not image and selected_gpu.images:
570-
if len(selected_gpu.images) == 1:
590+
available_images = selected_gpu.images
591+
592+
if not image and available_images:
593+
if len(available_images) == 1:
571594
# If only one image available, use it directly
572-
image = selected_gpu.images[0]
595+
image = available_images[0]
573596
else:
574597
# Show available images
575598
console.print("\n[bold]Available Images:[/bold]")
576-
for idx, img in enumerate(selected_gpu.images):
599+
for idx, img in enumerate(available_images):
577600
console.print(f"{idx + 1}. {img}")
578601

579602
# Prompt for image selection
580603
image_idx = typer.prompt(
581604
"Select image number", type=int, default=1, show_default=False
582605
)
583606

584-
if image_idx < 1 or image_idx > len(selected_gpu.images):
607+
if image_idx < 1 or image_idx > len(available_images):
585608
console.print("[red]Invalid image selection[/red]")
586609
raise typer.Exit(1)
587610

588-
image = selected_gpu.images[image_idx - 1]
611+
image = available_images[image_idx - 1]
589612

590613
# Get team ID from config if not provided
591614
if not team_id:

0 commit comments

Comments
 (0)