job

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package job contains code for accessing compute resources via Slurm.

Package job contains code for accessing compute resources via Slurm.

Package job contains code for accessing compute resources via Slurm.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedQueue = errors.New("queue is closed")
View Source
var ExcludeNodes = "--exclude="

ExcludeNodes EXISTS ONLY FOR DEBUGGING PURPOSES of Inotify on NFS.

View Source
var NewUserEnv = "--get-user-env"

NewUserEnv is used to generate the /run/user/ folder required by cgroups.

View Source
var Slurm struct {
	SubmitCmd string
	CancelCmd string
	StatsCmd  string
}

Slurm represents a SLURM installation.

Functions

func CancelJob

func CancelJob(args string) (string, error)

func ConnectionOK

func ConnectionOK() bool

ConnectionOK return true if HPK maintains connection with the Slurm manager. Otherwise, it returns false.

func SetContainerStatusID

func SetContainerStatusID(status *corev1.ContainerStatus, typedValue string)

func SetPodID

func SetPodID(pod *corev1.Pod, idType JobIDType, value string)

func SubmitJob

func SubmitJob(scriptFile string) (string, error)

Types

type EventHandler

type EventHandler struct {
	Opts  Options
	Queue chan fsnotify.Event

	Finished bool
	// contains filtered or unexported fields
}

EventHandler represents the datastructure for an EventHandler instance. This struct satisfies the EventHandler interface.

func NewEventHandler

func NewEventHandler(opts Options) *EventHandler

func (*EventHandler) Push

func (h *EventHandler) Push(event fsnotify.Event)

Push adds a new event payload to the queue.

func (*EventHandler) Run

func (h *EventHandler) Run(ctx context.Context, control PodControl)

Run spawns workers and listens to the queue It's a blocking function and waits for a cancellation invocation from the Client.

type JobIDType

type JobIDType string
const (
	JobIDTypeInstance JobIDType = "instance://"

	JobIDTypeProcess JobIDType = "pid://"

	JobIDTypeSlurm JobIDType = "slurm://"

	JobIDTypeEmpty JobIDType = ""
)

func ParseContainerID

func ParseContainerID(status *corev1.ContainerStatus) (idType JobIDType, value string)

func ParsePodID

func ParsePodID(pod *corev1.Pod) (idType JobIDType, value string)

type Options

type Options struct {
	MaxWorkers   int // Number of workers to spawn.
	MaxQueueSize int // Maximum length for the queue to hold events.
}

Options represent options for SlurmEventHandler.

type PodControl

type PodControl struct {
	UpdateStatus         func(pod *corev1.Pod)
	LoadFromDisk         func(podRef client.ObjectKey) (*corev1.Pod, error)
	NotifyVirtualKubelet func(pod *corev1.Pod)
}

Jump to

Keyboard shortcuts

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