Documentation
¶
Overview ¶
Package gpusearch provides a command to search and filter GPU instance types
Index ¶
- func DisplayCPUResults(t *terminal.Terminal, instances []GPUInstanceInfo, jsonOutput, piped bool) error
- func DisplayGPUResults(t *terminal.Terminal, instances []GPUInstanceInfo, ...) error
- func IsStdoutPiped() bool
- func NewCmdGPUSearch(t *terminal.Terminal, store GPUSearchStore) *cobra.Command
- func RunCPUSearch(t *terminal.Terminal, store GPUSearchStore, provider, arch string, ...) error
- func RunGPUSearch(t *terminal.Terminal, store GPUSearchStore, gpuName, provider, arch string, ...) error
- func SortInstances(instances []GPUInstanceInfo, sortBy string, descending bool)
- type AllInstanceTypesResponse
- type BasePrice
- type FilterOptions
- type GPU
- type GPUInstanceInfo
- type GPUSearchStore
- type InstanceType
- type InstanceTypesResponse
- type MemoryBytes
- type Storage
- type WorkspaceGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayCPUResults ¶
func DisplayCPUResults(t *terminal.Terminal, instances []GPUInstanceInfo, jsonOutput, piped bool) error
DisplayCPUResults renders CPU instances in the appropriate format
func DisplayGPUResults ¶
func DisplayGPUResults(t *terminal.Terminal, instances []GPUInstanceInfo, jsonOutput, piped, wide bool) error
DisplayGPUResults renders GPU instances in the appropriate format
func IsStdoutPiped ¶
func IsStdoutPiped() bool
IsStdoutPiped returns true if stdout is being piped (not a terminal)
func NewCmdGPUSearch ¶
func NewCmdGPUSearch(t *terminal.Terminal, store GPUSearchStore) *cobra.Command
NewCmdGPUSearch creates the search command with gpu and cpu subcommands
func RunCPUSearch ¶
func RunCPUSearch(t *terminal.Terminal, store GPUSearchStore, provider, arch string, minRAM, minDisk float64, minVCPU, maxBootTime int, stoppable, rebootable, flexPorts bool, sortBy string, descending, jsonOutput bool) error
RunCPUSearch executes the CPU search with filters and sorting
func RunGPUSearch ¶
func RunGPUSearch(t *terminal.Terminal, store GPUSearchStore, gpuName, provider, arch string, minVRAM, minTotalVRAM, minCapability, minRAM, minDisk float64, minVCPU, maxBootTime int, stoppable, rebootable, flexPorts bool, sortBy string, descending, jsonOutput, wide bool) error
RunGPUSearch executes the GPU search with filters and sorting
func SortInstances ¶
func SortInstances(instances []GPUInstanceInfo, sortBy string, descending bool)
SortInstances sorts the instance list by the specified column
Types ¶
type AllInstanceTypesResponse ¶
type AllInstanceTypesResponse struct {
AllInstanceTypes []InstanceType `json:"allInstanceTypes"`
}
AllInstanceTypesResponse represents the authenticated API response with workspace groups
func (*AllInstanceTypesResponse) GetWorkspaceGroupID ¶
func (r *AllInstanceTypesResponse) GetWorkspaceGroupID(instanceType string) string
GetWorkspaceGroupID returns the workspace group ID for an instance type, or empty string if not found
type FilterOptions ¶
type FilterOptions struct {
GPUName string
Provider string
Arch string
MinVRAM float64
MinTotalVRAM float64
MinCapability float64
MinRAM float64
MinDisk float64
MinVCPU int
MaxBootTime int // in minutes
Stoppable bool
Rebootable bool
FlexPorts bool
}
FilterOptions holds all filter criteria for instances
type GPU ¶
type GPU struct {
Count int `json:"count"`
Name string `json:"name"`
Manufacturer string `json:"manufacturer"`
Memory string `json:"memory"`
MemoryBytes MemoryBytes `json:"memory_bytes"`
}
GPU represents a GPU configuration within an instance type
type GPUInstanceInfo ¶
type GPUInstanceInfo struct {
Type string `json:"type"`
Cloud string `json:"cloud"` // Underlying cloud (e.g., hyperstack, aws, gcp)
Provider string `json:"provider"` // Provider/aggregator (e.g., shadeform, aws, gcp)
GPUName string `json:"gpu_name"`
GPUCount int `json:"gpu_count"`
VRAMPerGPU float64 `json:"vram_per_gpu_gb"`
TotalVRAM float64 `json:"total_vram_gb"`
Capability float64 `json:"capability"`
VCPUs int `json:"vcpus"`
Memory string `json:"memory"`
RAMInGB float64 `json:"ram_gb"`
Arch string `json:"arch"`
DiskMin float64 `json:"disk_min_gb"`
DiskMax float64 `json:"disk_max_gb"`
DiskPricePerMo float64 `json:"disk_price_per_gb_mo,omitempty"` // $/GB/month for flexible storage
BootTime int `json:"boot_time_seconds"`
Stoppable bool `json:"stoppable"`
Rebootable bool `json:"rebootable"`
FlexPorts bool `json:"flex_ports"`
TargetDisk float64 `json:"target_disk_gb,omitempty"`
PricePerHour float64 `json:"price_per_hour"`
Manufacturer string `json:"-"` // exclude from JSON output
}
GPUInstanceInfo holds processed GPU instance information for display
func FilterCPUInstances ¶
func FilterCPUInstances(instances []GPUInstanceInfo, provider, arch string, minRAM, minDisk float64, minVCPU, maxBootTime int, stoppable, rebootable, flexPorts bool) []GPUInstanceInfo
FilterCPUInstances filters to CPU-only instances using shared filter logic
func FilterInstances ¶
func FilterInstances(instances []GPUInstanceInfo, gpuName, provider, arch string, minVRAM, minTotalVRAM, minCapability, minRAM, minDisk float64, minVCPU, maxBootTime int, stoppable, rebootable, flexPorts, gpuOnly bool) []GPUInstanceInfo
FilterInstances applies all filters to the instance list. When gpuOnly is true, CPU-only instances are excluded.
func ProcessInstances ¶
func ProcessInstances(items []InstanceType) []GPUInstanceInfo
ProcessInstances converts raw instance types to GPUInstanceInfo
type GPUSearchStore ¶
type GPUSearchStore interface {
GetInstanceTypes(includeCPU bool) (*InstanceTypesResponse, error)
}
GPUSearchStore defines the interface for fetching instance types
type InstanceType ¶
type InstanceType struct {
Type string `json:"type"`
SupportedGPUs []GPU `json:"supported_gpus"`
SupportedStorage []Storage `json:"supported_storage"`
SupportedArchitectures []string `json:"supported_architectures"`
Memory string `json:"memory"`
InstanceMemoryBytes MemoryBytes `json:"memory_bytes"`
VCPU int `json:"vcpu"`
BasePrice BasePrice `json:"base_price"`
Location string `json:"location"`
SubLocation string `json:"sub_location"`
AvailableLocations []string `json:"available_locations"`
Provider string `json:"provider"`
WorkspaceGroups []WorkspaceGroup `json:"workspace_groups"`
EstimatedDeployTime string `json:"estimated_deploy_time"`
Stoppable bool `json:"stoppable"`
Rebootable bool `json:"rebootable"`
CanModifyFirewallRules bool `json:"can_modify_firewall_rules"`
}
InstanceType represents an instance type from the API
type InstanceTypesResponse ¶
type InstanceTypesResponse struct {
Items []InstanceType `json:"items"`
}
InstanceTypesResponse represents the API response
type MemoryBytes ¶
MemoryBytes represents the memory size with value and unit
type Storage ¶
type Storage struct {
Count int `json:"count"`
Size string `json:"size"`
Type string `json:"type"`
MinSize string `json:"min_size"`
MaxSize string `json:"max_size"`
SizeBytes MemoryBytes `json:"size_bytes"`
PricePerGBHr BasePrice `json:"price_per_gb_hr"` // Uses BasePrice since API returns {currency, amount}
}
Storage represents a storage configuration within an instance type
type WorkspaceGroup ¶
type WorkspaceGroup struct {
ID string `json:"id"`
Name string `json:"name"`
PlatformType string `json:"platformType"`
}
WorkspaceGroup represents a workspace group that can run an instance type