realis

package module
Version: v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 24 Imported by: 5

README

gorealis GoDoc Build Status codecov

Version 1 of Go library for interacting with Aurora Scheduler.

Version 2 of this library can be found here.

Aurora version compatibility

Please see .auroraversion to see the latest Aurora version against which this library has been tested.

Usage

Projects using gorealis

Contributions

Contributions are always welcome. Please raise an issue to discuss a contribution before it is made.

Documentation

Overview

Package realis provides the ability to use Thrift API to communicate with Apache Aurora.

Index

Constants

View Source
const (
	CPU resourceType = iota
	RAM
	DISK
	GPU
)

Variables

View Source
var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)

ActiveJobUpdateStates - States a Job Update may be in where it is considered active.

View Source
var ActiveStates = make(map[aurora.ScheduleStatus]bool)

ActiveStates - States a task may be in when active.

View Source
var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)

AwaitingPulseJobUpdateStates - States a job update may be in where it is waiting for a pulse.

View Source
var LiveStates = make(map[aurora.ScheduleStatus]bool)

LiveStates - States a task may be in when it is live (e.g. able to take traffic)

View Source
var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool)

SlaveAssignedStates - States a task may be in when it has already been assigned to a Mesos agent.

View Source
var TerminalStates = make(map[aurora.ScheduleStatus]bool)

TerminalStates - Set of states a task may not transition away from.

Functions

func ExponentialBackoff added in v1.1.0

func ExponentialBackoff(backoff Backoff, logger logger, condition ConditionFunc) error

ExponentialBackoff is a modified version of the Kubernetes exponential-backoff code. It repeats a condition check with exponential backoff and checks the condition up to Steps times, increasing the wait by multiplying the previous duration by Factor.

If Jitter is greater than zero, a random amount of each duration is added (between duration and duration*(1+jitter)).

If the condition never returns true, ErrWaitTimeout is returned. Errors do not cause the function to return.

func IsTemporary added in v1.2.0

func IsTemporary(err error) bool

IsTemporary indicates whether the error passed in as an argument implements the temporary interface and if the Temporary function returns true.

func IsTimeout added in v1.2.0

func IsTimeout(err error) bool

IsTimeout returns true if the error being passed as an argument implements the Timeout interface and the Timedout function returns true.

func Jitter added in v1.1.0

func Jitter(duration time.Duration, maxFactor float64) time.Duration

Jitter returns a time.Duration between duration and duration + maxFactor * duration.

This allows clients to avoid converging on periodic behavior. If maxFactor is 0.0, a suggested default value will be chosen.

func LeaderFromZK

func LeaderFromZK(cluster Cluster) (string, error)

LeaderFromZK - Retrieves current Aurora leader from ZK.

func LeaderFromZKOpts added in v1.3.0

func LeaderFromZKOpts(options ...ZKOpt) (string, error)

LeaderFromZKOpts - Retrieves current Aurora leader from ZK with a custom configuration.

func LoadClusters

func LoadClusters(config string) (map[string]Cluster, error)

LoadClusters loads clusters.json file traditionally located at /etc/aurora/clusters.json for use with a gorealis client

func NewTemporaryError added in v1.2.0

func NewTemporaryError(err error) *temporaryErr

NewTemporaryError creates a new error which satisfies the Temporary interface.

func NewUpdateSettings added in v1.1.0

func NewUpdateSettings() *aurora.JobUpdateSettings

func TerminalUpdateStates added in v1.22.0

func TerminalUpdateStates() []aurora.JobUpdateStatus

TerminalJobUpdateStates returns a slice containing all the terminal states an update may end up in. This is a function in order to avoid having a slice that can be accidentally mutated.

func ToRetryCount added in v1.3.0

func ToRetryCount(err error) *retryErr

ToRetryCount is a helper function for testing verification to avoid whitebox testing as well as keeping retryErr as a private. Should NOT be used under any other context.

Types

type AuroraJob

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

AuroraJob is a structure to collect all information pertaining to an Aurora job.

func (*AuroraJob) AddDedicatedConstraint added in v1.3.1

func (j *AuroraJob) AddDedicatedConstraint(role, name string) Job

