cache

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: 32 Imported by: 0

Documentation

Overview

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	AddOccupiedResource updateType = iota
	SubOccupiedResource
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocatedTaskEvent

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

------------------------ Allocate Event ------------------------

func NewAllocateTaskEvent

func NewAllocateTaskEvent(appID string, taskID string, allocUUID string, nid string) AllocatedTaskEvent

func (AllocatedTaskEvent) GetApplicationID

func (ae AllocatedTaskEvent) GetApplicationID() string

func (AllocatedTaskEvent) GetArgs

func (ae AllocatedTaskEvent) GetArgs() []interface{}

func (AllocatedTaskEvent) GetEvent

func (ae AllocatedTaskEvent) GetEvent() events.TaskEventType

func (AllocatedTaskEvent) GetTaskID

func (ae AllocatedTaskEvent) GetTaskID() string

type Application

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

func NewApplication

func NewApplication(appID, queueName, user string, tags map[string]string, scheduler api.SchedulerAPI) *Application

func (*Application) GetAllocatedTasks

func (app *Application) GetAllocatedTasks() []*Task

func (*Application) GetApplicationID

func (app *Application) GetApplicationID() string

func (*Application) GetApplicationState

func (app *Application) GetApplicationState() string

func (*Application) GetNewTasks

func (app *Application) GetNewTasks() []*Task

func (*Application) GetPendingTasks

func (app *Application) GetPendingTasks() []*Task

func (*Application) GetQueue

func (app *Application) GetQueue() string

func (*Application) GetTags added in v0.10.0

func (app *Application) GetTags() map[string]string

func (*Application) GetTask

func (app *Application) GetTask(taskID string) (interfaces.ManagedTask, error)

func (*Application) GetUser

func (app *Application) GetUser() string

func (*Application) Schedule

func (app *Application) Schedule() bool

Schedule is called in every scheduling interval, we are not using dispatcher here because we want to make state transition in sync mode in order to prevent generating too many duplicate events. However, it must ensure non of these calls is expensive, usually, they do nothing more than just triggering the state transition. return true if the app needs scheduling or false if not

func (*Application) SetPlaceholderTimeout added in v0.10.0

func (app *Application) SetPlaceholderTimeout(timeout int64)

func (*Application) SetState

func (app *Application) SetState(state string)

SetState is only for testing this is just used for testing, it is not supposed to change state like this

func (*Application) String

func (app *Application) String() string

func (*Application) TriggerAppRecovery added in v0.10.0

func (app *Application) TriggerAppRecovery() error

type ApplicationEvent added in v0.11.0

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

func NewApplicationEvent added in v0.11.0

func NewApplicationEvent(appID string, eventType events.ApplicationEventType, msg string) ApplicationEvent

func (ApplicationEvent) GetApplicationID added in v0.11.0

func (st ApplicationEvent) GetApplicationID() string

func (ApplicationEvent) GetArgs added in v0.11.0

func (st ApplicationEvent) GetArgs() []interface{}

func (ApplicationEvent) GetEvent added in v0.11.0

type ApplicationStatusChangeEvent added in v0.10.0

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

------------------------ ApplicationStatusChangeEvent updates the status in the application CRD ------------------------

func NewApplicationStatusChangeEvent added in v0.10.0

func NewApplicationStatusChangeEvent(appID string, eventType events.ApplicationEventType, state string) ApplicationStatusChangeEvent

func (ApplicationStatusChangeEvent) GetApplicationID added in v0.10.0

func (st ApplicationStatusChangeEvent) GetApplicationID() string

func (ApplicationStatusChangeEvent) GetArgs added in v0.10.0

func (st ApplicationStatusChangeEvent) GetArgs() []interface{}

func (ApplicationStatusChangeEvent) GetEvent added in v0.10.0

func (ApplicationStatusChangeEvent) GetState added in v0.10.0

func (st ApplicationStatusChangeEvent) GetState() string

type BindTaskEvent

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

------------------------ Bound Event ------------------------

func NewBindTaskEvent

func NewBindTaskEvent(appID string, taskID string) BindTaskEvent

func (BindTaskEvent) GetApplicationID

func (bt BindTaskEvent) GetApplicationID() string

func (BindTaskEvent) GetArgs

func (bt BindTaskEvent) GetArgs() []interface{}

func (BindTaskEvent) GetEvent

func (bt BindTaskEvent) GetEvent() events.TaskEventType

func (BindTaskEvent) GetTaskID

func (bt BindTaskEvent) GetTaskID() string

type CachedSchedulerNodeEvent

type CachedSchedulerNodeEvent struct {
	NodeID    string
	Event     events.SchedulerNodeEventType
	Arguments []interface{}
}

