genericresource

package
v2.0.0-...-c1c857e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 138

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Claim

func Claim(nodeAvailableResources, taskAssigned *[]*api.GenericResource,
	taskReservations []*api.GenericResource) error

Claim assigns GenericResources to a task by taking them from the node's GenericResource list and storing them in the task's available list

func ClaimResources

func ClaimResources(nodeAvailableResources, taskAssigned *[]*api.GenericResource,
	resSelected []*api.GenericResource)

ClaimResources adds the specified resources to the task's list and removes them from the node's generic resource list

func ConsumeNodeResources

func ConsumeNodeResources(nodeAvailableResources *[]*api.GenericResource, res []*api.GenericResource)

ConsumeNodeResources removes "res" from nodeAvailableResources

func EnvFormat

func EnvFormat(res []*api.GenericResource, prefix string) []string

EnvFormat returns the environment string version of the resource

func GetResource

func GetResource(kind string, resources []*api.GenericResource) []*api.GenericResource

GetResource returns resources from the "resources" parameter matching the kind key

func HasEnough

func HasEnough(nodeRes []*api.GenericResource, taskRes *api.GenericResource) (bool, error)

HasEnough returns true if node can satisfy the task's GenericResource request

func HasResource

func HasResource(res *api.GenericResource, resources []*api.GenericResource) bool

HasResource checks if there is enough "res" in the "resources" argument

func Kind

func Kind(res *api.GenericResource) string

Kind returns the kind key as a string

func NewDiscrete

func NewDiscrete(key string, val int64) *api.GenericResource

NewDiscrete creates a Discrete resource

func NewSet

func NewSet(key string, vals ...string) []*api.GenericResource

NewSet creates a set object

func NewString

func NewString(key, val string) *api.GenericResource

NewString creates a String resource

func Parse

func Parse(cmds []string) ([]*api.GenericResource, error)

Parse parses a table of GenericResource resources

func ParseCmd

func ParseCmd(cmd string) ([]*api.GenericResource, error)

ParseCmd parses the Generic Resource command line argument and returns a list of *api.GenericResource

func Reclaim

func Reclaim(nodeAvailableResources *[]*api.GenericResource, taskAssigned, nodeRes []*api.GenericResource) error

Reclaim adds the resources taken by the task to the node's store

func ValidateTask

func ValidateTask(resources *api.Resources) error

ValidateTask validates that the task only uses integers for generic resources

func Value

func Value(res *api.GenericResource) string

Value returns the value key as a string

Types

This section is empty.

Jump to

Keyboard shortcuts

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