state

package
v1.11.0-network-topolo... Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SyncJob will create or delete Pods according to Job's spec.
	SyncJob ActionFn
	// KillJob kill all Pods of Job with phase not in podRetainPhase.
	KillJob KillActionFn
	// KillTarget kill the target with given name.
	KillTarget KillTargetFn
)
View Source
var PodRetainPhaseNone = PhaseMap{}

PodRetainPhaseNone stores no phase.

View Source
var PodRetainPhaseSoft = PhaseMap{
	v1.PodSucceeded: {},
	v1.PodFailed:    {},
}

PodRetainPhaseSoft stores PodSucceeded and PodFailed Phase.

Functions

func DeleteJobMetrics added in v1.11.0

func DeleteJobMetrics(jobName, queueName string)

func TotalTaskMinAvailable added in v1.3.0

func TotalTaskMinAvailable(job *vcbatch.Job) int32

TotalTaskMinAvailable returns the sum of task minAvailable

func TotalTasks

func TotalTasks(job *vcbatch.Job) int32

TotalTasks returns number of tasks in a given volcano job.

func UpdateJobCompleted added in v1.11.0

func UpdateJobCompleted(jobName, queueName string)

func UpdateJobFailed added in v1.11.0

func UpdateJobFailed(jobName, queueName string)

Types

type Action added in v1.11.0

type Action struct {
	Action v1alpha1.Action
	Target Target
}

type ActionFn

type ActionFn func(job *apis.JobInfo, fn UpdateStatusFn) error

ActionFn will create or delete Pods according to Job's spec.

type KillActionFn

type KillActionFn func(job *apis.JobInfo, podRetainPhase PhaseMap, fn UpdateStatusFn) error

KillActionFn kill all Pods of Job with phase not in podRetainPhase.

type KillTargetFn added in v1.11.0

type KillTargetFn func(job *apis.JobInfo, target Target, fn UpdateStatusFn) error

KillPodFn kill the Task with given name.

type PhaseMap

type PhaseMap map[v1.PodPhase]struct{}

PhaseMap to store the pod phases.

type State

type State interface {
	// Execute executes the actions based on current state.
	Execute(act Action) error
}

State interface.

func NewState

func NewState(jobInfo *apis.JobInfo) State

NewState gets the state from the volcano job Phase.

type Target added in v1.11.0

type Target struct {
	TaskName string
	PodName  string
	Type     TargetType
}

type TargetType added in v1.11.0

type TargetType string
const (
	TargetTypeTask TargetType = "task"
	TargetTypePod  TargetType = "pod"
)

type UpdateStatusFn

type UpdateStatusFn func(status *vcbatch.JobStatus) (jobPhaseChanged bool)

UpdateStatusFn updates the job status.

Jump to

Keyboard shortcuts

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