resources

package
v0.0.0-...-598a827 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocRequest

type AllocRequest struct {
	MaxCPU      uint
	MaxMem      uint64
	MaxGPU      uint // GPUs are allocated using slots which approximate their throughput
	MaxGPUMem   uint64
	MaxGPUCount int
	MaxDisk     uint64
	GPUUnits    []int // Acceptable GPU slot counts when overshooting the allocation
}

AllocRequest is used by clients to make requests for specific types of machine resources

func (*AllocRequest) Logable

func (rqst *AllocRequest) Logable() (logable []interface{})

type Allocated

type Allocated struct {
	GPU  cuda.GPUAllocations
	CPU  *cpu_resource.CPUAllocated
	Disk *disk_resource.DiskAllocated
}

Allocated gathers together data for allocations of machine level resources into a single data structure that can be used to track resource allocations for tasks

func (*Allocated) Logable

func (alloc *Allocated) Logable() (logable []interface{})

func (*Allocated) Release

func (a *Allocated) Release() (errs []kv.Error)

Release returns any allocated resources to the sub system from which they were obtained

type Resources

type Resources struct{}

Resources is a receiver for resource related methods used to describe execution requirements

func NewResources

func NewResources(localDisk string) (rsc *Resources, err kv.Error)

NewResources is used to get a receiver for dealing with the resources being tracked by the studioml runner

func (*Resources) Alloc

func (*Resources) Alloc(rqst AllocRequest, live bool) (alloc *Allocated, err kv.Error)

Alloc will go through all requested resources and allocate them using the resource APIs.

If any single resource be not available then the ones done so far will be released. The use of a receiver pointer is to make sure that the caller invokes the NewResources to populate some of the allocators with the context they require to track consumption of some types of resources, such as selecting the disk from which allocations will be performed.

The caller is responsible for calling the release method when the resources are no longer needed.

The live parameter can be used to controller whether the allocation attempts will perform an allocation (true), or whether they will simply test (false) that the allocation would have been completed successfully.

func (*Resources) FetchMachineResources

func (*Resources) FetchMachineResources() (rsc *server.Resource)

FetchMachineResources extracts the current system state in terms of memory etc and coverts this into the resource specification used by jobs. Because resources specified by users are not exact quantities the resource is used for the machines resources even in the face of some loss of precision

Jump to

Keyboard shortcuts

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