provisioner

package
v0.156.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package provisioner rents on-demand GPU instances running llama.cpp and exposes them as a llamacpp provider endpoint (issue #939). RunPod is the first driver; the surface is plain CRUD on instances.

Index

Constants

View Source
const PodNamePrefix = "infer-"

PodNamePrefix tags every pod created by infer so List can find them.

Variables

This section is empty.

Functions

This section is empty.

Types

type GPUType

type GPUType struct {
	ID             string  `json:"id"`
	DisplayName    string  `json:"displayName"`
	MemoryInGb     int     `json:"memoryInGb"`
	CommunityPrice float64 `json:"communityPrice"`
	SecurePrice    float64 `json:"securePrice"`
}

GPUType is a rentable GPU with live pricing.

type Pod

type Pod struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	Image         string  `json:"image"`
	DesiredStatus string  `json:"desiredStatus"`
	CostPerHr     float64 `json:"costPerHr"`
	LastStartedAt string  `json:"lastStartedAt"`
}

Pod is the subset of RunPod's Pod object the CLI cares about.

func (Pod) ProxyURL

func (p Pod) ProxyURL(port int) string

ProxyURL is the pod's public HTTPS endpoint for the given internal port.

type ProvisionRequest

type ProvisionRequest struct {
	Name      string
	GPUTypeID string
	Image     string
	StartCmd  []string
	CloudType string // COMMUNITY or SECURE
	DiskGB    int
	Env       map[string]string
	Ports     []string
}

ProvisionRequest describes the pod to create.

type RunPod

type RunPod struct {
	APIKey     string
	RestURL    string // default https://rest.runpod.io/v1
	GraphQLURL string // default https://api.runpod.io/graphql
	ProxyBase  string // overrides Pod.ProxyURL in WaitReady; tests only
	Client     *http.Client
	// contains filtered or unexported fields
}

RunPod is the RunPod driver. Base URLs are fields so tests can point at httptest.

func NewRunPod

func NewRunPod(apiKey string) *RunPod

func (*RunPod) Destroy

func (r *RunPod) Destroy(ctx context.Context, id string) error

Destroy terminates a pod; billing stops. CRUD: delete.

func (*RunPod) GPUTypes

func (r *RunPod) GPUTypes(ctx context.Context) ([]GPUType, error)

GPUTypes returns rentable GPU types with live pricing, cheapest first. This is the one non-REST call (RunPod exposes pricing only via GraphQL).

func (*RunPod) List

func (r *RunPod) List(ctx context.Context) ([]Pod, error)

List returns pods created by infer (name-prefix filtered). CRUD: read.

func (*RunPod) Provision

func (r *RunPod) Provision(ctx context.Context, req ProvisionRequest) (Pod, error)

Provision creates a pod. CRUD: create.

func (*RunPod) Status

func (r *RunPod) Status(ctx context.Context, id string) (Pod, error)

Status returns a single pod. CRUD: read.

func (*RunPod) WaitReady

func (r *RunPod) WaitReady(ctx context.Context, id string, port int, report func(string)) (Pod, error)

WaitReady polls the pod, then the llama.cpp /health endpoint through the proxy until the model answers. /health is unauthenticated in llama.cpp, so this needs no per-session token and works for `gpu status --wait` too.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL