models

package
v0.0.0-...-e62a7ec Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionMeta

type FunctionMeta struct {
	Name                      string
	Replicas                  map[string]*Replica
	ExecEnvironmentPerReplica int
	//Cond variable to signal if someone is waiting for a VM to be created
	//CondLock     *sync.Mutex
	//WaitingForVM *sync.Cond
	//below are fields required to call the fcdaemon grpc
	Image       string
	EnvProcess  string
	Labels      *map[string]string
	Annotations *map[string]string
	EnvVars     map[string]string
	GPUMemReq   uint32
	sync.RWMutex
}

FunctionMeta stores metadata for this serverless function

func (*FunctionMeta) GetMaxReplicaCount

func (m *FunctionMeta) GetMaxReplicaCount() int

GetMaxReplicaCount gets the maximum replica count for this function

func (*FunctionMeta) GetMinReplicaCount

func (m *FunctionMeta) GetMinReplicaCount() int

GetMinReplicaCount gets the minimum replica count for this function

func (*FunctionMeta) ScaleUp

func (m *FunctionMeta) ScaleUp(node *Node, n uint32, rc chan *Replica)

ScaleUp scales up n copy of this function on node

type GPUChosen

type GPUChosen struct {
	AvAReply *mngrinfo.AvAManagerInfoReply
	GPUNode  *GPUNode
	GPUIdx   int
}

GPUChosen contains info of chosen gpu and the node that the gpu is on

type GPUInfo

type GPUInfo struct {
	UUID            string
	Memory          uint32
	FirstWorkerPort uint32
}

GPUInfo contains the info for a GPU

type GPUNode

type GPUNode struct {
	sync.RWMutex
	GPUInfos         []*GPUInfo
	AllocatedGPUResc map[string]*GPUResc
	IP               string
}

GPUNode contains gpu info for a gpu worker machine

type GPUResc

type GPUResc struct {
	AllocatedMem    uint32
	AllocatedWorker []bool
}

type Node

type Node struct {
	sync.RWMutex
	HostIP    string
	NodeID    string
	Conn      *grpc.ClientConn
	Grpc      fcdaemon.FcServiceClient
	TimesUsed uint32
	//dont trust TotalCreated unless you are in loadbalance.go, since it's the only thing that updates this number
	TotalCreated uint32
}

Node contains the ip address of the node

func (*Node) CreateCPUHogs

func (n *Node) CreateCPUHogs(num int32)

CreateCPUHogs ..

func (*Node) RequestCreateReplica

func (n *Node) RequestCreateReplica(req *fcdaemon.CreateRequest) (*fcdaemon.CreateReply, error)

RequestCreateReplica send the CreateRequest rpc and returns the replied ips this is sent to fcdaemon

func (*Node) StopCPUHogs

func (n *Node) StopCPUHogs(num int32)

StopCPUHogs ..

type Replica

type Replica struct {
	Vmid              string
	IP                string
	Function          string
	IdleExecutionEnvs int
	Status            VMStatus
	DeployNode        *Node
}

Replica contains the metadata state of serverless worker

type Resources

type Resources struct {
	NodesLock sync.RWMutex
	Nodes     []*Node //map of available nodes

	GPUMappingLock sync.RWMutex          //protect the GPUChosen entry
	GpuMapping     map[string]*GPUChosen //map between vmid to gpu uuid

	ReplicasLock sync.RWMutex
	Replicas     map[string]*Replica //maps vmid to replica

	FunctionsLock sync.RWMutex
	Functions     map[string]*FunctionMeta //maps function names to function meta

	Bypass          bool
	NumWorkerPerGPU uint32

	GPULock  sync.RWMutex //protect the gpu nodes array
	GPUNodes []*GPUNode   //map of available gpu nodes
}

Resources contains all resources the resource manager manges

type VMStatus

type VMStatus int

VMStatus is an int represents vm status

const (
	VMIdle          VMStatus = 0
	VMAllocated     VMStatus = 1
	VMCreating      VMStatus = 2
	VMDead          VMStatus = 13
	VMStarting      VMStatus = 200
	VMStartingLimit VMStatus = 210
)

Jump to

Keyboard shortcuts

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