func (CachedSchedulerNodeEvent) GetArgs

func (sn CachedSchedulerNodeEvent) GetArgs() []interface{}

func (CachedSchedulerNodeEvent) GetEvent

func (CachedSchedulerNodeEvent) GetNodeID

func (sn CachedSchedulerNodeEvent) GetNodeID() string

type Context

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

context maintains scheduling state, like apps and apps' tasks.

func NewContext

func NewContext(apis client.APIProvider) *Context

Create a new context for the scheduler.

func (*Context) AddApplication

func (ctx *Context) AddApplication(request *interfaces.AddApplicationRequest) interfaces.ManagedApp

func (*Context) AddSchedulingEventHandlers

func (ctx *Context) AddSchedulingEventHandlers()

func (*Context) AddTask

func (ctx *Context) AddTask(request *interfaces.AddTaskRequest) interfaces.ManagedTask

this implements ApplicationManagementProtocol

func (*Context) ApplicationEventHandler

func (ctx *Context) ApplicationEventHandler() func(obj interface{})

func (*Context) AssumePod

func (ctx *Context) AssumePod(name string, node string) error

assume a pod will be running on a node, in scheduler, we maintain a cache where stores info for each node what pods are supposed to be running on it. And we keep this cache in-sync between core and the shim. this way, the core can make allocation decisions with consideration of other assumed pods before they are actually bound to the node (bound is slow).

func (*Context) ForgetPod

func (ctx *Context) ForgetPod(name string) error

forget pod must be called when a pod is assumed to be running on a node, but then for some reason it is failed to bind or released.

func (*Context) GetApplication

func (ctx *Context) GetApplication(appID string) interfaces.ManagedApp

func (*Context) HandleContainerStateUpdate added in v0.9.0

func (ctx *Context) HandleContainerStateUpdate(request *si.UpdateContainerSchedulingStateRequest)

this function handles the pod scheduling failures with respect to the different causes, and update the pod condition accordingly. the cluster autoscaler depends on the certain pod condition in order to trigger auto-scaling.

func (*Context) IsPodFitNode

func (ctx *Context) IsPodFitNode(name, node string, allocate bool) error

evaluate given predicates based on current context

func (*Context) NotifyApplicationComplete

func (ctx *Context) NotifyApplicationComplete(appID string)

inform the scheduler that the application is completed, the complete state may further explained to completed_with_errors(failed) or successfully_completed, either way we need to release all allocations (if exists) for this application

func (*Context) NotifyApplicationFail added in v0.11.0

func (ctx *Context) NotifyApplicationFail(appID string)

func (*Context) NotifyTaskComplete

func (ctx *Context) NotifyTaskComplete(appID, taskID string)

func (*Context) PublishEvents added in v0.9.0

func (ctx *Context) PublishEvents(eventRecords []*si.EventRecord)

func (*Context) RemoveApplication

func (ctx *Context) RemoveApplication(appID string) error

func (*Context) RemoveApplicationInternal added in v0.10.0

func (ctx *Context) RemoveApplicationInternal(appID string) error

func (*Context) RemoveTask

func (ctx *Context) RemoveTask(appID, taskID string) error

func (*Context) SaveConfigmap added in v0.10.0

func (ctx *Context) SaveConfigmap(request *si.UpdateConfigurationRequest) *si.UpdateConfigurationResponse

Save the configmap and returns the old one and an error if the process failed

func (*Context) SchedulerNodeEventHandler

func (ctx *Context) SchedulerNodeEventHandler() func(obj interface{})

func (*Context) SelectApplications

func (ctx *Context) SelectApplications(filter func(app *Application) bool) []*Application

func (*Context) TaskEventHandler

func (ctx *Context) TaskEventHandler() func(obj interface{})

func (*Context) UpdateApplication

func (ctx *Context) UpdateApplication(app *Application)

func (*Context) WaitForRecovery

func (ctx *Context) WaitForRecovery(recoverableAppManagers []interfaces.Recoverable, maxTimeout time.Duration) error

type FailApplicationEvent

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

------------------------ Fail application ------------------------

func NewFailApplicationEvent

func NewFailApplicationEvent(appID, message string) FailApplicationEvent

func (FailApplicationEvent) GetApplicationID

func (fe FailApplicationEvent) GetApplicationID() string

func (FailApplicationEvent) GetArgs

func (fe FailApplicationEvent) GetArgs() []interface{}

func (FailApplicationEvent) GetEvent

type FailTaskEvent

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

------------------------ Fail Event ------------------------

func NewFailTaskEvent

func NewFailTaskEvent(appID string, taskID string, failedMessage string) FailTaskEvent

func (FailTaskEvent) GetApplicationID

func (fe FailTaskEvent) GetApplicationID() string