AddDedicatedConstraint is a convenience function that allows the user to add a dedicated constraint to a Job configuration. In case a previous dedicated constraint was set, it will be clobbered by this new value.

func (*AuroraJob) AddLabel

func (j *AuroraJob) AddLabel(key string, value string) Job

AddLabel adds a Mesos label to the job. Note that Aurora will add the prefix "org.apache.aurora.metadata." to the beginning of each key.

func (*AuroraJob) AddLimitConstraint

func (j *AuroraJob) AddLimitConstraint(name string, limit int32) Job

AddLimitConstraint allows the user to limit how many tasks form the same Job are run on a single host. If the name matches a constraint that was previously set, the previous value will be overwritten. In case the previous constraint attached to the name was of type Value, the constraint will be clobbered by this new Limit constraint. From Aurora Docs: A constraint that specifies the maximum number of active tasks on a host with a matching attribute that may be scheduled simultaneously.

func (*AuroraJob) AddNamedPorts

func (j *AuroraJob) AddNamedPorts(names ...string) Job

AddNamedPorts adds a named port to the job configuration These are random ports as it's not currently possible to request specific ports using Aurora.

func (*AuroraJob) AddPorts

func (j *AuroraJob) AddPorts(num int) Job

AddPorts adds a request for a number of ports to the job configuration. The names chosen for these ports will be org.apache.aurora.port.X, where X is the current port count for the job configuration starting at 0. These are random ports as it's not currently possible to request specific ports using Aurora.

func (*AuroraJob) AddURIs

func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job

AddURIs adds a list of URIs with the same extract and cache configuration. Scheduler must have --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.

func (*AuroraJob) AddValueConstraint

func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) Job

AddValueConstraint allows the user to add a value constrain to the job to limit which agents the job's tasks can be run on. If the name matches a constraint that was previously set, the previous value will be overwritten. In case the previous constraint attached to the name was of type limit, the constraint will be clobbered by this new Value constraint. From Aurora Docs: Add a Value constraint name - Mesos slave attribute that the constraint is matched against. If negated = true , treat this as a 'not' - to avoid specific values. Values - list of values we look for in attribute name

func (*AuroraJob) CPU

func (j *AuroraJob) CPU(cpus float64) Job

CPU sets the amount of CPU each task will use in an Aurora Job.

func (*AuroraJob) Container added in v1.0.2

func (j *AuroraJob) Container(container Container) Job

Container sets a container to run for the job configuration to run.

func (*AuroraJob) CronCollisionPolicy

func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job

CronCollisionPolicy allows the user to decide what happens if two or more instances of the same Cron job need to run.

func (*AuroraJob) CronSchedule

func (j *AuroraJob) CronSchedule(cron string) Job

CronSchedule allows the user to configure a cron schedule for this job to run in.

func (*AuroraJob) Disk

func (j *AuroraJob) Disk(disk int64) Job

Disk sets the amount of Disk each task will use in an Aurora Job.

func (*AuroraJob) Environment

func (j *AuroraJob) Environment(env string) Job

Environment sets the Job Key environment.

func (*AuroraJob) ExecutorData

func (j *AuroraJob) ExecutorData(data string) Job

ExecutorData sets the data blob that will be passed to the Mesos executor.

func (*AuroraJob) ExecutorName

func (j *AuroraJob) ExecutorName(name string) Job

ExecutorName sets the name of the executor that will the task will be configured to.

func (*AuroraJob) GPU added in v1.3.1

func (j *AuroraJob) GPU(gpu int64) Job

GPU sets the amount of GPU each task will use in an Aurora Job.

func (*AuroraJob) GetInstanceCount

func (j *AuroraJob) GetInstanceCount() int32

GetInstanceCount returns how many tasks this Job contains.

func (*AuroraJob) InstanceCount

func (j *AuroraJob) InstanceCount(instCount int32) Job

InstanceCount sets how many instances of the task to run for this Job.

func (*AuroraJob) IsService

func (j *AuroraJob) IsService(isService bool) Job

IsService returns true if the job is a long term running job or false if it is an ad-hoc job.

func (*AuroraJob) JobConfig

