v1

package
v0.0.0-...-3e57ee8 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Schema string

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	Duration    string      `yaml:"duration,omitempty" json:"duration,omitempty"`
	Cwd         string      `yaml:"cwd,omitempty" json:"cwd,omitempty"`
	Environment Environment `yaml:"environment,omitempty" json:"environment,omitempty"`
}

type Environment

type Environment map[string]string

type Group

type Group struct {
	Name       string     `json:"name,omitempty" yaml:"name,omitempty"`
	Resources  string     `json:"resources,omitempty" yaml:"resources,omitempty"`
	Tasks      Tasks      `json:"tasks,omitempty" yaml:"tasks,omitempty"`
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

type Groups

type Groups []Group

type Jobspec

type Jobspec struct {
	Version   int               `json:"version" yaml:"version"`
	Name      string            `json:"name,omitempty" yaml:"name,omitempty"`
	Resources Resources         `json:"resources,omitempty" yaml:"resources,omitempty"`
	Tasks     Tasks             `json:"tasks,omitempty" yaml:"tasks,omitempty"`
	Groups    Groups            `json:"groups,omitempty" yaml:"groups,omitempty"`
	Requires  map[string]string `json:"requires,omitempty" yaml:"requires,omitempty"`
}

func LoadJobspecYaml

func LoadJobspecYaml(yamlFile string) (*Jobspec, error)

LoadJobspecYaml loads a jobspec from a yaml file path

func NewSimpleJobspec

func NewSimpleJobspec(name, command string, nodes, tasks int32) (*Jobspec, error)

NewSimpleJobSpec generates a simple jobspec for nodes, command, tasks, and (optionally) a name

func (*Jobspec) GetJobName

func (js *Jobspec) GetJobName() string

Helper function to get a job name, derived from the command

func (*Jobspec) GetScheduledSlots

func (js *Jobspec) GetScheduledSlots() []Resource

GetScheduledSlots returns all slots marked for scheduling If none are marked, we assume they all are

func (*Jobspec) GetSlots

func (js *Jobspec) GetSlots() []Resource

GetSlots returns all slots in resources

func (*Jobspec) JobspecToJson

func (js *Jobspec) JobspecToJson() (string, error)

JobspectoJson convets back to json string

func (*Jobspec) JobspecToYaml

func (js *Jobspec) JobspecToYaml() (string, error)

JobspectoYaml convets back to yaml (as string)

func (*Jobspec) Validate

func (js *Jobspec) Validate() (bool, error)

Validate converts to bytes and validate with jsonschema

type Resource

type Resource struct {
	Type      string     `yaml:"type,omitempty" json:"type,omitempty"`
	Unit      string     `yaml:"unit,omitempty" json:"unit,omitempty"`
	Count     int32      `yaml:"count,omitempty" json:"count,omitempty"`
	With      []Resource `yaml:"with,omitempty" json:"with,omitempty"`
	Label     string     `yaml:"label,omitempty" json:"label,omitempty"`
	Exclusive bool       `yaml:"exclusive,omitempty" json:"exclusive,omitempty"`
	Schedule  bool       `yaml:"schedule,omitempty" json:"schedule,omitempty"`
}

type Resources

type Resources map[string]Resource

type Task

type Task struct {
	Group      string     `json:"group,omitempty" yaml:"group,omitempty"`
	Name       string     `json:"name,omitempty" yaml:"name,omitempty"`
	Replicas   int        `json:"replicas,omitempty" yaml:"replicas,omitempty"`
	Resources  string     `json:"resources,omitempty" yaml:"resources,omitempty"`
	Command    []string   `json:"command,omitempty" yaml:"command,omitempty"`
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

type Tasks

type Tasks []Task

Jump to

Keyboard shortcuts

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