-
Notifications
You must be signed in to change notification settings - Fork 21
Add brev find instance-type command with filtering and sorting #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Implement new CLI command 'brev find instance-type' with comprehensive filtering options - Add support for filtering by GPU type, count, VRAM, provider, price, capabilities, RAM, and CPU - Query public API at https://api.brev.dev/v1/instance/types for instance data - Sort results by hourly price in ascending order - Display results in formatted table with instance type, provider, GPUs, memory, VCPUs, price, and capabilities - Add GetInstanceTypes method to NoAuthHTTPStore for API integration - Support all requested flag combinations for flexible instance discovery Co-Authored-By: Alec Fong <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Lets change --min-node-vram to mean the number of gpus * gpu vram. --min-gpu-vram is the per gpu vram. I think Node vram deserves its own column too. |
…dd Node VRAM column - Rename --min-total-vram flag to --min-node-vram for clarity - Add Node VRAM column to table display showing total VRAM across all GPUs - Update FilterOptions struct to use MinNodeVRAM field - Rename hasMinTotalVRAM function to hasMinNodeVRAM - Add formatNodeVRAM function to calculate total VRAM per instance - Update command examples to use new flag name - Maintain existing --min-gpu-vram functionality for per-GPU filtering Co-Authored-By: Alec Fong <[email protected]>
- Change displayInstanceTypesTable parameter from 't' to '_' to indicate unused - Break down matchesFilters function into smaller functions to reduce complexity: - matchesGPUFilters: handles GPU-related filtering - matchesResourceFilters: handles provider, price, RAM, CPU filtering - matchesCapabilityFilters: handles capability filtering This addresses the CI lint failures while maintaining all existing functionality. Co-Authored-By: Alec Fong <[email protected]>
|
Lets also add a column to the list to show the root disk. If it is static, then should be a scalar value but if it can be a range lets show the min and max it can be. You can choose the cheapest disk price. Lets also show the disk price per TB if available. |
- Remove trailing whitespace - Align struct field formatting for InstanceType - Address CI lint failures for lines 224, 234, and 240 Co-Authored-By: Alec Fong <[email protected]>
- Add Count field to Storage struct for Crusoe compatibility - Add Root Disk column to instance types table - Implement formatRootDisk function to show disk size and cheapest price per TB - Handle both fixed sizes (Crusoe) and ranges (AWS/GCP) - Calculate and display price per TB from hourly GB pricing Addresses GitHub comment feedback on PR #248 Co-Authored-By: Alec Fong <[email protected]>
The --min-disk flag was actually working correctly but had debug output that needed to be removed. The implementation properly: - Parses disk size strings (e.g., '1TB', '500GB') to GB values - Checks all storage options for each instance type - Handles both fixed sizes (Crusoe) and ranges (AWS/GCP) - Uses MaxSize for range-based storage when Size is '0B' - Returns true if any storage option meets the minimum requirement Testing confirms the flag now filters instances correctly based on minimum disk size requirements across all providers. Addresses user feedback on --min-disk flag not working. Co-Authored-By: Alec Fong <[email protected]>
Co-Authored-By: Alec Fong <[email protected]>
Addresses gocritic ifElseChain rule violation in formatRootDisk function by converting the conditional logic to use a switch statement with cases. Maintains the same functionality while satisfying the linter requirements. Co-Authored-By: Alec Fong <[email protected]>
Add
brev find instance-typecommand with filtering and Root Disk columnSummary
Implements a new CLI command
brev find instance-typethat queries the Brev API (https://api.brev.dev/v1/instance/types) to help users find suitable instance types based on various criteria. The command supports filtering by GPU type, count, VRAM, memory, CPU, price, provider, and capabilities, then displays results in a sorted table format.Key features:
--gpu,--min-gpu-count,--min-node-vram,--min-gpu-vram,--min-ram,--min-cpu,--max-hourly-price,--provider,--capabilities, and--min-diskThe implementation addresses PR feedback by renaming
--min-total-vramto--min-node-vramand adding both "Node VRAM" and "Root Disk" columns to the output.Review & Testing Checklist for Human
parseMemoryToGBcorrectly converts all unitsRecommended test plan:
Diagram
%%{ init : { "theme" : "default" }}%% graph TD cmd["pkg/cmd/cmd.go<br/>(Register find command)"]:::minor-edit find["pkg/cmd/find/find.go<br/>(Main implementation)"]:::major-edit http["pkg/store/http.go<br/>(API client & structs)"]:::major-edit api["api.brev.dev/v1/instance/types<br/>(External API)"]:::context cmd -->|"imports & registers"| find find -->|"calls GetInstanceTypes()"| http http -->|"HTTP request"| api api -->|"JSON response"| http http -->|"parsed structs"| find find -->|"filtered & sorted table"| user["CLI Output"]:::context subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
parseMemoryToGBfunction handles various units (B, KB, MB, GB, TB, with/without 'i' suffix). Unit conversion bugs are common in this type of logic.Session details: