taskrunner

package
v0.0.0-...-a204096 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MakeShellTimeout  = 2 * time.Minute
	SCPTimeout        = 3 * time.Minute
	StartAgentTimeout = 2 * time.Minute
)
View Source
const (
	RunnerName  = "taskrunner"
	Description = "run queued tasks on available hosts"
)

Variables

View Source
var (
	AgentPackageDirectorySubPath = filepath.Join("agent", "main")
)

Functions

func DispatchTaskForHost

func DispatchTaskForHost(taskQueue *model.TaskQueue, assignedHost *host.Host) (
	nextTask *task.Task, err error)

DispatchTaskForHost assigns the task at the head of the task queue to the given host, dequeues the task and then marks it as dispatched for the host

Types

type AgentHostGateway

type AgentHostGateway struct {
	// Destination directory for the agent executables
	ExecutablesDir string
	// contains filtered or unexported fields
}

Implementation of the HostGateway that builds and copies over the MCI agent to run tasks.

func (*AgentHostGateway) GetAgentRevision

func (agbh *AgentHostGateway) GetAgentRevision() (string, error)

Gets the git revision of the currently built agent

func (*AgentHostGateway) RunTaskOnHost

func (agbh *AgentHostGateway) RunTaskOnHost(settings *evergreen.Settings, taskToRun task.Task, hostObj host.Host) (string, error)

Start the task specified, on the host specified. First runs any necessary preparation on the remote machine, then kicks off the agent process on the machine. Returns an error if any step along the way fails.

type DBHostFinder

type DBHostFinder struct{}

DBHostFinder fetches the hosts from the database.

func (*DBHostFinder) FindAvailableHosts

func (self *DBHostFinder) FindAvailableHosts() ([]host.Host, error)

FindAvailableHosts finds all hosts available to have a task run on them. It fetches hosts from the database whose status is "running" and who have no task currently being run on them.

func (*DBHostFinder) FindAvailableHostsForDistro

func (self *DBHostFinder) FindAvailableHostsForDistro(d string) ([]host.Host, error)

FindAvailableHostsForDistro finds all hosts of a certain distro available to have a task run on them.

type DBTaskQueueFinder

type DBTaskQueueFinder struct{}

Implementation of the TaskQueueFinder that fetches the tasks from the task queue collection in the database

func (*DBTaskQueueFinder) FindTaskQueue

func (self *DBTaskQueueFinder) FindTaskQueue(distroId string) (*model.TaskQueue,
	error)

Finds the task queue for the specified distro, by fetching the appropriate task queue document from the database

type HostFinder

type HostFinder interface {
	// Find any hosts that are available to run a task
	FindAvailableHosts() ([]host.Host, error)
	FindAvailableHostsForDistro(distro string) ([]host.Host, error)
}

HostFinder is responsible for finding all hosts that are ready to run a new task.

type HostGateway

type HostGateway interface {
	// run the specified task on the specified host, return the revision of the
	// agent running the task on that host
	RunTaskOnHost(*evergreen.Settings, task.Task, host.Host) (string, error)
	// gets the current revision of the agent
	GetAgentRevision() (string, error)
}

HostGateway is responsible for kicking off tasks on remote machines.

type Runner

type Runner struct{}

func (*Runner) Description

func (r *Runner) Description() string

func (*Runner) Name

func (r *Runner) Name() string

func (*Runner) Run

func (r *Runner) Run(config *evergreen.Settings) error

type TaskQueueFinder

type TaskQueueFinder interface {
	// Find the queue of tasks to be run for the specified distro
	FindTaskQueue(distroId string) (*model.TaskQueue, error)
}

Interface responsible for finding the queues of tasks that need to be run

type TaskRunner

func NewTaskRunner

func NewTaskRunner(settings *evergreen.Settings) *TaskRunner

func (*TaskRunner) Run

func (self *TaskRunner) Run() error

Runs the sequence of events that kicks off tasks on hosts. Works by finding any hosts available to have a task run on them, and then figuring out the next appropriate task for each of the hosts and kicking them off. Returns an error if any error is thrown along the way.

Jump to

Keyboard shortcuts

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