lifecyclemgr

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LaunchableTaskInfo

type LaunchableTaskInfo struct {
	*task.TaskInfo
	// ConfigAddOn is the task config add on.
	ConfigAddOn *models.ConfigAddOn
	// Spec is the pod spec for the pod to be launched.
	Spec *pbpod.PodSpec
}

LaunchableTaskInfo contains the info of a task to be launched.

type Lockable

type Lockable interface {
	// LockKill locks kill operations including executor shutdown
	LockKill()
	// UnlockKill unlocks kill operations including executor shutdown
	UnlockKill()
	// LockLaunch locks launch operations
	LockLaunch()
	// UnlockLaunch unlocks launch operations
	UnlockLaunch()
}

Lockable interface defines the operations that can be locked

type Manager

type Manager interface {
	Lockable

	// Launch will launch tasks/pods using their config/spec on the specified
	// host using the acquired leaseID.
	Launch(
		ctx context.Context,
		leaseID string,
		hostname string,
		agentID string,
		tasks map[string]*LaunchableTaskInfo,
		rateLimiter *rate.Limiter,
	) error
	// Kill will kill tasks/pods using their ID.
	Kill(
		ctx context.Context,
		id string,
		hostToReserve string,
		rateLimiter *rate.Limiter,
	) error
	// ShutdownExecutor will shutdown the underlying mesos executor. This will
	// be a no-op for v1 LifecycleMgr.
	ShutdownExecutor(
		ctx context.Context,
		id string,
		agentID string,
		rateLimiter *rate.Limiter,
	) error

	// TerminateLease will be called to terminate the acquired lease on
	// hostmgr in case of any errors. This will ensure that the hosts that
	// are leased are not freed up for placement in case we cannot place the
	// current set of tasks on them.
	TerminateLease(
		ctx context.Context,
		hostname string,
		agentID string,
		leaseID string,
	) error

	// GetTasksOnDrainingHosts gets the taskIDs of the tasks on the
	// hosts in DRAINING state
	GetTasksOnDrainingHosts(
		ctx context.Context,
		limit uint32,
		timeout uint32,
	) ([]string, error)
}

Manager interface defines methods to kill workloads.

func New

func New(
	version api.Version,
	dispatcher *yarpc.Dispatcher,
	parent tally.Scope,
) Manager

New gets hostmgr API specific task/pod lifecycle mgr instance

type Metrics

type Metrics struct {
	Launch          tally.Counter
	LaunchFail      tally.Counter
	LaunchRetry     tally.Counter
	LaunchDuration  tally.Timer
	LaunchRateLimit tally.Counter

	Kill          tally.Counter
	KillFail      tally.Counter
	Shutdown      tally.Counter
	ShutdownFail  tally.Counter
	KillRateLimit tally.Counter

	TerminateLease     tally.Counter
	TerminateLeaseFail tally.Counter

	GetTasksOnDrainingHosts     tally.Counter
	GetTasksOnDrainingHostsFail tally.Counter
}

Metrics is the struct containing all the counters that track internal state of lifecyclemgr.

func NewMetrics

func NewMetrics(scope tally.Scope) *Metrics

NewMetrics returns a new Metrics struct, with all metrics initialized and rooted at the given tally.Scope

Jump to

Keyboard shortcuts

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