handler

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 35 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MbInBytes = 1024 * 1024
)

Variables

This section is empty.

Functions

func ConvertCreateSpecToUpdateConfig

func ConvertCreateSpecToUpdateConfig(spec *stateless.CreateSpec) *update.UpdateConfig

ConvertCreateSpecToUpdateConfig converts create spec to update config

func ConvertForThermosExecutor

func ConvertForThermosExecutor(
	jobSpec *stateless.JobSpec,
	thermosConfig config.ThermosExecutorConfig,
) (*stateless.JobSpec, error)

ConvertForThermosExecutor takes JobSpec as an input, generates and attaches thermos executor data if conversion could happen, and returns a mutated version of JobSpec.

func ConvertJobConfigToJobSpec

func ConvertJobConfigToJobSpec(config *job.JobConfig) *stateless.JobSpec

ConvertJobConfigToJobSpec converts v0 job.JobConfig to v1alpha stateless.JobSpec

func ConvertJobSpecToJobConfig

func ConvertJobSpecToJobConfig(spec *stateless.JobSpec) (*job.JobConfig, error)

ConvertJobSpecToJobConfig converts stateless job spec to job config

func ConvertJobSummary

func ConvertJobSummary(
	summary *job.JobSummary,
	updateInfo *models.UpdateModel) *stateless.JobSummary

ConvertJobSummary converts v0 job.JobSummary and private UpdateModel to v1alpha stateless.JobSummary

func ConvertLabels

func ConvertLabels(labels []*peloton.Label) []*v1alphapeloton.Label

ConvertLabels converts v0 peloton.Label array to v1alpha peloton.Label array

func ConvertMesosCommandToPodSpec

func ConvertMesosCommandToPodSpec(
	commandInfo *mesosv1.CommandInfo,
	spec *pod.PodSpec,
	container *pod.ContainerSpec,
)

ConvertMesosCommandToPodSpec converts the mesos command info to pod spec

func ConvertMesosContainerToPodSpec

func ConvertMesosContainerToPodSpec(
	containerInfo *mesosv1.ContainerInfo,
	spec *pod.PodSpec,
	container *pod.ContainerSpec,
)

ConvertMesosContainerToPodSpec converts the mesos container info to PodSpec

func ConvertMesosExecutorInfoToPodSpec

func ConvertMesosExecutorInfoToPodSpec(
	executorInfo *mesosv1.ExecutorInfo,
	spec *pod.PodSpec,
	container *pod.ContainerSpec,
)

ConvertMesosExecutorInfoToPodSpec converts mesos executor info to pod spec

func ConvertPodConstraintsToTaskConstraints

func ConvertPodConstraintsToTaskConstraints(
	constraints []*pod.Constraint,
) []*task.Constraint

ConvertPodConstraintsToTaskConstraints converts pod constraints to task constraints

func ConvertPodQuerySpecToTaskQuerySpec

func ConvertPodQuerySpecToTaskQuerySpec(spec *pod.QuerySpec) *task.QuerySpec

ConvertPodQuerySpecToTaskQuerySpec converts v1alpha pod.QuerySpec to v0 task.QuerySpec

func ConvertPodSpecToMesosCommand

func ConvertPodSpecToMesosCommand(spec *pod.PodSpec) *mesosv1.CommandInfo

ConvertPodSpecToMesosCommand converts pod spec to mesos command info

func ConvertPodSpecToMesosContainer

func ConvertPodSpecToMesosContainer(spec *pod.PodSpec) *mesosv1.ContainerInfo

ConvertPodSpecToMesosContainer converts pod spec to mesos container info

func ConvertPodSpecToMesosExecutorInfo

func ConvertPodSpecToMesosExecutorInfo(spec *pod.PodSpec) *mesosv1.ExecutorInfo

ConvertPodSpecToMesosExecutorInfo converts pod spec to mesos executor info

func ConvertPodSpecToTaskConfig

