apply

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMigConfig

func ApplyMigConfig(c *Context) error

func ApplyMigConfigWithHooks

func ApplyMigConfigWithHooks(logger *logrus.Logger, context *cli.Context, modeOnly bool, hooks ApplyHooks, applier MigConfigApplier) (rerr error)

ApplyMigConfigWithHooks orchestrates the calls of a 'MigConfigApplier' between a set of 'ApplyHooks' to the set MIG configuration of a node. If 'modeOnly' is 'true', then only the MIG mode settings embedded in the 'Context' are applied.

func ApplyMigMode

func ApplyMigMode(c *Context) error

func BuildCommand

func BuildCommand() *cli.Command

BuildCommand builds the 'apply' subcommand for injection into the main mig-parted CLI.

func CheckFlags

func CheckFlags(f *Flags) error

CheckFlags ensures that any required flags are provided and ensures they are well-formed.

func GetHooksEnvsMap

func GetHooksEnvsMap(c *cli.Context) hooks.EnvsMap

GetHooksEnvsMap builds a 'hooks.EnvsMap' from the set of environment variables set when the CLI was envoked by the user. These environment variables are then made available to all hooks when thex are executed later on.

func GetLogger

func GetLogger() *logrus.Logger

GetLogger returns the 'logrus.Logger' instance used by this package.

func ParseHooksFile

func ParseHooksFile(hooksFile string) (*hooks.Spec, error)

ParseHooksFile parses a hoosk file and unmarshals it into a 'hooks.Spec'.

Types

type ApplyHooks

type ApplyHooks interface {
	ApplyStart(envs hooks.EnvsMap, output bool) error
	PreApplyMode(envs hooks.EnvsMap, output bool) error
	PreApplyConfig(envs hooks.EnvsMap, output bool) error
	ApplyExit(envs hooks.EnvsMap, output bool) error
}

func NewApplyHooks

func NewApplyHooks(hooksMap hooks.HooksMap) ApplyHooks

type Context

type Context struct {
	assert.Context
	Flags *Flags
}

Context holds the state we want to pass around between functions associated with the 'apply' subcommand.

func (*Context) ApplyMigConfig

func (c *Context) ApplyMigConfig() error

ApplyMigConfig applies the full MIG config embedded in the 'Context' to the set of GPUs on the node.

func (*Context) ApplyMigMode

func (c *Context) ApplyMigMode() error

ApplyMigMode applies the MIG mode settings of the config embedded in the 'Context' to the set of GPUs on the node.

func (*Context) AssertMigConfig

func (c *Context) AssertMigConfig() error

AssertMigMode reuses calls from the 'assert' subcommand to ensures that all MIG settings of a given MIG config are currently applied. The 'MigConfig' being checked is embedded in the 'Context' struct itself.

func (*Context) AssertMigMode

func (c *Context) AssertMigMode() error

AssertMigMode reuses calls from the 'assert' subcommand to ensures that the MIG mode settings of a given MIG config are currently applied. The 'MigConfig' being checked is embedded in the 'Context' struct itself.

type Flags

type Flags struct {
	assert.Flags
	HooksFile string
}

Flags holds variables that represent the set of flags that can be passed to the 'apply' subcommand.

type MigConfigApplier

type MigConfigApplier interface {
	AssertMigMode() error
	ApplyMigMode() error
	AssertMigConfig() error
	ApplyMigConfig() error
}

MigConfigApplier is an interface representing the set of functions required to "Apply" a MIG configuration to a node.

Jump to

Keyboard shortcuts

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