nomad

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2015 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegion   = "global"
	DefaultDC       = "dc1"
	DefaultSerfPort = 4648
)
View Source
const (
	ProtocolVersionMin uint8 = 1
	ProtocolVersionMax       = 1
)

These are the protocol versions that Nomad can understand

View Source
const (
	// DefaultDequeueTimeout is used if no dequeue timeout is provided
	DefaultDequeueTimeout = time.Second
)
View Source
const (
	// StatusReap is used to update the status of a node if we
	// are handling a EventMemberReap
	StatusReap = serf.MemberStatus(-1)
)

Variables

View Source
var (
	DefaultRPCAddr = &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4647}
)

Functions

func NewCoreScheduler

func NewCoreScheduler(srv *Server, snap *state.StateSnapshot) scheduler.Scheduler

NewCoreScheduler is used to return a new system scheduler instance

func NewFSM

func NewFSM(evalBroker *EvalBroker, logOutput io.Writer) (*nomadFSM, error)

NewFSMPath is used to construct a new FSM with a blank state

func RuntimeStats

func RuntimeStats() map[string]string

RuntimeStats is used to return various runtime information

Types

type Alloc

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

Alloc endpoint is used for manipulating allocations

func (*Alloc) GetAlloc

GetAlloc is used to lookup a particular allocation

func (*Alloc) List

List is used to list the allocations in the system

type BrokerStats

type BrokerStats struct {
	TotalReady   int
	TotalUnacked int
	TotalBlocked int
	TotalWaiting int
	ByScheduler  map[string]*SchedulerStats
}

BrokerStats returns all the stats about the broker

type Config

type Config struct {
	// Bootstrap mode is used to bring up the first Consul server.
	// It is required so that it can elect a leader without any
	// other nodes being present
	Bootstrap bool

	// BootstrapExpect mode is used to automatically bring up a collection of
	// Consul servers. This can be used to automatically bring up a collection
	// of nodes.
	BootstrapExpect int

	// DataDir is the directory to store our state in
	DataDir string

	// DevMode is used for development purposes only and limits the
	// use of persistence or state.
	DevMode bool

	// DevDisableBootstrap is used to disable bootstrap mode while
	// in DevMode. This is largely used for testing.
	DevDisableBootstrap bool

	// LogOutput is the location to write logs to. If this is not set,
	// logs will go to stderr.
	LogOutput io.Writer

	// ProtocolVersion is the protocol version to speak. This must be between
	// ProtocolVersionMin and ProtocolVersionMax.
	ProtocolVersion uint8

	// RPCAddr is the RPC address used by Nomad. This should be reachable
	// by the other servers and clients
	RPCAddr *net.TCPAddr

	// RPCAdvertise is the address that is advertised to other nodes for
	// the RPC endpoint. This can differ from the RPC address, if for example
	// the RPCAddr is unspecified "0.0.0.0:4646", but this address must be
	// reachable
	RPCAdvertise *net.TCPAddr

	// RaftConfig is the configuration used for Raft in the local DC
	RaftConfig *raft.Config

	// RaftTimeout is applied to any network traffic for raft. Defaults to 10s.
	RaftTimeout time.Duration

	// RequireTLS ensures that all RPC traffic is protected with TLS
	RequireTLS bool

	// SerfConfig is the configuration for the serf cluster
	SerfConfig *serf.Config

	// Node name is the name we use to advertise. Defaults to hostname.
	NodeName string

	// Region is the region this Nomad server belongs to.
	Region string

	// Datacenter is the datacenter this Nomad server belongs to.
	Datacenter string

	// Build is a string that is gossiped around, and can be used to help
	// operators track which versions are actively deployed
	Build string

	// NumSchedulers is the number of scheduler thread that are run.
	// This can be as many as one per core, or zero to disable this server
	// from doing any scheduling work.
	NumSchedulers int

	// EnabledSchedulers controls the set of sub-schedulers that are
	// enabled for this server to handle. This will restrict the evaluations
	// that the workers dequeue for processing.
	EnabledSchedulers []string

	// ReconcileInterval controls how often we reconcile the strongly
	// consistent store with the Serf info. This is used to handle nodes
	// that are force removed, as well as intermittent unavailability during
	// leader election.
	ReconcileInterval time.Duration

	// EvalGCInterval is how often we dispatch a job to GC evaluations
	EvalGCInterval time.Duration

	// EvalGCThreshold is how "old" an evaluation must be to be eligible
	// for GC. This gives users some time to debug a failed evaluation.
	EvalGCThreshold time.Duration

	// NodeGCInterval is how often we dispatch a job to GC failed nodes.
	NodeGCInterval time.Duration

	// NodeGCThreshold is how "old" a nodemust be to be eligible
	// for GC. This gives users some time to view and debug a failed nodes.
	NodeGCThreshold time.Duration

	// EvalNackTimeout controls how long we allow a sub-scheduler to
	// work on an evaluation before we consider it failed and Nack it.
	// This allows that evaluation to be handed to another sub-scheduler
	// to work on. Defaults to 60 seconds. This should be long enough that
	// no evaluation hits it unless the sub-scheduler has failed.
	EvalNackTimeout time.Duration

	// EvalDeliveryLimit is the limit of attempts we make to deliver and
	// process an evaluation. This is used so that an eval that will never
	// complete eventually fails out of the system.
	EvalDeliveryLimit int

	// MinHeartbeatTTL is the minimum time between heartbeats.
	// This is used as a floor to prevent excessive updates.
	MinHeartbeatTTL time.Duration

	// MaxHeartbeatsPerSecond is the maximum target rate of heartbeats
	// being processed per second. This allows the TTL to be increased
	// to meet the target rate.
	MaxHeartbeatsPerSecond float64

	// HeartbeatGrace is the additional time given as a grace period
	// beyond the TTL to account for network and processing delays
	// as well as clock skew.
	HeartbeatGrace time.Duration

	// FailoverHeartbeatTTL is the TTL applied to heartbeats after
	// a new leader is elected, since we no longer know the status
	// of all the heartbeats.
	FailoverHeartbeatTTL time.Duration
}

