slurmcli

package
v0.3.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

slurmcli

slurmcli is a JobTracker implementation for slurm using the slurm command line interface.

Note that this is experimental. Contributions welcome. Especially it would be great if someone would provide an implementation using the slurm API.

Mapping

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCLI

func CheckCLI(slurm *Slurm) error

CheckCLI tests of all commmand line applications can be called.

Types

type Slurm

type Slurm struct {
	// contains filtered or unexported fields
}

Slurm is a wrapper for the slurm CLI tools.

func NewSlurm

func NewSlurm(sbatch, squeue, scontrol, scancel, sacct string, suspendBySignal bool) *Slurm

NewSlurm creates a new wrapper for slurm CLI tools. It uses the given command line tools for the calls.

func (*Slurm) ListJobs

func (s *Slurm) ListJobs(account, states string) ([]string, error)

ListJobs returns all jobs for a given account in a given state.

func (*Slurm) Resume

func (s *Slurm) Resume(account, jobid string) error

Resume sends either a SIGCONT signal to a job or re-claims the jobs resources (admin rights required).

func (*Slurm) State

func (s *Slurm) State(account, jobid string) drmaa2interface.JobState

State return the state of a given job.

func (*Slurm) SubmitJob

func (s *Slurm) SubmitJob(account string, jt drmaa2interface.JobTemplate) (string, error)

SubmitJob converts the job template into job submission options and submits a job with sbatch.

func (*Slurm) SubmitJobArray

func (s *Slurm) SubmitJobArray(account string, jt drmaa2interface.JobTemplate, start, end, step, maxParallel int) (string, error)

SubmitJobArray converts a job template into job submission options and submits an job array (like sbatch --array=1-7:2).

func (*Slurm) Suspend

func (s *Slurm) Suspend(account, jobid string) error

Suspend sends either a SIGTSTP signal to a job or releases the jobs resources (admin rights required).

func (*Slurm) Terminate

func (s *Slurm) Terminate(account, jobid string) error

Terminate stops a job from execution.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker implements the JobTracker interface by calling the slurm command line.

func New

func New(jobsession string, slurmCLI *Slurm) (*Tracker, error)

New creates a new Tracker for slurm jobs using the given command line apps.

func (*Tracker) AddArrayJob

func (t *Tracker) AddArrayJob(jt drmaa2interface.JobTemplate, begin, end, step, maxParallel int) (string, error)

AddArrayJob creates a slurm job array.

func (*Tracker) AddJob

func (t *Tracker) AddJob(jt drmaa2interface.JobTemplate) (string, error)

AddJob submits a new slurm job.

func (*Tracker) DeleteJob

func (t *Tracker) DeleteJob(jobid string) error

DeleteJob removes the job from the internal storage. It errors when the job is not yet in any end state.

func (*Tracker) JobControl

func (t *Tracker) JobControl(jobid, state string) error

JobControl suspends, resumes, or stops a slurm job.

func (*Tracker) JobInfo

func (t *Tracker) JobInfo(jobid string) (drmaa2interface.JobInfo, error)

JobInfo returns detailed information about the job.

func (*Tracker) JobState

func (t *Tracker) JobState(jobid string) (drmaa2interface.JobState, string, error)

JobState returns the state of the slum job.

func (*Tracker) ListArrayJobs

func (t *Tracker) ListArrayJobs(arrayjobid string) ([]string, error)

ListArrayJobs shows all slums jobs which belong to a certain job array.

func (*Tracker) ListJobCategories

func (t *Tracker) ListJobCategories() ([]string, error)

ListJobCategories returns nothing.

func (*Tracker) ListJobs

func (t *Tracker) ListJobs() ([]string, error)

ListJobs shows all running slurm jobs.

func (*Tracker) Wait

func (t *Tracker) Wait(jobid string, timeout time.Duration, states ...drmaa2interface.JobState) error

Wait blocks until either one of the given states is reached or when the timeout occurs.

Jump to

Keyboard shortcuts

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