func (j *AuroraJob) JobConfig() *aurora.JobConfiguration

JobConfig returns the job's configuration.

func (*AuroraJob) JobKey

func (j *AuroraJob) JobKey() *aurora.JobKey

JobKey returns the job's configuration key.

func (*AuroraJob) MaxFailure

func (j *AuroraJob) MaxFailure(maxFail int32) Job

MaxFailure sets how many failures to tolerate before giving up per Job.

func (*AuroraJob) Name

func (j *AuroraJob) Name(name string) Job

Name sets the Job Key Name.

func (*AuroraJob) PartitionPolicy added in v1.3.1

func (j *AuroraJob) PartitionPolicy(policy *aurora.PartitionPolicy) Job

PartitionPolicy sets a partition policy for the job configuration to implement.

func (*AuroraJob) RAM

func (j *AuroraJob) RAM(ram int64) Job

RAM sets the amount of RAM each task will use in an Aurora Job.

func (*AuroraJob) Role

func (j *AuroraJob) Role(role string) Job

Role sets the Job Key role.

func (*AuroraJob) SlaPolicy added in v1.21.0

func (j *AuroraJob) SlaPolicy(policy *aurora.SlaPolicy) Job

SlaPolicy sets an SlaPolicy for the Job.

func (*AuroraJob) TaskConfig

func (j *AuroraJob) TaskConfig() *aurora.TaskConfig

TaskConfig returns the job's task(shard) configuration.

func (*AuroraJob) Tier added in v1.21.0

func (j *AuroraJob) Tier(tier string) Job

Tier sets the Tier for the Job.

type Backoff added in v1.1.0

type Backoff struct {
	Duration time.Duration // the base duration
	Factor   float64       // Duration is multiplied by a factor each iteration
	Jitter   float64       // The amount of jitter applied each iteration
	Steps    int           // Exit with error after this many steps
}

Backoff determines how the retry mechanism should react after each failure and how many failures it should tolerate.

type ClientOption added in v1.1.0

type ClientOption func(*config)

ClientOption is an alias for a function that modifies the realis config object

func BackOff added in v1.1.0

func BackOff(b Backoff) ClientOption

BackOff is an alternative name for the Retry mechanism configuration.

func BasicAuth added in v1.1.0

func BasicAuth(username, password string) ClientOption

BasicAuth sets authentication used against Apache Shiro in the Aurora scheduler

func CertExtensions added in v1.22.1

func CertExtensions(extensions ...string) ClientOption

CertExtensions configures gorealis to consider files with the given extensions when loading certificates from the cert path.

func Certspath added in v1.1.0

func Certspath(certspath string) ClientOption

Certspath sets the directory where the server certificates to be used when connecting to an SSL enabled Aurora scheduler are stored.

func ClientCerts added in v1.1.0

func ClientCerts(clientKey, clientCert string) ClientOption

ClientCerts allows users to set client key and certificate when connecting to an SSL enabled Aurora scheduler.

func Debug added in v1.3.0

func Debug() ClientOption

Debug enables debug statements in the client.

func FailOnPermanentErrors added in v1.21.1

func FailOnPermanentErrors() ClientOption

FailOnPermanentErrors allows the client to stop upon encountering a connection error the standard library considers permanent and return an error to the user.

func InsecureSkipVerify added in v1.1.0

func InsecureSkipVerify(insecureSkipVerify bool) ClientOption

InsecureSkipVerify configures the client to not check for matching hosts names on certificates when using an SSL enabled Aurora scheduler.

func Retries added in v1.1.0

func Retries(backoff Backoff) ClientOption

Retries configures the retry mechanism for the client

func SchedulerUrl added in v1.1.0

func SchedulerUrl(url string) ClientOption

SchedulerUrl sets the immediate location of the current Aurora scheduler leader

func SetLogger added in v1.1.0

func SetLogger(l logger) ClientOption

SetLogger allows the user to attach a logger that implements the logger interface in logger.go to the client.

func ThriftBinary added in v1.1.0

func ThriftBinary() ClientOption

ThriftBinary configures the client to use the Thrift Binary protocol.