Config is used to parameterize the server

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func (*Config) CheckVersion

func (c *Config) CheckVersion() error

CheckVersion is used to check if the ProtocolVersion is valid

type Conn

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

Conn is a pooled connection to a Nomad server

func (*Conn) Close

func (c *Conn) Close() error

type ConnPool

type ConnPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ConnPool is used to maintain a connection pool to other Nomad servers. This is used to reduce the latency of RPC requests between servers. It is only used to pool connections in the rpcNomad mode. Raft connections are pooled separately.

func NewPool

func NewPool(logOutput io.Writer, maxTime time.Duration, maxStreams int, tlsWrap tlsutil.DCWrapper) *ConnPool

NewPool is used to make a new connection pool Maintain at most one connection per host, for up to maxTime. Set maxTime to 0 to disable reaping. maxStreams is used to control the number of idle streams allowed. If TLS settings are provided outgoing connections use TLS.

func (*ConnPool) RPC

func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string, args interface{}, reply interface{}) error

RPC is used to make an RPC call to a remote host

func (*ConnPool) Shutdown

func (p *ConnPool) Shutdown() error

Shutdown is used to close the connection pool

type CoreScheduler

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

CoreScheduler is a special "scheduler" that is registered as "_core". It is used to run various administrative work across the cluster.

func (*CoreScheduler) Process

func (s *CoreScheduler) Process(eval *structs.Evaluation) error

Process is used to implement the scheduler.Scheduler interface

type Eval

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

Eval endpoint is used for eval interactions

func (*Eval) Ack

func (e *Eval) Ack(args *structs.EvalAckRequest,
	reply *structs.GenericResponse) error

Ack is used to acknowledge completion of a dequeued evaluation

func (*Eval) Allocations

func (e *Eval) Allocations(args *structs.EvalSpecificRequest,
	reply *structs.EvalAllocationsResponse) error

Allocations is used to list the allocations for an evaluation

func (*Eval) Create

func (e *Eval) Create(args *structs.EvalUpdateRequest,
	reply *structs.GenericResponse) error

Create is used to make a new evaluation

func (*Eval) Dequeue

func (e *Eval) Dequeue(args *structs.EvalDequeueRequest,
	reply *structs.EvalDequeueResponse) error

Dequeue is used to dequeue a pending evaluation

func (*Eval) GetEval

func (e *Eval) GetEval(args *structs.EvalSpecificRequest,
	reply *structs.SingleEvalResponse) error

