storage

package
v0.0.0-...-958ef34 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

* Copyright (c) 2023 Juice Technologies, Inc. All Rights Reserved.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("object not found")
)

Functions

func TotalVram

func TotalVram(gpus []restapi.Gpu) uint64

func TotalVramRequired

func TotalVramRequired(requirements restapi.SessionRequirements) uint64

Types

type AggregatedData

type AggregatedData struct {
	Agents                   int
	AgentsByStatus           map[string]int
	Sessions                 int
	SessionsByStatus         map[string]int
	Gpus                     int
	GpusByGpuName            map[string]int
	Vram                     uint64
	VramByGpuName            map[string]uint64
	VramUsed                 uint64
	VramUsedByGpuName        map[string]uint64
	VramGBAvailable          Percentile[int]            // Nearest-Rank Method
	VramGBAvailableByGpuName map[string]Percentile[int] // Nearest-Rank Method
	Utilization              float64
	UtilizationByGpuName     map[string]float64
	PowerDraw                float64
	PowerDrawByGpuName       map[string]float64
}

type DefaultIterator

type DefaultIterator[T any] struct {
	// contains filtered or unexported fields
}

func NewDefaultIterator

func NewDefaultIterator[T any](objects []T) *DefaultIterator[T]

func (*DefaultIterator[T]) Next

func (iterator *DefaultIterator[T]) Next() bool

func (*DefaultIterator[T]) Value

func (iterator *DefaultIterator[T]) Value() T

type Iterator

type Iterator[T any] interface {
	Next() bool
	Value() T
}

type Percentile

type Percentile[T any] struct {
	P100 T
	P90  T
	P75  T
	P50  T
	P25  T
	P10  T
}

type QueuedSession

type QueuedSession struct {
	Id           string
	Requirements restapi.SessionRequirements
}

type Storage

type Storage interface {
	Close() error

	AggregateData() (AggregatedData, error)

	RegisterAgent(agent restapi.Agent) (string, error)
	GetAgentById(id string) (restapi.Agent, error)
	UpdateAgent(update restapi.AgentUpdate) error

	RequestSession(requirements restapi.SessionRequirements) (string, error)
	AssignSession(sessionId string, agentId string, gpus []restapi.SessionGpu) error
	CancelSession(sessionId string) error
	GetSessionById(id string) (restapi.Session, error)
	GetQueuedSessionById(id string) (QueuedSession, error) // For Testing

	GetAgents(poolId string) (Iterator[restapi.Agent], error)
	GetAvailableAgentsMatching(totalAvailableVramAtLeast uint64) (Iterator[restapi.Agent], error)
	GetQueuedSessionsIterator() (Iterator[QueuedSession], error)

	SetAgentsMissingIfNotUpdatedFor(duration time.Duration) error
	RemoveMissingAgentsIfNotUpdatedFor(duration time.Duration) error

	CreatePool(name string) (restapi.Pool, error)
	GetPool(id string) (restapi.Pool, error)
	GetPoolPermissions(id string) (restapi.PoolPermissions, error)
	DeletePool(id string) error
	RemovePermission(poolId string, userId string, permission restapi.Permission) error
	AddPermission(poolId string, userId string, permission restapi.Permission) error
	GetPermissions(userId string) (restapi.UserPermissions, error)
}

Directories

Path Synopsis
* Copyright (c) 2023 Juice Technologies, Inc.
* Copyright (c) 2023 Juice Technologies, Inc.
* Copyright (c) 2023 Juice Technologies, Inc.
* Copyright (c) 2023 Juice Technologies, Inc.

Jump to

Keyboard shortcuts

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