compute

package
v0.0.0-...-fc2aea3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSBYOCTemplate

func AWSBYOCTemplate() string

Types

type ManagedMachineBootstrap

type ManagedMachineBootstrap struct {
	MachineID      string
	PoolName       string
	Token          string
	InstallCommand string
}

type Options

type Options struct {
	Config           types.AppConfig
	BackendRepo      repository.BackendRepository
	WorkspaceRepo    repository.WorkspaceRepository
	ContainerRepo    repository.ContainerRepository
	Scheduler        *scheduler.Scheduler
	EventRepo        repository.EventRepository
	WorkerRepo       repository.WorkerRepository
	WorkerPoolRepo   repository.WorkerPoolRepository
	UsageMetricsRepo repository.UsageMetricsRepository
	ComputeRepo      repository.ComputeRepository
	ManagedPoolRepo  repository.ManagedPoolRepository
	KeyEventManager  *common.KeyEventManager
	RedisClient      *common.RedisClient
	Tailscale        *network.Tailscale
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Service

func (*Service) CreateBYOCPool

func (*Service) CreateManagedMachine

func (s *Service) CreateManagedMachine(ctx context.Context, authInfo *auth.AuthInfo, poolName string) (*ManagedMachineBootstrap, error)

func (*Service) CreateManagedPool

func (s *Service) CreateManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string, config types.WorkerPoolConfig) (*model.ManagedPool, error)

func (*Service) CreatePool

func (s *Service) CreatePool(ctx context.Context, in *pb.CreatePoolRequest) (*pb.CreatePoolResponse, error)

func (*Service) CreatePoolJoinToken

func (*Service) DeleteManagedMachine

func (s *Service) DeleteManagedMachine(ctx context.Context, authInfo *auth.AuthInfo, poolName, machineID string) error

func (*Service) DeleteManagedPool

func (s *Service) DeleteManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string) error

func (*Service) DeletePool

func (s *Service) DeletePool(ctx context.Context, in *pb.DeletePoolRequest) (*pb.DeletePoolResponse, error)

func (*Service) DeletePrivateMachine

func (s *Service) DeletePrivateMachine(ctx context.Context, in *pb.DeleteMachineRequest) (*pb.DeleteMachineResponse, error)

func (*Service) ExtendPoolCapacity

func (*Service) FindReadyPrivatePoolForGPU

func (s *Service) FindReadyPrivatePoolForGPU(ctx context.Context, workspaceID string, gpus []types.GpuType) (string, error)

FindReadyPrivatePoolForGPU returns the name of a private pool in the workspace that is configured for one of the requested GPU types and has at least one connected machine. It lets stub creation route "no managed capacity" workloads onto capacity the user already owns.

func (*Service) GetBYOCPool

func (s *Service) GetBYOCPool(ctx context.Context, in *pb.GetBYOCPoolRequest) (*pb.GetBYOCPoolResponse, error)

func (*Service) GetPoolJoinCommand

func (*Service) GetProviderJoinCommand

GetProviderJoinCommand ensures the workspace's provider pool for the GPU type exists and mints a join token for a new machine.

func (*Service) JoinAgent

func (s *Service) JoinAgent(ctx context.Context, in *pb.JoinAgentRequest) (*pb.JoinAgentResponse, error)

func (*Service) LaunchPoolCapacity

func (*Service) ListMachineContainers

ListMachineContainers lists the active containers scheduled on one machine. Works for private and provider pools alike — both are stored under the owning workspace, so providers can see what runs on their hardware.

func (*Service) ListManagedMachines

func (s *Service) ListManagedMachines(ctx context.Context, authInfo *auth.AuthInfo, poolName string) ([]*pb.Machine, error)

func (*Service) ListManagedPools

func (s *Service) ListManagedPools(ctx context.Context, authInfo *auth.AuthInfo) ([]*model.ManagedPool, error)

func (*Service) ListPoolMachines

func (*Service) ListPoolOffers

func (*Service) ListPrivateMachines

func (s *Service) ListPrivateMachines(ctx context.Context, authInfo *auth.AuthInfo, poolName string, limit int) ([]*pb.Machine, error)

ListPrivateMachines lists private and BYOC inventory in one workspace.

func (*Service) ListPrivatePools

func (*Service) ListProviderMachines

ListProviderMachines lists every machine the workspace has contributed, across its provider pools.

func (*Service) MissingPrivatePoolGPUWarning

func (s *Service) MissingPrivatePoolGPUWarning(ctx context.Context, workspaceID string, gpus []types.GpuType) (string, error)

func (*Service) ReconcileManagedCompute

func (s *Service) ReconcileManagedCompute(ctx context.Context) error

func (*Service) ReconcileManagedPools

func (s *Service) ReconcileManagedPools(ctx context.Context) error

ReconcileManagedPools converges this replica's in-memory scheduler with the isolated managed-pool definitions in Redis. The distributed repository lock protects definitions; every replica still performs its own local hydration.

func (*Service) RequestAgentWorkerRestart

func (s *Service) RequestAgentWorkerRestart(ctx context.Context, worker *types.Worker) error

RequestAgentWorkerRestart cordons a worker and changes its desired generation. Reconciliation publishes it after all outstanding work has drained.

func (*Service) ResolveAgentState

func (s *Service) ResolveAgentState(ctx context.Context, token string) (*model.AgentTokenState, error)

ResolveAgentState resolves an agent token to its current machine state.

func (*Service) RevokePoolJoinToken

func (*Service) RotateMachineSSHKey

func (*Service) ScaleBYOCPool

func (*Service) SetAgentWorkerCordon

func (s *Service) SetAgentWorkerCordon(ctx context.Context, worker *types.Worker, cordoned bool) (bool, error)

SetAgentWorkerCordon persists operator intent on every agent-managed machine so a worker TTL expiry or agent reconnect cannot silently undo a cordon.

func (*Service) Start

func (s *Service) Start(ctx context.Context)

func (*Service) StreamAgent

func (*Service) StreamAgentTelemetry

func (s *Service) StreamAgentTelemetry(stream pb.GatewayService_StreamAgentTelemetryServer) error

func (*Service) UpdateAgentSSHStatus

func (*Service) UpdateManagedPool

func (s *Service) UpdateManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string, config types.WorkerPoolConfig) (*model.ManagedPool, error)

func (*Service) ValidatePrivatePoolGPURequest

func (s *Service) ValidatePrivatePoolGPURequest(ctx context.Context, workspaceID, poolName string, gpus []types.GpuType) error

Jump to

Keyboard shortcuts

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