GetEval is used to request information about a specific evaluation

func (*Eval) List

func (e *Eval) List(args *structs.EvalListRequest,
	reply *structs.EvalListResponse) error

List is used to get a list of the evaluations in the system

func (*Eval) Nack

func (e *Eval) Nack(args *structs.EvalAckRequest,
	reply *structs.GenericResponse) error

NAck is used to negative acknowledge completion of a dequeued evaluation

func (*Eval) Reap

func (e *Eval) Reap(args *structs.EvalDeleteRequest,
	reply *structs.GenericResponse) error

Reap is used to cleanup dead evaluations and allocations

func (*Eval) Update

func (e *Eval) Update(args *structs.EvalUpdateRequest,
	reply *structs.GenericResponse) error

Update is used to perform an update of an Eval if it is outstanding.

type EvalBroker

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

EvalBroker is used to manage brokering of evaluations. When an evaluation is created, due to a change in a job specification or a node, we put it into the broker. The broker sorts by evaluations by priority and scheduler type. This allows us to dequeue the highest priority work first, while also allowing sub-schedulers to only dequeue work they know how to handle. The broker is designed to be entirely in-memory and is managed by the leader node.

The broker must provide at-least-once delivery semantics. It relies on explicit Ack/Nack messages to handle this. If a delivery is not Ack'd in a sufficient time span, it will be assumed Nack'd.

func NewEvalBroker

func NewEvalBroker(timeout time.Duration, deliveryLimit int) (*EvalBroker, error)

NewEvalBroker creates a new evaluation broker. This is parameterized with the timeout used for messages that are not acknowledged before we assume a Nack and attempt to redeliver as well as the deliveryLimit which prevents a failing eval from being endlessly delivered.

func (*EvalBroker) Ack

func (b *EvalBroker) Ack(evalID, token string) error

Ack is used to positively acknowledge handling an evaluation

func (*EvalBroker) Dequeue

func (b *EvalBroker) Dequeue(schedulers []string, timeout time.Duration) (*structs.Evaluation, string, error)

Dequeue is used to perform a blocking dequeue

func (*EvalBroker) EmitStats

func (b *EvalBroker) EmitStats(period time.Duration, stopCh chan struct{})

EmitStats is used to export metrics about the broker while enabled

func (*EvalBroker) Enabled

func (b *EvalBroker) Enabled() bool

Enabled is used to check if the broker is enabled.

func (*EvalBroker) Enqueue

func (b *EvalBroker) Enqueue(eval *structs.Evaluation) error

Enqueue is used to enqueue an evaluation

func (*EvalBroker) Flush

func (b *EvalBroker) Flush()

Flush is used to clear the state of the broker

func (*EvalBroker) Nack

func (b *EvalBroker) Nack(evalID, token string) error

Nack is used to negatively acknowledge handling an evaluation

func (*EvalBroker) Outstanding

func (b *EvalBroker) Outstanding(evalID string) (string, bool)

Outstanding checks if an EvalID has been delivered but not acknowledged and returns the associated token for the evaluation.

func (*EvalBroker) SetEnabled

func (b *EvalBroker) SetEnabled(enabled bool)

SetEnabled is used to control if the broker is enabled. The broker should only be enabled on the active leader.

func (*EvalBroker) Stats

func (b *EvalBroker) Stats() *BrokerStats

Stats is used to query the state of the broker

type Job

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

Job endpoint is used for job interactions

func (*Job) Allocations

func (j *Job) Allocations(args *structs.JobSpecificRequest,
	reply *structs.JobAllocationsResponse) error

Allocations is used to list the allocations for a job

func (*Job) Deregister

func (j *Job) Deregister(args *structs.JobDeregisterRequest, reply *structs.JobDeregisterResponse) error

Deregister is used to remove a job the cluster.

func (*Job) Evaluate

func (j *Job) Evaluate(args *structs.JobEvaluateRequest, reply *structs.JobRegisterResponse) error

Evaluate is used to force a job for re-evaluation

func (*Job) Evaluations

func (j *Job) Evaluations(args *structs.JobSpecificRequest,
	reply *structs.JobEvaluationsResponse) error

Evaluations is used to list the evaluations for a job

func (*Job) GetJob

