taskrunner

package
v0.0.0-...-900fa13 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	// These variables determine what platforms and architectures we build the
	// agent for.  They are passed as arguments to the goxc binary.
	AgentOSTargets   = "windows darwin linux solaris"
	AgentArchTargets = "amd64 386"
)
View Source
var (
	AgentPackageDirectorySubPath = filepath.Join("agent", "main")
)

Functions

func DispatchTaskForHost

func DispatchTaskForHost(taskQueue *model.TaskQueue, assignedHost *host.Host) (
	nextTask *model.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 AgentBasedHostGateway

type AgentBasedHostGateway struct {
	// Responsible for cross-compiling the agent
	Compiler AgentCompiler
	// Absolute path to the directory where the agent package lives
	AgentPackageDir string
	// 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 (*AgentBasedHostGateway) AgentNeedsBuild

func (self *AgentBasedHostGateway) AgentNeedsBuild() (bool, error)

Determines if either there is no currently built version of the agent, or if the currently built version is out of date. Returns whether a new version needs to be built, and an error if any of the checks within the function throw an error.

func (*AgentBasedHostGateway) GetAgentRevision

func (self *AgentBasedHostGateway) GetAgentRevision() (string, error)

Gets the git revision of the currently built agent

func (*AgentBasedHostGateway) RunSetup

func (self *AgentBasedHostGateway) RunSetup() error

Prepares to run the tasks it needs to, by building the agent if necessary. Returns an error if any step along the way throws an error.

func (*AgentBasedHostGateway) RunTaskOnHost

func (self *AgentBasedHostGateway) RunTaskOnHost(settings *evergreen.Settings,
	taskToRun model.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 AgentCompiler

type AgentCompiler interface {
	// Compile the agent package into the specified directory
	// Takes in the sourceDir (where the agent package lives) and the desired
	// destination directory for the built binaries.
	// Returns an error if the compilation fails.
	Compile(sourceDir string, destDir string) error

	// Given a distro, return the correct subpath to appropriate executable
	// within the directory where the compiler cross-compiles all of the
	// executables
	ExecutableSubPath(distroId string) (string, error)
}

AgentCompiler controls cross-compilation of the agent package.

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.

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 GoxcAgentCompiler

type GoxcAgentCompiler struct {
	*evergreen.Settings
}

GoxcAgentCompiler uses goxc as the cross-compiler of choice.

func (*GoxcAgentCompiler) Compile

func (self *GoxcAgentCompiler) Compile(sourceDir string, destDir string) error

Compile cross-compiles the specified package into the specified destination dir, using goxc as the cross-compiler.

func (*GoxcAgentCompiler) ExecutableSubPath

func (self *GoxcAgentCompiler) ExecutableSubPath(id string) (string, error)

ExecutableSubPath returns the directory containing the compiled agents.

type HostFinder

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

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

type HostGateway

type HostGateway interface {
	// determine if the agent needs be rebuilt
	AgentNeedsBuild() (bool, error)
	// run any necessary setup before running tasks
	RunSetup() error
	// run the specified task on the specified host, return the revision of the
	// agent running the task on that host
	RunTaskOnHost(*evergreen.Settings, model.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