Documentation ¶
Index ¶
Constants ¶
const ( MakeShellTimeout = 2 * time.Minute SCPTimeout = 3 * time.Minute StartAgentTimeout = 2 * time.Minute )
const ( RunnerName = "taskrunner" Description = "run queued tasks on available hosts" )
Variables ¶
var (
AgentPackageDirectorySubPath = filepath.Join("agent", "main")
)
Functions ¶
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 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 ¶
type TaskRunner struct { *evergreen.Settings HostFinder TaskQueueFinder HostGateway }
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.