func (j *Job) GetJob(args *structs.JobSpecificRequest,
	reply *structs.SingleJobResponse) error

GetJob is used to request information about a specific job

func (*Job) List

func (j *Job) List(args *structs.JobListRequest,
	reply *structs.JobListResponse) error

List is used to list the jobs registered in the system

func (*Job) Register

func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegisterResponse) error

Register is used to upsert a job for scheduling

type Node

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

Node endpoint is used for client interactions

func (*Node) Deregister

func (n *Node) Deregister(args *structs.NodeDeregisterRequest, reply *structs.NodeUpdateResponse) error

Deregister is used to remove a client from the client. If a client should just be made unavailable for scheduling, a status update is prefered.

func (*Node) Evaluate

func (n *Node) Evaluate(args *structs.NodeEvaluateRequest, reply *structs.NodeUpdateResponse) error

Evaluate is used to force a re-evaluation of the node

func (*Node) GetAllocs

func (n *Node) GetAllocs(args *structs.NodeSpecificRequest,
	reply *structs.NodeAllocsResponse) error

GetAllocs is used to request allocations for a specific ndoe

func (*Node) GetNode

func (n *Node) GetNode(args *structs.NodeSpecificRequest,
	reply *structs.SingleNodeResponse) error

GetNode is used to request information about a specific ndoe

func (*Node) List

func (n *Node) List(args *structs.NodeListRequest,
	reply *structs.NodeListResponse) error

List is used to list the available nodes

func (*Node) Register

func (n *Node) Register(args *structs.NodeRegisterRequest, reply *structs.NodeUpdateResponse) error

Register is used to upsert a client that is available for scheduling

func (*Node) UpdateAlloc

func (n *Node) UpdateAlloc(args *structs.AllocUpdateRequest, reply *structs.GenericResponse) error

UpdateAlloc is used to update the client status of an allocation

func (*Node) UpdateDrain

UpdateDrain is used to update the drain mode of a client node

func (*Node) UpdateStatus

func (n *Node) UpdateStatus(args *structs.NodeUpdateStatusRequest, reply *structs.NodeUpdateResponse) error

UpdateStatus is used to update the status of a client node

type PendingEvaluations

type PendingEvaluations []*structs.Evaluation

PendingEvaluations is a list of waiting evaluations. We implement the container/heap interface so that this is a priority queue

func (PendingEvaluations) Len

func (p PendingEvaluations) Len() int

Len is for the sorting interface

func (PendingEvaluations) Less

func (p PendingEvaluations) Less(i, j int) bool

Less is for the sorting interface. We flip the check so that the "min" in the min-heap is the element with the highest priority

func (PendingEvaluations) Peek

Peek is used to peek at the next element that would be popped

func (*PendingEvaluations) Pop

func (p *PendingEvaluations) Pop() interface{}

Pop is used to remove an evaluation from the slice

func (*PendingEvaluations) Push

func (p *PendingEvaluations) Push(e interface{})

Push is used to add a new evalution to the slice

func (PendingEvaluations) Swap

func (p PendingEvaluations) Swap(i, j int)

Swap is for the sorting interface

type PendingPlans

type PendingPlans []*pendingPlan

PendingPlans is a list of waiting plans. We implement the container/heap interface so that this is a priority queue

func (PendingPlans) Len

func (p PendingPlans) Len() int

Len is for the sorting interface

func (PendingPlans) Less

func (p PendingPlans) Less(i, j int) bool

Less is for the sorting interface. We flip the check so that the "min" in the min-heap is the element with the highest priority. For the same priority, we use the enqueue time of the evaluation to give a FIFO ordering.

func (PendingPlans) Peek

func (p PendingPlans) Peek() *pendingPlan

Peek is used to peek at the next element that would be popped

func (*PendingPlans) Pop

func (p *PendingPlans) Pop() interface{}

Pop is used to remove an evaluation from the slice

func (*PendingPlans) Push

func (p *PendingPlans) Push(e interface{})

Push is used to add a new evalution to the slice

func (PendingPlans) Swap

func (p PendingPlans) Swap(i, j int)

Swap is for the sorting interface

type Plan

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

Plan endpoint is used for plan interactions

func (*Plan) Submit

func (p *Plan) Submit(args *structs.PlanRequest, reply *structs.PlanResponse) error