func ConvertPodSpecToTaskConfig(spec *pod.PodSpec) (*task.TaskConfig, error)

ConvertPodSpecToTaskConfig converts a pod spec to task config

func ConvertPodStateToTaskState

func ConvertPodStateToTaskState(state pod.PodState) task.TaskState

ConvertPodStateToTaskState converts v0 task.TaskState to v1alpha pod.PodState

func ConvertPortConfigsToPortSpecs

func ConvertPortConfigsToPortSpecs(ports []*task.PortConfig) []*pod.PortSpec

ConvertPortConfigsToPortSpecs converts v0 task.PortConfig array to v1alpha pod.PortSpec array

func ConvertRuntimeInfoToJobStatus

func ConvertRuntimeInfoToJobStatus(
	runtime *job.RuntimeInfo,
	updateInfo *models.UpdateModel,
) *stateless.JobStatus

ConvertRuntimeInfoToJobStatus converts v0 job.RuntimeInfo and private UpdateModel to v1alpha stateless.JobStatus

func ConvertSLAConfigToSLASpec

func ConvertSLAConfigToSLASpec(slaConfig *job.SlaConfig) *stateless.SlaSpec

ConvertSLAConfigToSLASpec convert job's sla config to sla spec

func ConvertSLASpecToSLAConfig

func ConvertSLASpecToSLAConfig(slaSpec *stateless.SlaSpec) *job.SlaConfig

ConvertSLASpecToSLAConfig converts job's sla spec to sla config

func ConvertStatelessQuerySpecToJobQuerySpec

func ConvertStatelessQuerySpecToJobQuerySpec(spec *stateless.QuerySpec) *job.QuerySpec

ConvertStatelessQuerySpecToJobQuerySpec converts query spec for stateless svc to job query spec

func ConvertTaskConfigToPodSpec

func ConvertTaskConfigToPodSpec(taskConfig *task.TaskConfig, jobID string, instanceID uint32) *pod.PodSpec

ConvertTaskConfigToPodSpec converts v0 task.TaskConfig to v1alpha pod.PodSpec

func ConvertTaskConstraintsToPodConstraints

func ConvertTaskConstraintsToPodConstraints(constraints []*task.Constraint) []*pod.Constraint

ConvertTaskConstraintsToPodConstraints converts v0 task.Constraint array to v1alpha pod.Constraint array

func ConvertTaskInfosToPodInfos

func ConvertTaskInfosToPodInfos(taskInfos []*task.TaskInfo) []*pod.PodInfo

ConvertTaskInfosToPodInfos converts a list of v0 task info to a list of v1alpha pod info

func ConvertTaskRuntimeToPodStatus

func ConvertTaskRuntimeToPodStatus(runtime *task.RuntimeInfo) *pod.PodStatus

ConvertTaskRuntimeToPodStatus converts v0 task.RuntimeInfo to v1alpha pod.PodStatus

func ConvertTaskStateToPodState

func ConvertTaskStateToPodState(state task.TaskState) pod.PodState

ConvertTaskStateToPodState converts v0 task.TaskState to v1alpha pod.PodState

func ConvertTaskStatsToPodStats

func ConvertTaskStatsToPodStats(taskStats map[string]uint32) map[string]uint32

ConvertTaskStatsToPodStats converts v0 task stats to v1alpha pod stats

func ConvertUpdateModelToWorkflowInfo

func ConvertUpdateModelToWorkflowInfo(
	runtime *job.RuntimeInfo,
	updateInfo *models.UpdateModel,
	workflowEvents []*stateless.WorkflowEvent,
	instanceWorkflowEvents []*stateless.WorkflowInfoInstanceWorkflowEvents,
) *stateless.WorkflowInfo

ConvertUpdateModelToWorkflowInfo converts private UpdateModel to v1alpha stateless.WorkflowInfo

func ConvertUpdateModelToWorkflowStatus

