localresources

package
v0.0.0-...-bf8e85a Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package localresources ensures locally executed tasks have enough resources to run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TotalRAMMBs

func TotalRAMMBs() int64

TotalRAMMBs returns the amount of system memory in MegaBytes.

Types

type Manager

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

Manager is the manager of local resources.

func NewDefaultManager

func NewDefaultManager() *Manager

NewDefaultManager retrieves a Manager with default local resources.

func NewFractionalDefaultManager

func NewFractionalDefaultManager(fraction float64) *Manager

NewFractionalDefaultManager retrieves a Manager with the given fraction of default local resources.

func NewManager

func NewManager(cpus, ramMBs int64) *Manager

NewManager is used to initialize the manager with non default local resources.

func (*Manager) Lock

func (m *Manager) Lock(ctx context.Context, cpus, ramMBs int64) (func(), error)

Lock locks the desired resources and returns a function to release them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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