func ThriftJSON added in v1.1.0

func ThriftJSON() ClientOption

ThriftJSON configures the client to use the Thrift JSON protocol.

func TimeoutMS added in v1.1.0

func TimeoutMS(timeout int) ClientOption

TimeoutMS sets the connection timeout for an HTTP post request in Miliseconds

func Trace added in v1.21.0

func Trace() ClientOption

Trace enables debug statements in the client.

func ZKCluster added in v1.1.0

func ZKCluster(cluster *Cluster) ClientOption

ZKCluster sets a clusters.json provided cluster configuration to the client

func ZKUrl added in v1.1.0

func ZKUrl(url string) ClientOption

ZKUrl sets the direct location of a Zookeeper node on which the Aurora leader registers itself

func ZookeeperOptions added in v1.3.0

func ZookeeperOptions(opts ...ZKOpt) ClientOption

ZookeeperOptions allows users to override default settings for connecting to Zookeeper. See zk.go for what is possible to set as an option.

type Cluster

type Cluster struct {
	Name          string `json:"name"`
	AgentRoot     string `json:"slave_root"`
	AgentRunDir   string `json:"slave_run_directory"`
	ZK            string `json:"zk"`
	ZKPort        int    `json:"zk_port"`
	SchedZKPath   string `json:"scheduler_zk_path"`
	SchedURI      string `json:"scheduler_uri"`
	ProxyURL      string `json:"proxy_url"`
	AuthMechanism string `json:"auth_mechanism"`
}

Cluster contains the definition of the clusters.json file used by the default Aurora client for configuration

func GetDefaultClusterFromZKUrl added in v1.1.0

func GetDefaultClusterFromZKUrl(zkurl string) *Cluster

GetDefaultClusterFromZKUrl creates a cluster object from a Zoookeper url. This is deprecated in favor of using Zookeeper options.

type ConditionFunc added in v1.1.0

type ConditionFunc func() (done bool, err error)

ConditionFunc returns true if the condition is satisfied, or an error if the loop should be aborted.

type Container added in v1.0.2

type Container interface {
	Build() *aurora.Container
}

Container is an interface that defines a single function needed to create an Aurora container type. It exists because the code must support both Mesos and Docker containers.

type DockerContainer added in v1.0.2

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

DockerContainer is a vanilla Docker style container that can be used by Aurora Jobs.

func NewDockerContainer added in v1.0.2

func NewDockerContainer() DockerContainer

NewDockerContainer creates a new Aurora compatible Docker container configuration.

func (DockerContainer) AddParameter added in v1.0.2

func (c DockerContainer) AddParameter(name, value string) DockerContainer

AddParameter adds a parameter to be passed to Docker when the container is run.

func (DockerContainer) Build added in v1.0.2

func (c DockerContainer) Build() *aurora.Container

Build creates an Aurora container based upon the configuration provided.

func (DockerContainer) Image added in v1.0.2

func (c DockerContainer) Image(image string) DockerContainer

Image adds the name of a Docker image to be used by the Job when running.

type Job

type Job interface {
	// Set Job Key environment.
	Environment(env string) Job
	Role(role string) Job
	Name(name string) Job
	CronSchedule(cron string) Job
	CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job
	CPU(cpus float64) Job
	Disk(disk int64) Job
	RAM(ram int64) Job
	GPU(gpu int64) Job
	ExecutorName(name string) Job
	ExecutorData(data string) Job
	AddPorts(num int) Job
	AddLabel(key string, value string) Job
	AddNamedPorts(names ...string) Job
	AddLimitConstraint(name string, limit int32) Job
	AddValueConstraint(name string, negated bool, values ...string) Job

	// From Aurora Docs:
	// dedicated attribute. Aurora treats this specially, and only allows matching jobs
	// to run on these machines, and will only schedule matching jobs on these machines.
	// When a job is created, the scheduler requires that the $role component matches
	// the role field in the job configuration, and will reject the job creation otherwise.
	// A wildcard (*) may be used for the role portion of the dedicated attribute, which
	// will allow any owner to elect for a job to run on the host(s)
	AddDedicatedConstraint(role, name string) Job
	AddURIs(extract bool, cache bool, values ...string) Job
	JobKey() *aurora.JobKey
	JobConfig() *aurora.JobConfiguration
	TaskConfig() *aurora.TaskConfig
	IsService(isService bool) Job
	InstanceCount(instCount int32) Job
	GetInstanceCount() int32
	MaxFailure(maxFail int32) Job
	Container(container Container) Job
	PartitionPolicy(policy *aurora.PartitionPolicy) Job
	Tier(tier string) Job
	SlaPolicy(policy *aurora.SlaPolicy) Job
}

