slurm

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDurationIsUnlimited means that duration field has value UNLIMITED
	ErrDurationIsUnlimited = errors.New("duration is unlimited")

	// ErrInvalidSacctResponse is returned when trying to parse sacct
	// response that is invalid.
	ErrInvalidSacctResponse = errors.New("unable to parse sacct response")

	// ErrFileNotFound is returned when Open fails to find a file.
	ErrFileNotFound = errors.New("file is not found")
)

Functions

func ParseDuration

func ParseDuration(duration string) (*time.Duration, error)

ParseDuration parses slurm duration string. Possible formats are: minutes, minutes:seconds, hours:minutes:seconds, days-hours, days-hours:minutes or days-hours:minutes:seconds

Types

type Client

type Client struct{}

Client implements Slurm interface for communicating with a local Slurm cluster by calling Slurm binaries directly.

func NewClient

func NewClient() (*Client, error)

NewClient returns new local client.

func (*Client) Open

func (*Client) Open(path string) (io.ReadCloser, error)

Open opens arbitrary file at path in a read-only mode.

func (*Client) Partitions

func (*Client) Partitions() ([]string, error)

Partitions returns a list of partition names.

func (*Client) Resources

func (*Client) Resources(partition string) (*Resources, error)

Resources returns available resources for a partition.

func (*Client) SBatch

func (*Client) SBatch(script, partition string) (int64, error)

SBatch submits batch job and returns job id if succeeded.

func (*Client) SCancel

func (*Client) SCancel(jobID int64) error

SCancel cancels batch job.

func (*Client) SJobInfo

func (*Client) SJobInfo(jobID int64) ([]*JobInfo, error)

SJobInfo returns information about a particular slurm job by ID.

func (*Client) SJobSteps

func (*Client) SJobSteps(jobID int64) ([]*JobStepInfo, error)

SJobSteps returns information about a submitted batch job.

func (*Client) Tail

func (*Client) Tail(path string) (io.ReadCloser, error)

Tail opens arbitrary file at path in a read-only mode. Unlike Open, Tail will watch file changes in a real-time.

type Feature

type Feature struct {
	Name     string
	Version  string
	Quantity int64
}

Feature represents a single feature enabled on a Slurm partition. TODO use it.

type JobInfo

type JobInfo struct {
	ID         string         `json:"id" slurm:"JobId"`
	UserID     string         `json:"user_id" slurm:"UserId"`
	ArrayJobID string         `json:"array_job_id" slurm:"ArrayJobId"`
	Name       string         `json:"name" slurm:"JobName"`
	ExitCode   string         `json:"exit_code" slurm:"ExitCode"`
	State      string         `json:"state" slurm:"JobState"`
	SubmitTime *time.Time     `json:"submit_time" slurm:"SubmitTime"`
	StartTime  *time.Time     `json:"start_time" slurm:"StartTime"`
	RunTime    *time.Duration `json:"run_time" slurm:"RunTime"`
	TimeLimit  *time.Duration `json:"time_limit" slurm:"TimeLimit"`
	WorkDir    string         `json:"work_dir" slurm:"WorkDir"`
	StdOut     string         `json:"std_out" slurm:"StdOut"`
	StdErr     string         `json:"std_err" slurm:"StdErr"`
	Partition  string         `json:"partition" slurm:"Partition"`
	NodeList   string         `json:"node_list" slurm:"NodeList"`
	BatchHost  string         `json:"batch_host" slurm:"BatchHost"`
	NumNodes   string         `json:"num_nodes" slurm:"NumNodes"`
}

JobInfo contains information about a Slurm job.

type JobStepInfo

type JobStepInfo struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	StartedAt  *time.Time `json:"started_at"`
	FinishedAt *time.Time `json:"finished_at"`
	ExitCode   int        `json:"exit_code"`
	State      string     `json:"state"`
}

JobStepInfo contains information about a single Slurm job step.

type Resources

type Resources struct {
	Nodes      int64
	MemPerNode int64
	CPUPerNode int64
	WallTime   time.Duration
	Features   []Feature
}

Resources contain a list of available resources on a Slurm partition.

Jump to

Keyboard shortcuts

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