events

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const EnterState = "enter_state"

Variables

This section is empty.

Functions

func GetEventArgsAsStrings

func GetEventArgsAsStrings(result []string, generic []interface{}) error

func GetRecorder

func GetRecorder() record.EventRecorder

func SetRecorderForTest added in v0.11.0

func SetRecorderForTest(recorder record.EventRecorder)

Types

type AllStates

type AllStates struct {
	Application *ApplicationStates
	Task        *TaskStates
	Scheduler   *SchedulerStates
	Node        *NodeStates
}

func States

func States() *AllStates

type ApplicationEvent

type ApplicationEvent interface {
	// an application event is associated with an application Id,
	// dispatcher finds out actual application based on this id
	// to handle this event
	GetApplicationID() string

	// the type of this event
	GetEvent() ApplicationEventType

	// an event can have multiple arguments, these arguments will be passed to
	// state machines' callbacks when doing state transition
	GetArgs() []interface{}
}

type ApplicationEventType

type ApplicationEventType string

---------------------------------------------- Application events ----------------------------------------------

const (
	SubmitApplication       ApplicationEventType = "SubmitApplication"
	RecoverApplication      ApplicationEventType = "RecoverApplication"
	AcceptApplication       ApplicationEventType = "AcceptApplication"
	TryReserve              ApplicationEventType = "TryReserve"
	UpdateReservation       ApplicationEventType = "UpdateReservation"
	RunApplication          ApplicationEventType = "RunApplication"
	RejectApplication       ApplicationEventType = "RejectApplication"
	CompleteApplication     ApplicationEventType = "CompleteApplication"
	FailApplication         ApplicationEventType = "FailApplication"
	KillApplication         ApplicationEventType = "KillApplication"
	KilledApplication       ApplicationEventType = "KilledApplication"
	ReleaseAppAllocation    ApplicationEventType = "ReleaseAppAllocation"
	ReleaseAppAllocationAsk ApplicationEventType = "ReleaseAppAllocationAsk"
	AppStateChange          ApplicationEventType = "ApplicationStateChange"
	ResumingApplication     ApplicationEventType = "ResumingApplication"
	AppTaskCompleted        ApplicationEventType = "AppTaskCompleted"
)

type ApplicationStates

type ApplicationStates struct {
	New        string
	Recovering string
	Submitted  string
	Accepted   string
	Reserving  string
	Running    string
	Rejected   string
	Completed  string
	Killing    string
	Killed     string
	Failing    string
	Failed     string
	Resuming   string
}

type ApplicationStatusEvent added in v0.10.0

type ApplicationStatusEvent interface {
	GetState() string
}

------------------------ ApplicationStatusEvent updates the status in the application CRD ------------------------

type MockedRecorder added in v0.11.0

type MockedRecorder struct {
	OnEventf func()
}

func NewMockedRecorder added in v0.11.0

func NewMockedRecorder() *MockedRecorder

func (*MockedRecorder) AnnotatedEventf added in v0.11.0

func (mr *MockedRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})

func (*MockedRecorder) Event added in v0.11.0

func (mr *MockedRecorder) Event(object runtime.Object, eventtype, reason, message string)

func (*MockedRecorder) Eventf added in v0.11.0

func (mr *MockedRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

func (*MockedRecorder) PastEventf added in v0.11.0

func (mr *MockedRecorder) PastEventf(object runtime.Object, timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{})

type NodeStates

type NodeStates struct {
	New        string
	Recovering string
	Accepted   string
	Healthy    string
	Rejected   string
	Draining   string
}

type SchedulerEvent

type SchedulerEvent interface {
	// the type of this event
	GetEvent() SchedulerEventType

	// an event can have multiple arguments, these arguments will be passed to
	// state machines' callbacks when doing state transition
	GetArgs() []interface{}
}

type SchedulerEventType

type SchedulerEventType string

-------------------------------------- scheduler events --------------------------------------

const (
	RegisterScheduler        SchedulerEventType = "RegisterScheduler"
	RegisterSchedulerSucceed SchedulerEventType = "RegisterSchedulerSucceed"
	RegisterSchedulerFailed  SchedulerEventType = "RegisterSchedulerFailed"
	RecoverScheduler         SchedulerEventType = "RecoverScheduler"
	RecoverSchedulerSucceed  SchedulerEventType = "RecoverSchedulerSucceed"
	RecoverSchedulerFailed   SchedulerEventType = "RecoverSchedulerFailed"
)

type SchedulerNodeEvent

type SchedulerNodeEvent interface {
	// returns the node ID
	GetNodeID() string

	// the type of this event
	GetEvent() SchedulerNodeEventType

	// an event can have multiple arguments, these arguments will be passed to
	// state machines' callbacks when doing state transition
	GetArgs() []interface{}
}

type SchedulerNodeEventType

type SchedulerNodeEventType string

-------------------------------------- scheduler node events --------------------------------------

const (
	RecoverNode  SchedulerNodeEventType = "RecoverNode"
	NodeAccepted SchedulerNodeEventType = "NodeAccepted"
	NodeRejected SchedulerNodeEventType = "NodeRejected"
	DrainNode    SchedulerNodeEventType = "DrainNode"
	RestoreNode  SchedulerNodeEventType = "RestoreNode"
	NodeReady    SchedulerNodeEventType = "NodeReady"
)

type SchedulerStates

type SchedulerStates struct {
	New         string
	Registered  string
	Registering string
	Recovering  string
	Running     string
	Draining    string
	Stopped     string
}

type SchedulingEvent

type SchedulingEvent interface {
	GetArgs() []interface{}
}

---------------------------------------------- General event interface ----------------------------------------------

type TaskEvent

type TaskEvent interface {
	// application ID which this task belongs to
	GetApplicationID() string

	// a task event must be associated with an application ID
	// and a task ID, dispatcher need them to dispatch this event
	// to the actual task
	GetTaskID() string

	// type of this event
	GetEvent() TaskEventType

	// an event can have multiple arguments, these arguments will be passed to
	// state machines' callbacks when doing state transition
	GetArgs() []interface{}
}

type TaskEventType

type TaskEventType string

---------------------------------------------- Task events ----------------------------------------------

const (
	InitTask      TaskEventType = "InitTask"
	SubmitTask    TaskEventType = "SubmitTask"
	TaskAllocated TaskEventType = "TaskAllocated"
	TaskRejected  TaskEventType = "TaskRejected"
	TaskBound     TaskEventType = "TaskBound"
	CompleteTask  TaskEventType = "CompleteTask"
	TaskFail      TaskEventType = "TaskFail"
	KillTask      TaskEventType = "KillTask"
	TaskKilled    TaskEventType = "TaskKilled"
)

type TaskStates

type TaskStates struct {
	New        string
	Pending    string
	Scheduling string
	Allocated  string
	Rejected   string
	Bound      string
	Killing    string
	Killed     string
	Failed     string
	Completed  string
	Any        []string // Any refers to all possible states
	Terminated []string // Rejected, Killed, Failed, Completed
}

Jump to

Keyboard shortcuts

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