Job inteface is used to define a set of functions an Aurora Job object must implemement. TODO(rdelvalle): Consider getting rid of the Job interface

func NewJob

func NewJob() Job

NewJob is used to create a Job object with everything initialized.

type LevelLogger added in v1.3.0

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

LevelLogger is a logger that can be configured to output different levels of information: Debug and Trace. Trace should only be enabled when very in depth information about the sequence of events a function took is needed.

func (*LevelLogger) EnableDebug added in v1.3.0

func (l *LevelLogger) EnableDebug(enable bool)

EnableDebug enables debug level logging for the LevelLogger

func (*LevelLogger) EnableTrace added in v1.21.0

func (l *LevelLogger) EnableTrace(enable bool)

EnableTrace enables trace level logging for the LevelLogger

type MesosContainer added in v1.0.2

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

MesosContainer is a Mesos style container that can be used by Aurora Jobs.

func NewMesosContainer added in v1.1.0

func NewMesosContainer() MesosContainer

NewMesosContainer creates a Mesos style container to be configured and built for use by an Aurora Job.

func (MesosContainer) AppcImage added in v1.1.0

func (c MesosContainer) AppcImage(name, imageID string) MesosContainer

AppcImage configures the Mesos container to use an image in the Appc format to run the container.

func (MesosContainer) Build added in v1.1.0

func (c MesosContainer) Build() *aurora.Container

Build creates a Mesos style Aurora container configuration to be passed on to the Aurora Job.

func (MesosContainer) DockerImage added in v1.1.0

func (c MesosContainer) DockerImage(name, tag string) MesosContainer

DockerImage configures the Mesos container to use a specific Docker image when being run.

type Monitor

type Monitor struct {
	Client Realis
}

Monitor is a wrapper for the Realis client which allows us to have functions with the same name for Monitoring purposes. TODO(rdelvalle): Deprecate monitors and instead add prefix Monitor to all functions in this file like it is done in V2.

func (*Monitor) AutoPausedUpdateMonitor added in v1.22.0

func (m *Monitor) AutoPausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (int, error)

AutoPaused monitor is a special monitor for auto pause enabled batch updates. This monitor ensures that the update being monitored is capable of auto pausing and has auto pausing enabled. After verifying this information, the monitor watches for the job to enter the ROLL_FORWARD_PAUSED state and calculates the current batch the update is in using information from the update configuration.

func (*Monitor) HostMaintenance added in v1.1.0

func (m *Monitor) HostMaintenance(
	hosts []string,
	modes []aurora.MaintenanceMode,
	interval, timeout int) (map[string]bool, error)

HostMaintenance will monitor host status until all hosts match the status provided. Returns a map where the value is true if the host is in one of the desired mode(s) or false if it is not as of the time when the monitor exited.

func (*Monitor) Instances

func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error)

Monitor a Job until all instances enter one of the LIVE_STATES

func (*Monitor) JobUpdate

func (m *Monitor) JobUpdate(
	updateKey aurora.JobUpdateKey,
	interval int,
	timeout int) (bool, error)

JobUpdate polls the scheduler every certain amount of time to see if the update has entered a terminal state.

func (*Monitor) JobUpdateQuery added in v1.21.1

func (m *Monitor) JobUpdateQuery(
	updateQuery aurora.JobUpdateQuery,
	interval time.Duration,
	timeout time.Duration) ([]*aurora.JobUpdateSummary, error)

JobUpdateQuery polls the scheduler every certain amount of time to see if the query call returns any results.

func (*Monitor) JobUpdateStatus added in v1.21.0