func ConvertUpdateModelToWorkflowStatus(
	runtime *job.RuntimeInfo,
	updateInfo *models.UpdateModel,
) *stateless.WorkflowStatus

ConvertUpdateModelToWorkflowStatus converts private UpdateModel to v1alpha stateless.WorkflowStatus

func ConvertUpdateSpecToUpdateConfig

func ConvertUpdateSpecToUpdateConfig(spec *stateless.UpdateSpec) *update.UpdateConfig

ConvertUpdateSpecToUpdateConfig converts update spec to update config

func ConvertV0SecretsToV1Secrets

func ConvertV0SecretsToV1Secrets(secrets []*peloton.Secret) []*v1alphapeloton.Secret

ConvertV0SecretsToV1Secrets converts v0 peloton.Secret to v1alpha peloton.Secret

func ConvertV1InstanceRangeToV0InstanceRange

func ConvertV1InstanceRangeToV0InstanceRange(
	instanceRange []*pod.InstanceIDRange) []*task.InstanceRange

ConvertV1InstanceRangeToV0InstanceRange converts from array of v1 pod.InstanceIDRange to array of v0 task.InstanceRange

func ConvertV1SecretsToV0Secrets

func ConvertV1SecretsToV0Secrets(secrets []*v1alphapeloton.Secret) []*peloton.Secret

ConvertV1SecretsToV0Secrets converts v1alpha peloton.Secret to v0 peloton.Secret

func FindVolumeInPodSpec

func FindVolumeInPodSpec(spec *pod.PodSpec, name string) *volume.VolumeSpec

FindVolumeInPodSpec finds a volume of given name in the volume spec present in the pod spec

func GetJobConfigWithoutFillingCache

func GetJobConfigWithoutFillingCache(
	ctx context.Context,
	id *peloton.JobID,
	factory cached.JobFactory,
	jobConfigOps ormobjects.JobConfigOps) (jobmgrcommon.JobConfig, error)

GetJobConfigWithoutFillingCache returns models.JobConfig without filling in cache. It would first try to find the object from cache. If cache misses, it will load from DB. The function is intended to be used for API that reads jobs without sending the jobs to goal states.

func GetJobRuntimeWithoutFillingCache

func GetJobRuntimeWithoutFillingCache(
	ctx context.Context,
	id *peloton.JobID,
	factory cached.JobFactory,
	jobRuntimeOps ormobjects.JobRuntimeOps) (*job.RuntimeInfo, error)

GetJobRuntimeWithoutFillingCache returns job.RuntimeInfo without filling in cache. It would first try to find the object from cache. If cache misses, it will load from DB. The function is intended to be used for API that reads jobs without sending the jobs to goal states.

Types

type Constraint

type Constraint struct {
	Order []*string `json:"order,omitempty"`
}

Constraint represents launching constraints for processes defined in a Thermos task.

func NewConstraint

func NewConstraint() *Constraint

NewConstraint initializes a new instance of Constraint.

type ExecutorData

type ExecutorData struct {
	Role                *string            `json:"role,omitempty"`
	Environment         *string            `json:"environment,omitempty"`
	Name                *string            `json:"name,omitempty"`
	Priority            *int32             `json:"priority,omitempty"`
	MaxTaskFailures     *int32             `json:"max_task_failures,omitempty"`
	Production          *bool              `json:"production,omitempty"`
	Tier                *string            `json:"tier,omitempty"`
	HealthCheckConfig   *HealthCheckConfig `json:"health_check_config,omitempty"`
	CronCollisionPolicy *string            `json:"cron_collision_policy,omitempty"`
	EnableHooks         *bool              `json:"enable_hooks,omitempty"`
	Cluster             *string            `json:"cluster,omitempty"`
	Task                *Task              `json:"task,omitempty"`
}

ExecutorData is the main data structure used by Thermos executor, represents a single thermos job.

func NewExecutorData

func NewExecutorData() *ExecutorData

NewExecutorData initializes a new instance of ExecutorData.