Submit is used to submit a plan to the leader

type PlanFuture

type PlanFuture interface {
	Wait() (*structs.PlanResult, error)
}

PlanFuture is used to return a future for an enqueue

type PlanQueue

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

PlanQueue is used to submit commit plans for task allocations to the current leader. The leader verifies that resources are not over-committed and commits to Raft. This allows sub-schedulers to be optimistically concurrent. In the case of an overcommit, the plan may be partially applied if allowed, or completely rejected (gang commit).

func NewPlanQueue

func NewPlanQueue() (*PlanQueue, error)

NewPlanQueue is used to construct and return a new plan queue

func (*PlanQueue) Dequeue

func (q *PlanQueue) Dequeue(timeout time.Duration) (*pendingPlan, error)

Dequeue is used to perform a blocking dequeue

func (*PlanQueue) EmitStats

func (q *PlanQueue) EmitStats(period time.Duration, stopCh chan struct{})

EmitStats is used to export metrics about the broker while enabled

func (*PlanQueue) Enabled

func (q *PlanQueue) Enabled() bool

Enabled is used to check if the queue is enabled.

func (*PlanQueue) Enqueue

func (q *PlanQueue) Enqueue(plan *structs.Plan) (PlanFuture, error)

Enqueue is used to enqueue a plan

func (*PlanQueue) Flush

func (q *PlanQueue) Flush()

Flush is used to reset the state of the plan queue

func (*PlanQueue) SetEnabled

func (q *PlanQueue) SetEnabled(enabled bool)

SetEnabled is used to control if the queue is enabled. The queue should only be enabled on the active leader.

func (*PlanQueue) Stats

func (q *PlanQueue) Stats() *QueueStats

Stats is used to query the state of the queue

type QueueStats

type QueueStats struct {
	Depth int
}

QueueStats returns all the stats about the plan queue

type RPCType

type RPCType byte

type RaftLayer

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

RaftLayer implements the raft.StreamLayer interface, so that we can use a single RPC layer for Raft and Nomad

func NewRaftLayer

func NewRaftLayer(addr net.Addr, tlsWrap tlsutil.Wrapper) *RaftLayer

NewRaftLayer is used to initialize a new RaftLayer which can be used as a StreamLayer for Raft. If a tlsConfig is provided, then the connection will use TLS.

func (*RaftLayer) Accept

func (l *RaftLayer) Accept() (net.Conn, error)

Accept is used to return connection which are dialed to be used with the Raft layer

func (*RaftLayer) Addr

func (l *RaftLayer) Addr() net.Addr

Addr is used to return the address of the listener

func (*RaftLayer) Close

func (l *RaftLayer) Close() error

Close is used to stop listening for Raft connections

func (*RaftLayer) Dial

func (l *RaftLayer) Dial(address string, timeout time.Duration) (net.Conn, error)

Dial is used to create a new outgoing connection

func (*RaftLayer) Handoff

func (l *RaftLayer) Handoff(c net.Conn) error

Handoff is used to hand off a connection to the RaftLayer. This allows it to be Accept()'ed

type SchedulerStats

type SchedulerStats struct {
	Ready   int
	Unacked int
}

SchedulerStats returns the stats per scheduler

type Server

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

Server is Nomad server which manages the job queues, schedulers, and notification bus for agents.

func NewServer

func NewServer(config *Config) (*Server, error)

NewServer is used to construct a new Nomad server from the configuration, potentially returning an error

func (*Server) Encrypted

func (s *Server) Encrypted() bool

Encrypted determines if gossip is encrypted

func (*Server) IsLeader

func (s *Server) IsLeader() bool

IsLeader checks if this server is the cluster leader

func (*Server) IsShutdown

func (s *Server) IsShutdown() bool

IsShutdown checks if the server is shutdown

func (*Server) Join

func (s *Server) Join(addrs []string) (int, error)

Join is used to have Nomad join the gossip ring The target address should be another node listening on the Serf address

func (*Server) KeyManager

func (s *Server) KeyManager() *serf.KeyManager

KeyManager returns the Serf keyring manager

func (*Server) Leave

func (s *Server) Leave() error

Leave is used to prepare for a graceful shutdown of the server

func (*Server) LocalMember

func (c *Server) LocalMember() serf.Member

