Documentation
¶
Index ¶
- Variables
- func Diff(original, rendered string) string
- func ParseWallTime(v string) (int64, error)
- func Placeholder(name, typ string) string
- func Render(c *Conversion) string
- func ShortFlag(long string) (string, bool)
- type AppliedInput
- type ArrayRange
- type ArraySpec
- type Container
- type Conversion
- type Dependency
- type InputSuggestion
- type JobConfig
- type Option
- type Script
- type Segment
- type SoftwareRequirement
Constants ¶
This section is empty.
Variables ¶
var InputTypes = []string{"STRING", "INTEGER", "FLOAT", "BOOLEAN", "FILE", "FILE_LIST", "DIRECTORY"}
InputTypes are the template input types a run section can reference.
Functions ¶
func ParseWallTime ¶
ParseWallTime converts any sbatch --time form to whole minutes, rounding seconds up.
func Placeholder ¶
Placeholder is the pongo2 expression a run section uses for an input of the given type.
func Render ¶
func Render(c *Conversion) string
Render writes the conversion back out as an sbatch script, in the order Airavata writes directives.
Types ¶
type AppliedInput ¶
type AppliedInput struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description,omitempty"`
Default string `json:"default"`
Occurrences int `json:"occurrences"`
Placeholder string `json:"placeholder"`
Note string `json:"note,omitempty"`
}
func ApplyInputs ¶
func ApplyInputs(c *Conversion, in []InputSuggestion) ([]AppliedInput, error)
ApplyInputs turns hard-coded literals of the original body into template inputs, replacing any earlier application.
type ArrayRange ¶
type ArraySpec ¶
type ArraySpec struct {
Raw string `json:"raw"`
Ranges []ArrayRange `json:"ranges"`
Limit int `json:"limit,omitempty"`
}
ArraySpec is a parsed --array value.
type Conversion ¶
type Conversion struct {
JobConfig JobConfig `json:"jobConfig"`
Partition string `json:"partition,omitempty"`
RunSection string `json:"runSection"`
Shebang string `json:"shebang,omitempty"`
Mapped []Option `json:"mapped"`
Replaced []Option `json:"replaced"`
Unsupported []Option `json:"unsupported"`
Array *ArraySpec `json:"array,omitempty"`
Dependencies []Dependency `json:"dependencies,omitempty"`
Software []SoftwareRequirement `json:"software,omitempty"`
Containers []Container `json:"containers,omitempty"`
Registrable bool `json:"registrable"`
Problems []string `json:"problems,omitempty"`
Notes []string `json:"notes,omitempty"`
// contains filtered or unexported fields
}
func Convert ¶
func Convert(s *Script) *Conversion
Convert maps a parsed script onto the Airavata deployment model.
func (*Conversion) Segments ¶
func (c *Conversion) Segments() []Segment
Segments returns the run section split into literal text and input references.
type Dependency ¶
type Dependency struct {
Type string `json:"type"`
JobIDs []string `json:"jobIds,omitempty"`
AnyOf bool `json:"anyOf,omitempty"`
}
Dependency is one clause of --dependency; AnyOf is set when clauses are joined with '?'.
type InputSuggestion ¶
type JobConfig ¶
type JobConfig struct {
WallTimeMinutes int64 `json:"wallTimeMinutes"`
Allocation string `json:"allocation"`
Cpus *int32 `json:"cpus,omitempty"`
Nodes *int32 `json:"nodes,omitempty"`
Ntasks *int32 `json:"ntasks,omitempty"`
NtasksPerNode *int32 `json:"ntasksPerNode,omitempty"`
CpusPerTask *int32 `json:"cpusPerTask,omitempty"`
Gpus *int32 `json:"gpus,omitempty"`
GpusPerNode *int32 `json:"gpusPerNode,omitempty"`
Mem *string `json:"mem,omitempty"`
MemPerCpu *string `json:"memPerCpu,omitempty"`
MemPerGpu *string `json:"memPerGpu,omitempty"`
CpusPerGpu *string `json:"cpusPerGpu,omitempty"`
Gres *string `json:"gres,omitempty"`
Constraints *string `json:"constraints,omitempty"`
Qos *string `json:"qos,omitempty"`
}
JobConfig mirrors the API's batch job config fields.
type Option ¶
type Option struct {
Name string `json:"name"`
Value string `json:"value,omitempty"`
HasValue bool `json:"hasValue"`
Line int `json:"line"`
Raw string `json:"raw"`
Flag string `json:"flag"`
Unknown bool `json:"unknown,omitempty"`
}
Option is one sbatch directive option, normalised to its long name.
type Script ¶
type Script struct {
Shebang string `json:"shebang,omitempty"`
Options []Option `json:"options"`
Body string `json:"body"`
// Ignored lists lines of #SBATCH directives after the first command, which sbatch ignores.
Ignored []int `json:"ignored,omitempty"`
}
Script is a parsed sbatch script.