worker

package
v0.0.0-...-adb0196 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Worker

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

Worker represents a worker with given labels and resource quotas

func NewWorker

func NewWorker(cfg *conf.ClusterCfg, spec *pb.Worker) (*Worker, error)

NewWorker creates a new worker instance.

func (*Worker) GetDesiredState

func (w *Worker) GetDesiredState() <-chan common.DesiredState

GetDesiredState returns a channel which provides desired task state. It's caller's responsibility to calculate state diffs and change real world state.

func (*Worker) Run

func (w *Worker) Run()

Run runs worker routine loop to watch task assignment changes.

func (*Worker) SetTaskStatus

func (w *Worker) SetTaskStatus(uuid string, status *pb.TaskStatus) error

SetTaskStatus sets user-defined status, which can be read by master. Note that status is bound to current worker, and will be invalidated on task reassignment.

func (*Worker) Stop

func (w *Worker) Stop()

Stop stops the worker, and waits until main loop exits.

Jump to

Keyboard shortcuts

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