LocalMember is used to return the local node

func (*Server) Members

func (s *Server) Members() []serf.Member

Members is used to return the members of the serf cluster

func (*Server) RPC

func (s *Server) RPC(method string, args interface{}, reply interface{}) error

RPC is used to make a local RPC call

func (*Server) RemoveFailedNode

func (s *Server) RemoveFailedNode(node string) error

RemoveFailedNode is used to remove a failed node from the cluster

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown is used to shutdown the server

func (*Server) State

func (s *Server) State() *state.StateStore

State returns the underlying state store. This should *not* be used to modify state directly.

func (*Server) Stats

func (s *Server) Stats() map[string]map[string]string

Stats is used to return statistics for debugging and insight for various sub-systems

type SnapshotType

type SnapshotType byte

SnapshotType is prefixed to a record in the FSM snapshot so that we can determine the type for restore

const (
	NodeSnapshot SnapshotType = iota
	JobSnapshot
	IndexSnapshot
	EvalSnapshot
	AllocSnapshot
	TimeTableSnapshot
)

type Status

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

Status endpoint is used to check on server status

func (*Status) Leader

func (s *Status) Leader(args *structs.GenericRequest, reply *string) error

Leader is used to get the address of the leader

func (*Status) Peers

func (s *Status) Peers(args *structs.GenericRequest, reply *[]string) error

Peers is used to get all the Raft peers

func (*Status) Ping

func (s *Status) Ping(args struct{}, reply *struct{}) error

Ping is used to just check for connectivity

func (*Status) Version

func (s *Status) Version(args *structs.GenericRequest, reply *structs.VersionResponse) error

Version is used to allow clients to determine the capabilities of the server

type StreamClient

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

streamClient is used to wrap a stream with an RPC client

func (*StreamClient) Close

func (sc *StreamClient) Close()

type TimeTable

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

TimeTable is used to associate a Raft index with a timestamp. This is used so that we can quickly go from a timestamp to an index or visa versa.

func NewTimeTable

func NewTimeTable(granularity time.Duration, limit time.Duration) *TimeTable

NewTimeTable creates a new time table which stores entries at a given granularity for a maximum limit. The storage space required is (limit/granularity)

func (*TimeTable) Deserialize

func (t *TimeTable) Deserialize(dec *codec.Decoder) error

Deserialize is used to deserialize the time table and restore the state

func (*TimeTable) NearestIndex

func (t *TimeTable) NearestIndex(when time.Time) uint64

NearestIndex returns the nearest index older than the given time

func (*TimeTable) NearestTime

func (t *TimeTable) NearestTime(index uint64) time.Time

NearestTime returns the nearest time older than the given index

func (*TimeTable) Serialize

func (t *TimeTable) Serialize(enc *codec.Encoder) error

Serialize is used to serialize the time table

func (*TimeTable) Witness

func (t *TimeTable) Witness(index uint64, when time.Time)

Witness is used to witness a new inde and time.

type TimeTableEntry

type TimeTableEntry struct {
	Index uint64
	Time  time.Time
}

TimeTableEntry is used to track a time and index

type Worker

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

Worker is a single threaded scheduling worker. There may be multiple running per server (leader or follower). They are responsible for dequeuing pending evaluations, invoking schedulers, plan submission and the lifecycle around making task allocations. They bridge the business logic of the scheduler with the plumbing required to make it all work.

func NewWorker

func NewWorker(srv *Server) (*Worker, error)

NewWorker starts a new worker associated with the given server

func (*Worker) CreateEval

func (w *Worker) CreateEval(eval *structs.Evaluation) error

CreateEval is used to create a new evaluation. This allows the worker to act as the planner for the scheduler.

func (*Worker) SetPause

func (w *Worker) SetPause(p bool)

SetPause is used to pause or unpause a worker

func (*Worker) SubmitPlan

func (w *Worker) SubmitPlan(plan *structs.Plan) (*structs.PlanResult, scheduler.State, error)

SubmitPlan is used to submit a plan for consideration. This allows the worker to act as the planner for the scheduler.

func (*Worker) UpdateEval

func (w *Worker) UpdateEval(eval *structs.Evaluation) error

UpdateEval is used to submit an updated evaluation. This allows the worker to act as the planner for the scheduler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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