func (FailTaskEvent) GetArgs

func (fe FailTaskEvent) GetArgs() []interface{}

func (FailTaskEvent) GetEvent

func (fe FailTaskEvent) GetEvent() events.TaskEventType

func (FailTaskEvent) GetTaskID

func (fe FailTaskEvent) GetTaskID() string

type MockedAMProtocol

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

implements ApplicationManagementProtocol

func NewMockedAMProtocol

func NewMockedAMProtocol() *MockedAMProtocol

func (*MockedAMProtocol) AddApplication

func (*MockedAMProtocol) AddTask

func (*MockedAMProtocol) GetApplication

func (m *MockedAMProtocol) GetApplication(appID string) interfaces.ManagedApp

func (*MockedAMProtocol) NotifyApplicationComplete

func (m *MockedAMProtocol) NotifyApplicationComplete(appID string)

func (*MockedAMProtocol) NotifyApplicationFail added in v0.11.0

func (m *MockedAMProtocol) NotifyApplicationFail(appID string)

func (*MockedAMProtocol) NotifyTaskComplete

func (m *MockedAMProtocol) NotifyTaskComplete(appID, taskID string)

func (*MockedAMProtocol) RemoveApplication

func (m *MockedAMProtocol) RemoveApplication(appID string) error

func (*MockedAMProtocol) RemoveTask

func (m *MockedAMProtocol) RemoveTask(appID, taskID string) error

type Placeholder added in v0.10.0

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

func (*Placeholder) String added in v0.10.0

func (p *Placeholder) String() string

type PlaceholderManager added in v0.10.0

type PlaceholderManager struct {

	// a simple mutex will do we do not have separate read and write paths
	sync.RWMutex
	// contains filtered or unexported fields
}

PlaceholderManager is a service to manage the lifecycle of app placeholders

func NewPlaceholderManager added in v0.10.0

func NewPlaceholderManager(clients *client.Clients) *PlaceholderManager

func (*PlaceholderManager) Start added in v0.10.0

func (mgr *PlaceholderManager) Start()

func (*PlaceholderManager) Stop added in v0.10.0

func (mgr *PlaceholderManager) Stop()

type RejectTaskEvent

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

------------------------ Reject Event ------------------------

func NewRejectTaskEvent

func NewRejectTaskEvent(appID string, taskID string, rejectedMessage string) RejectTaskEvent

func (RejectTaskEvent) GetApplicationID

func (re RejectTaskEvent) GetApplicationID() string

func (RejectTaskEvent) GetArgs

func (re RejectTaskEvent) GetArgs() []interface{}

func (RejectTaskEvent) GetEvent

func (re RejectTaskEvent) GetEvent() events.TaskEventType

func (RejectTaskEvent) GetTaskID

func (re RejectTaskEvent) GetTaskID() string

type ReleaseAppAllocationAskEvent added in v0.10.0

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

func NewReleaseAppAllocationAskEvent added in v0.10.0

func NewReleaseAppAllocationAskEvent(appID string, allocTermination si.TerminationType, taskID string) ReleaseAppAllocationAskEvent

func (ReleaseAppAllocationAskEvent) GetApplicationID added in v0.10.0

func (re ReleaseAppAllocationAskEvent) GetApplicationID() string

func (ReleaseAppAllocationAskEvent) GetArgs added in v0.10.0

func (re ReleaseAppAllocationAskEvent) GetArgs() []interface{}

func (ReleaseAppAllocationAskEvent) GetEvent added in v0.10.0

type ReleaseAppAllocationEvent added in v0.10.0

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

------------------------ Release application allocations ------------------------

func NewReleaseAppAllocationEvent added in v0.10.0

func NewReleaseAppAllocationEvent(appID string, allocTermination si.TerminationType, uuid string) ReleaseAppAllocationEvent

func (ReleaseAppAllocationEvent) GetApplicationID added in v0.10.0

func (re ReleaseAppAllocationEvent) GetApplicationID() string

func (ReleaseAppAllocationEvent) GetArgs added in v0.10.0

func (re ReleaseAppAllocationEvent) GetArgs() []interface{}

func (ReleaseAppAllocationEvent) GetEvent added in v0.10.0

type ResumingApplicationEvent added in v0.11.0

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

------------------------ Resuming application ------------------------

func NewResumingApplicationEvent added in v0.11.0

func NewResumingApplicationEvent(appID string) ResumingApplicationEvent

func (ResumingApplicationEvent) GetApplicationID added in v0.11.0

func (re ResumingApplicationEvent) GetApplicationID() string

func (ResumingApplicationEvent) GetArgs added in v0.11.0

func (re ResumingApplicationEvent) GetArgs() []interface{}