func (m *Monitor) JobUpdateStatus(updateKey aurora.JobUpdateKey,
	desiredStatuses []aurora.JobUpdateStatus,
	interval, timeout time.Duration) (aurora.JobUpdateStatus, error)

JobUpdateStatus polls the scheduler every certain amount of time to see if the update has entered a specified state.

func (*Monitor) ScheduleStatus added in v1.2.0

func (m *Monitor) ScheduleStatus(
	key *aurora.JobKey,
	instanceCount int32,
	desiredStatuses map[aurora.ScheduleStatus]bool,
	interval int,
	timeout int) (bool, error)

ScheduleStatus will monitor a Job until all instances enter a desired status. Defaults sets of desired statuses provided by the thrift API include: ACTIVE_STATES, SLAVE_ASSIGNED_STATES, LIVE_STATES, and TERMINAL_STATES

type NoopLogger added in v1.0.4

type NoopLogger struct{}

NoopLogger is a logger that can be attached to the client which will not print anything.

func (NoopLogger) Print added in v1.1.0

func (NoopLogger) Print(a ...interface{})

Print is a NOOP function here.

func (NoopLogger) Printf added in v1.0.4

func (NoopLogger) Printf(format string, a ...interface{})

Printf is a NOOP function here.

func (NoopLogger) Println added in v1.1.0

func (NoopLogger) Println(a ...interface{})

Println is a NOOP function here.

type Realis

type Realis interface {
	AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error)
	AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error)
	CreateJob(auroraJob Job) (*aurora.Response, error)
	CreateService(
		auroraJob Job,
		settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error)
	DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, error)
	FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error)
	GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error)
	GetJobUpdateSummaries(jobUpdateQuery *aurora.JobUpdateQuery) (*aurora.Response, error)
	GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error)
	GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error)
	GetJobs(role string) (*aurora.Response, *aurora.GetJobsResult_, error)
	GetPendingReason(query *aurora.TaskQuery) (pendingReasons []*aurora.PendingReason, e error)
	JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*aurora.Response, error)
	KillJob(key *aurora.JobKey) (*aurora.Response, error)
	KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error)
	RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error)
	RestartInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error)
	RestartJob(key *aurora.JobKey) (*aurora.Response, error)
	RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error)
	ScheduleCronJob(auroraJob Job) (*aurora.Response, error)
	StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error)

	PauseJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error)
	ResumeJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error)
	PulseJobUpdate(key *aurora.JobUpdateKey) (*aurora.Response, error)
	StartCronJob(key *aurora.JobKey) (*aurora.Response, error)
	// TODO: Remove this method and make it private to avoid race conditions
	ReestablishConn() error
	RealisConfig() *config
	Close()

	// Admin functions
	DrainHosts(hosts ...string) (*aurora.Response, *aurora.DrainHostsResult_, error)
	SLADrainHosts(policy *aurora.SlaPolicy, timeout int64, hosts ...string) (*aurora.DrainHostsResult_, error)
	StartMaintenance(hosts ...string) (*aurora.Response, *aurora.StartMaintenanceResult_, error)
	EndMaintenance(hosts ...string) (*aurora.Response, *aurora.EndMaintenanceResult_, error)
	MaintenanceStatus(hosts ...string) (*aurora.Response, *aurora.MaintenanceStatusResult_, error)
	SetQuota(role string, cpu *float64, ram *int64, disk *int64) (*aurora.Response, error)
	GetQuota(role string) (*aurora.Response, error)
	Snapshot() error
	PerformBackup() error
	// Force an Implicit reconciliation between Mesos and Aurora
	ForceImplicitTaskReconciliation() error
	// Force an Explicit reconciliation between Mesos and Aurora
	ForceExplicitTaskReconciliation(batchSize *int32) error
}

Realis is an interface that defines the various APIs that may be used to communicate with the Apache Aurora scheduler. TODO(rdelvalle): Move documentation to interface in order to make godoc look better accessible Or get rid of the interface

func NewRealisClient added in v1.1.0

func NewRealisClient(options ...ClientOption) (Realis, error)

