launcher

package
v0.0.0-...-ac6a2c4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTaskLauncher

func InitTaskLauncher(
	d *yarpc.Dispatcher,
	hostMgrClientName string,
	jobFactory cached.JobFactory,
	ormStore *ormobjects.Store,
	parent tally.Scope,
	hmVersion api.Version,
)

InitTaskLauncher initializes a Task Launcher

Types

type HostOperationsFactory

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

HostOperationsFactory returns operations for hostmgr offeroperation rpc.

func NewHostOperationsFactory

func NewHostOperationsFactory(
	tasks []*hostsvc.LaunchableTask,
	hostname string,
	selectedPorts []uint32) *HostOperationsFactory

NewHostOperationsFactory returns a new HostOperationsFactory instance.

func (*HostOperationsFactory) GetHostOperations

func (h *HostOperationsFactory) GetHostOperations(
	opTypes []hostsvc.OfferOperation_Type) ([]*hostsvc.OfferOperation, error)

GetHostOperations returns list of host offer operations.

type LaunchableTask

type LaunchableTask struct {
	// RuntimeDiff is the diff to be applied to the task runtime,
	// before launch it
	RuntimeDiff jobmgrcommon.RuntimeDiff
	// Config is the task config of the task to be launched
	Config *task.TaskConfig
	// ConfigAddOn is the task config add on
	ConfigAddOn *models.ConfigAddOn
	// Spec is the pod spec for the pod to be launched
	Spec *pbpod.PodSpec
}

LaunchableTask contains the changes to the task runtime, expressed as the map RuntimeDiff, to make the task launchable and the configuration of the task

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 Launcher

type Launcher interface {
	// ProcessPlacement launches tasks to hostmgr
	ProcessPlacement(
		ctx context.Context,
		tasks []*hostsvc.LaunchableTask,
		placement *resmgr.Placement) error
	// Launch tasks on host manager using either mesos or k8s.
	Launch(
		ctx context.Context,
		tasks map[string]*LaunchableTaskInfo,
		placement *resmgr.Placement,
	) (map[string]*LaunchableTaskInfo, error)
	// GetLaunchableTasks returns current task configuration and
	// the runtime diff which needs to be patched onto existing runtime for
	// each launchable task. The second return value contains the tasks that
	// were skipped, for example because they were not found.
	GetLaunchableTasks(
		ctx context.Context,
		tasks []*mesos.TaskID,
		hostname string,
		agentID *mesos.AgentID,
		selectedPorts []uint32,
	) (map[string]*LaunchableTask, []*peloton.TaskID, error)
	// CreateLaunchableTasks generates list of hostsvc.LaunchableTask and a map
	// of skipped TaskInfo from map of TaskInfo
	CreateLaunchableTasks(
		ctx context.Context, tasks map[string]*LaunchableTaskInfo) (
		[]*hostsvc.LaunchableTask, map[string]*LaunchableTaskInfo)
	// TryReturnOffers returns the offers in the placement back to host manager
	TryReturnOffers(
		ctx context.Context,
		err error,
		placement *resmgr.Placement) error
}

Launcher defines the interface of task launcher which launches tasks from the placed queues of resource pool

func GetLauncher

func GetLauncher() Launcher

GetLauncher returns the task scheduler instance

type Metrics

type Metrics struct {
	TaskLaunch     tally.Counter
	TaskLaunchFail tally.Counter
	// Increment this counter when we see failure to
	// populate the task's volume secret from DB
	TaskPopulateSecretFail tally.Counter
	TaskLaunchRetry        tally.Counter

	TaskRequeuedOnLaunchFail tally.Counter

	GetDBTaskInfo           tally.Timer
	LauncherGoRoutines      tally.Counter
	LaunchTasksCallDuration tally.Timer
}

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

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