func (ResumingApplicationEvent) GetEvent added in v0.11.0

type RunApplicationEvent

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

------------------------ Run application ------------------------

func NewRunApplicationEvent

func NewRunApplicationEvent(appID string) RunApplicationEvent

func (RunApplicationEvent) GetApplicationID

func (re RunApplicationEvent) GetApplicationID() string

func (RunApplicationEvent) GetArgs

func (re RunApplicationEvent) GetArgs() []interface{}

func (RunApplicationEvent) GetEvent

type SchedulerNode

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

stores info about what scheduler cares about a node

type SimpleApplicationEvent

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

SimpleApplicationEvent simply moves application states

func NewSimpleApplicationEvent

func NewSimpleApplicationEvent(appID string, eventType events.ApplicationEventType) SimpleApplicationEvent

func (SimpleApplicationEvent) GetApplicationID

func (st SimpleApplicationEvent) GetApplicationID() string

func (SimpleApplicationEvent) GetArgs

func (st SimpleApplicationEvent) GetArgs() []interface{}

func (SimpleApplicationEvent) GetEvent

type SimpleTaskEvent

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

------------------------ Simple task Event simply moves task to next state, it has no arguments provided ------------------------

func NewSimpleTaskEvent

func NewSimpleTaskEvent(appID string, taskID string, taskType events.TaskEventType) SimpleTaskEvent

func (SimpleTaskEvent) GetApplicationID

func (st SimpleTaskEvent) GetApplicationID() string

func (SimpleTaskEvent) GetArgs

func (st SimpleTaskEvent) GetArgs() []interface{}

func (SimpleTaskEvent) GetEvent

func (st SimpleTaskEvent) GetEvent() events.TaskEventType

func (SimpleTaskEvent) GetTaskID

func (st SimpleTaskEvent) GetTaskID() string

type SubmitApplicationEvent

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

------------------------ SubmitTask application ------------------------

func NewSubmitApplicationEvent

func NewSubmitApplicationEvent(appID string) SubmitApplicationEvent

func (SubmitApplicationEvent) GetApplicationID

func (se SubmitApplicationEvent) GetApplicationID() string

func (SubmitApplicationEvent) GetArgs

func (se SubmitApplicationEvent) GetArgs() []interface{}

func (SubmitApplicationEvent) GetEvent

type SubmitTaskEvent

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

------------------------ SubmitTask Event ------------------------

func NewSubmitTaskEvent

func NewSubmitTaskEvent(appID string, taskID string) SubmitTaskEvent

func (SubmitTaskEvent) GetApplicationID

func (st SubmitTaskEvent) GetApplicationID() string

func (SubmitTaskEvent) GetArgs

func (st SubmitTaskEvent) GetArgs() []interface{}

func (SubmitTaskEvent) GetEvent

func (st SubmitTaskEvent) GetEvent() events.TaskEventType

func (SubmitTaskEvent) GetTaskID

func (st SubmitTaskEvent) GetTaskID() string

type Task

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

func NewFromTaskMeta added in v0.10.0

func NewFromTaskMeta(tid string, app *Application, ctx *Context, metadata interfaces.TaskMetadata) *Task

func NewTask

func NewTask(tid string, app *Application, ctx *Context, pod *v1.Pod) *Task

func NewTaskPlaceholder added in v0.11.0

func NewTaskPlaceholder(tid string, app *Application, ctx *Context, pod *v1.Pod) *Task

func (*Task) DeleteTaskPod added in v0.10.0

func (task *Task) DeleteTaskPod(pod *v1.Pod) error

func (*Task) GetTaskID

func (task *Task) GetTaskID() string

func (*Task) GetTaskPod

func (task *Task) GetTaskPod() *v1.Pod

func (*Task) GetTaskState

func (task *Task) GetTaskState() string

func (*Task) IsPlaceholder added in v0.10.0

func (task *Task) IsPlaceholder() bool

func (*Task) UpdateTaskPodStatus added in v0.11.0

func (task *Task) UpdateTaskPodStatus(pod *v1.Pod) (*v1.Pod, error)

type UpdateApplicationReservationEvent added in v0.10.0

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

------------------------ Reservation Update Event ------------------------

func NewUpdateApplicationReservationEvent added in v0.10.0

func NewUpdateApplicationReservationEvent(appID string) UpdateApplicationReservationEvent

func (UpdateApplicationReservationEvent) GetApplicationID added in v0.10.0

func (ue UpdateApplicationReservationEvent) GetApplicationID() string

func (UpdateApplicationReservationEvent) GetArgs added in v0.10.0

func (ue UpdateApplicationReservationEvent) GetArgs() []interface{}

func (UpdateApplicationReservationEvent) GetEvent added in v0.10.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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