type HealthCheckConfig

type HealthCheckConfig struct {
	HealthChecker           *HealthCheckerConfig `json:"health_checker,omitempty"`
	InitialIntervalSecs     *float64             `json:"initial_interval_secs,omitempty"`
	IntervalSecs            *float64             `json:"interval_secs,omitempty"`
	MaxConsecutiveFailures  *int32               `json:"max_consecutive_failures,omitempty"`
	MinConsecutiveSuccesses *int32               `json:"min_consecutive_successes,omitempty"`
	TimeoutSecs             *float64             `json:"timeout_secs,omitempty"`
}

HealthCheckConfig defines the health check rules for a Thermos job.

func NewHealthCheckConfig

func NewHealthCheckConfig() *HealthCheckConfig

NewHealthCheckConfig initializes a new instance of HealthCheckConfig along with defaults values.

type HealthCheckerConfig

type HealthCheckerConfig struct {
	Http  *HttpHealthChecker  `json:"http,omitempty"`
	Shell *ShellHealthChecker `json:"shell,omitempty"`
}

HealthCheckerConfig defines the actual health check implementation (http or shell) to be used inside a HealthCheckConfig.

func NewHealthCheckerConfig

func NewHealthCheckerConfig() *HealthCheckerConfig

NewHealthCheckerConfig initializes a new instance of HealthCheckerConfig.

type HttpHealthChecker

type HttpHealthChecker struct {
	Endpoint             *string `json:"endpoint,omitempty"`
	ExpectedResponse     *string `json:"expected_response,omitempty"`
	ExpectedResponseCode *int32  `json:"expected_response_code,omitempty"`
}

HttpHealthChecker defines the health checker for testing against an HTTP endpoint.

func NewHttpHealthChecker

func NewHttpHealthChecker() *HttpHealthChecker

NewHttpHealthChecker initializes a new instance of HttpHealthChecker along with default values.

type Process

type Process struct {
	Cmdline     *string `json:"cmdline,omitempty"`
	Name        *string `json:"name,omitempty"`
	MaxFailures *int32  `json:"max_failures,omitempty"`
	Daemon      *bool   `json:"daemon,omitempty"`
	Ephemeral   *bool   `json:"ephemeral,omitempty"`
	MinDuration *int32  `json:"min_duration,omitempty"`
	Final       *bool   `json:"final,omitempty"`
}

Process represents the single process inside a Thermos task.

func NewProcess

func NewProcess() *Process

NewProcess initializes a new instance of Process along with default values.

type Resources

type Resources struct {
	Cpu       *float64 `json:"cpu,omitempty"`
	RamBytes  *int64   `json:"ram,omitempty"`
	DiskBytes *int64   `json:"disk,omitempty"`
	Gpu       *int32   `json:"gpu,omitempty"`
}

Resources represents the task resources.

func NewResources

func NewResources() *Resources

NewResources initializes a new instance of Resources.

type ShellHealthChecker

type ShellHealthChecker struct {
	ShellCommand *string `json:"shell_command,omitempty"`
}

ShellHealthChecker defines the health checker for running a shell command.

func NewShellHealthChecker

func NewShellHealthChecker() *ShellHealthChecker

NewShellHealthChecker initializes a new instance of ShellHealthChecker.

type Task

type Task struct {
	Name             *string       `json:"name,omitempty"`
	FinalizationWait *int32        `json:"finalization_wait,omitempty"`
	MaxFailures      *int32        `json:"max_failures,omitempty"`
	MaxConcurrency   *int32        `json:"max_concurrency,omitempty"`
	Resources        *Resources    `json:"resources,omitempty"`
	Processes        []*Process    `json:"processes,omitempty"`
	Constraints      []*Constraint `json:"constraints,omitempty"`
}

Task represents the task to be run inside a Thermos job.

func NewTask

func NewTask() *Task

NewTask initializes a new instance of Task along with default values.

Jump to

Keyboard shortcuts

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