job

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutorUnknown = iota
	ExecutorIdle
	ExecutorRunning
	ExecutorFinished
	ExecutorError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentExecutor

type AgentExecutor struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

AgentExecutor dispatch plan to node agent on worker nodes

func NewAgentExecutor

func NewAgentExecutor() *AgentExecutor

func (*AgentExecutor) GetLogger

func (exc *AgentExecutor) GetLogger() *dlog.Logger

func (*AgentExecutor) LoggerIdentity

func (exc *AgentExecutor) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*AgentExecutor) SetLogger

func (exc *AgentExecutor) SetLogger(logger *dlog.Logger)

func (*AgentExecutor) Start

func (exc *AgentExecutor) Start(ctx context.Context) error

type EchoExecutor

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

EchoExecutor output command it should run to io.Writer

func NewEchoExecutor

func NewEchoExecutor(plan pb.StagePlan, nodeIndex int, w io.Writer) *EchoExecutor

func (*EchoExecutor) GetLogger

func (exc *EchoExecutor) GetLogger() *dlog.Logger

func (*EchoExecutor) LoggerIdentity

func (exc *EchoExecutor) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*EchoExecutor) SetLogger

func (exc *EchoExecutor) SetLogger(logger *dlog.Logger)

func (*EchoExecutor) Start

func (exc *EchoExecutor) Start(ctx context.Context) error

func (*EchoExecutor) Status

func (exc *EchoExecutor) Status() (ExecutorStatus, error)

type Executor

type Executor interface {
	// Start dispatch/run the plan but does not wait for it to complete
	Start(ctx context.Context) error
	Status() (ExecutorStatus, error)
}

Executor runs a stage plan on a single node, coordination between nodes is done by manager - simply print command out (for dry run) - run everything locally, assume the job spec can be run locally, i.e. everything is localhost - dispatch job to remote agent

type ExecutorStatus

type ExecutorStatus uint8

type LocalExecutor

type LocalExecutor struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func (*LocalExecutor) GetLogger

func (exc *LocalExecutor) GetLogger() *dlog.Logger

func (*LocalExecutor) LoggerIdentity

func (exc *LocalExecutor) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*LocalExecutor) SetLogger

func (exc *LocalExecutor) SetLogger(logger *dlog.Logger)

func (*LocalExecutor) Start

func (exc *LocalExecutor) Start(ctx context.Context) error

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) GetLogger

func (m *Manager) GetLogger() *dlog.Logger

func (*Manager) Id

func (m *Manager) Id() string

func (*Manager) LoggerIdentity

func (m *Manager) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*Manager) Plan

func (m *Manager) Plan() error

Plan generate plan based on job spec

func (*Manager) SetAssignedNodes

func (m *Manager) SetAssignedNodes(nodes []pb.AssignedNode)

func (*Manager) SetLogger

func (m *Manager) SetLogger(logger *dlog.Logger)

func (*Manager) SetSpec

func (m *Manager) SetSpec(spec pb.JobSpec)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start creates a goroutine and return immediately, error only comes from incorrect configuration MUST call Plan before call Start

type MockExecutor

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

func (*MockExecutor) GetLogger

func (exc *MockExecutor) GetLogger() *dlog.Logger

func (*MockExecutor) LoggerIdentity

func (exc *MockExecutor) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*MockExecutor) SetLogger

func (exc *MockExecutor) SetLogger(logger *dlog.Logger)

func (*MockExecutor) Start

func (exc *MockExecutor) Start(ctx context.Context) error

type Planner

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

Planner generates execution plan based on assigned node and config

func NewPlanner

func NewPlanner() *Planner

func (*Planner) GetLogger

func (p *Planner) GetLogger() *dlog.Logger

func (*Planner) Job

func (p *Planner) Job(nodes []pb.AssignedNode, jobSpec pb.JobSpec) (pb.JobPlan, error)

func (*Planner) LoggerIdentity

func (p *Planner) LoggerIdentity(justCallMe func() *dlog.Identity) *dlog.Identity

func (*Planner) SetLogger

func (p *Planner) SetLogger(logger *dlog.Logger)

func (*Planner) Stage

func (p *Planner) Stage(nodes []pb.AssignedNode, stageSpec pb.StageSpec) (pb.StagePlan, error)

func (*Planner) Task

func (p *Planner) Task(nodes []pb.AssignedNode, taskSpec pb.TaskSpec) (pb.TaskPlan, error)

Jump to

Keyboard shortcuts

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