parser

package
v0.0.0-...-298fb37 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GpusFlag

func GpusFlag(val string) (map[string]*resource.Quantity, error)

func TimeLimitToSeconds

func TimeLimitToSeconds(val string) (*int32, error)

TimeLimitToSeconds converts a string to an equivalent time value. If val is empty, it returns nil. If format is invalid, it returns invalidTimeFormatErr.

Possible formats: - "minutes" - "minutes:seconds" - "hours:minutes:seconds" - "days-hours" - "days-hours:minutes" - "days-hours:minutes:seconds" - "INFINITE" - "UNLIMITED" - "-1"

For more details, see https://slurm.schedmd.com/sbatch.html#OPT_time.

Inspired by https://github.com/SchedMD/slurm/blob/9322d01b1aadde28181254499dd0d80638a3df89/src/common/parse_time.c#L731-L784

Types

type ArrayIndexes

type ArrayIndexes struct {
	Indexes     []int32
	Step        *int32
	Parallelism *int32
}

func GenerateArrayIndexes

func GenerateArrayIndexes(count int32) ArrayIndexes

func ParseArrayIndexes

func ParseArrayIndexes(str string) (ArrayIndexes, error)

ParseArrayIndexes parse array flag to ArrayIndexes. Include syntax like:

  • 1-5 - which results in indexes: 1, 2, 3, 4, 5
  • 1,4,5 - which results exactly in the mentioned indexes 1, 4, 5
  • 3-9:3 - with step indicator, which results in 3,6,9
  • 1-5%2 - which results in indexes: 1, 2, 3, 4, 5 but only 2 of them are processed at the same time.

func (ArrayIndexes) Count

func (ai ArrayIndexes) Count() int

func (ArrayIndexes) Max

func (ai ArrayIndexes) Max() int32

func (ArrayIndexes) Min

func (ai ArrayIndexes) Min() int32

type ParsedSlurmFlags

type ParsedSlurmFlags struct {
	Array       string
	CpusPerTask *resource.Quantity
	GpusPerTask map[string]*resource.Quantity
	MemPerNode  *resource.Quantity
	MemPerTask  *resource.Quantity
	MemPerCPU   *resource.Quantity
	MemPerGPU   *resource.Quantity
	Nodes       *int32
	NTasks      *int32
	Output      string
	Error       string
	Input       string
	JobName     string
	Partition   string
	TimeLimit   string
}

func SlurmFlags

func SlurmFlags(script string, ignoreUnknown bool) (ParsedSlurmFlags, error)

Jump to

Keyboard shortcuts

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