NewRealisClient is a client implementation of the realis interface uses a retry mechanism for all Thrift Calls. It will retry all calls which result in a temporary failure as well as calls that fail due to an EOF being returned by the http client. Most permanent failures are now being caught by the thriftCallWithRetries function and not being retried but there may be corner cases not yet handled.

type UpdateJob

type UpdateJob struct {
	Job // SetInstanceCount for job is hidden, access via full qualifier
	// contains filtered or unexported fields
}

UpdateJob is a structure to collect all information required to create job update.

func NewDefaultUpdateJob added in v1.1.0

func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob

NewDefaultUpdateJob creates an UpdateJob object with opinionated default settings.

func NewUpdateJob

func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) *UpdateJob

NewUpdateJob creates an UpdateJob object wihtout default settings.

func (*UpdateJob) BatchSize

func (u *UpdateJob) BatchSize(size int32) *UpdateJob

BatchSize sets the max number of instances being updated at any given moment.

func (*UpdateJob) BatchUpdateStrategy added in v1.22.0

func (u *UpdateJob) BatchUpdateStrategy(strategy aurora.BatchJobUpdateStrategy) *UpdateJob

NewUpdateSettings return an opinionated set of job update settings.

func (*UpdateJob) InstanceCount

func (u *UpdateJob) InstanceCount(inst int32) *UpdateJob

InstanceCount sets instance count the job will have after the update.

func (*UpdateJob) MaxFailedInstances

func (u *UpdateJob) MaxFailedInstances(inst int32) *UpdateJob

MaxFailedInstances sets the max number of FAILED instances to tolerate before terminating the update.

func (*UpdateJob) MaxPerInstanceFailures

func (u *UpdateJob) MaxPerInstanceFailures(inst int32) *UpdateJob

MaxPerInstanceFailures sets the max number of instance failures to tolerate before marking instance as FAILED.

func (*UpdateJob) QueueUpdateStrategy added in v1.22.0

func (u *UpdateJob) QueueUpdateStrategy(strategy aurora.QueueJobUpdateStrategy) *UpdateJob

func (*UpdateJob) RollbackOnFail

func (u *UpdateJob) RollbackOnFail(rollback bool) *UpdateJob

RollbackOnFail configure the job to rollback automatically after a job update fails.

func (*UpdateJob) VariableBatchStrategy added in v1.22.0

func (u *UpdateJob) VariableBatchStrategy(strategy aurora.VariableBatchJobUpdateStrategy) *UpdateJob

func (*UpdateJob) WaitForBatchCompletion

func (u *UpdateJob) WaitForBatchCompletion(batchWait bool) *UpdateJob

WaitForBatchCompletion configures the job update to wait for all instances in a group to be done before moving on.

func (*UpdateJob) WatchTime

func (u *UpdateJob) WatchTime(ms int32) *UpdateJob

WatchTime sets the minimum number of seconds a shard must remain in RUNNING state before considered a success.

type ZKOpt added in v1.3.0

type ZKOpt func(z *zkConfig)

ZKOpt - Configuration option for the Zookeeper client used.

func ZKBackoff added in v1.3.0

func ZKBackoff(b Backoff) ZKOpt

ZKBackoff - Configuration for Retry mechanism used when connecting to Zookeeper. TODO(rdelvalle): Determine if this is really necessary as the ZK library already has a retry built in.

func ZKEndpoints added in v1.3.0

func ZKEndpoints(endpoints ...string) ZKOpt

ZKEndpoints - Endpoints on which a Zookeeper instance is running to be used by the client.

func ZKLogger added in v1.3.0

func ZKLogger(l logger) ZKOpt

ZKLogger - Attach a logger to the Zookeeper client in order to debug issues.

func ZKPath added in v1.3.0

func ZKPath(path string) ZKOpt

ZKPath - Path to look for information in when connected to Zookeeper.

func ZKTimeout added in v1.3.0

func ZKTimeout(d time.Duration) ZKOpt

ZKTimeout - How long to wait on a response from the Zookeeper instance before considering it dead.

Directories

Path Synopsis
gen-go
Helper functions to process aurora.Response
Helper functions to process aurora.Response

Jump to

Keyboard shortcuts

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